aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2010-05-20 04:34:59 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-05-20 05:21:57 -0400
commit85cb68b27c428d477169f3aa46c72dba103a17bd (patch)
tree78a1f0b444f53d28760ece50ab47f820b0ba7b45 /tools/perf
parent49f135ed02828a58b2401f149926c2e3c9cb0116 (diff)
perf: Fix unaligned accesses while fetching trace values
Accessing trace values of an 8 size may end up in a segfault on archs that can't deal with misaligned access, which is the case for sparc 64. This is because PERF_SAMPLE_RAW are aligned to 4 and not to 8. Fix this on the macros that get the values of 8 size. This fixes segfaults on perf tools in sparc 64. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> Cc: David Miller <davem@davemloft.net>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/trace-event.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 406d452956d..b3e86b1e444 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -233,7 +233,12 @@ static inline unsigned long long __data2host8(unsigned long long data)
233 233
234#define data2host2(ptr) __data2host2(*(unsigned short *)ptr) 234#define data2host2(ptr) __data2host2(*(unsigned short *)ptr)
235#define data2host4(ptr) __data2host4(*(unsigned int *)ptr) 235#define data2host4(ptr) __data2host4(*(unsigned int *)ptr)
236#define data2host8(ptr) __data2host8(*(unsigned long long *)ptr) 236#define data2host8(ptr) ({ \
237 unsigned long long __val; \
238 \
239 memcpy(&__val, (ptr), sizeof(unsigned long long)); \
240 __data2host8(__val); \
241})
237 242
238extern int header_page_ts_offset; 243extern int header_page_ts_offset;
239extern int header_page_ts_size; 244extern int header_page_ts_size;