aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-07-17 20:23:47 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-07-17 20:23:47 -0400
commitf2872746fb57836ff56230b9eebc584cc316bdc0 (patch)
tree0b0dfaa960016fcb79a17a703b23cd334ff97b52
parenta2f4f2ba59bc76f1700f5583017bff342a722223 (diff)
process bit fields accordingly to endian of file
Big endian processes bit fields differently than little endian. For big endian, the early bit fields are at the most significant side, but for little endian, they are on the least significant bits side. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-read.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/trace-read.c b/trace-read.c
index 7b3824c..ed11a71 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -351,12 +351,18 @@ static void get_next_page(int cpu)
351 351
352static unsigned int type_len4host(unsigned int type_len_ts) 352static unsigned int type_len4host(unsigned int type_len_ts)
353{ 353{
354 return type_len_ts & ((1 << 5) - 1); 354 if (file_bigendian)
355 return (type_len_ts >> 27) & ((1 << 5) - 1);
356 else
357 return type_len_ts & ((1 << 5) - 1);
355} 358}
356 359
357static unsigned int ts4host(unsigned int type_len_ts) 360static unsigned int ts4host(unsigned int type_len_ts)
358{ 361{
359 return type_len_ts >> 5; 362 if (file_bigendian)
363 return type_len_ts & ((1 << 27) - 1);
364 else
365 return type_len_ts >> 5;
360} 366}
361 367
362static int calc_index(void *ptr, int cpu) 368static int calc_index(void *ptr, int cpu)