6e8bfa1786dab1f45d3dff5a1dcacc31a08d4844
[linux-2.6.git] / arch / sparc / include / asm / perf_event.h
1 #ifndef __ASM_SPARC_PERF_EVENT_H
2 #define __ASM_SPARC_PERF_EVENT_H
3
4 #ifdef CONFIG_PERF_EVENTS
5 #include <asm/ptrace.h>
6
7 extern void init_hw_perf_events(void);
8
9 #define perf_arch_fetch_caller_regs(regs, ip)           \
10 do {                                                    \
11         unsigned long _pstate, _asi, _pil, _i7, _fp;    \
12         __asm__ __volatile__("rdpr %%pstate, %0\n\t"    \
13                              "rd %%asi, %1\n\t"         \
14                              "rdpr %%pil, %2\n\t"       \
15                              "mov %%i7, %3\n\t"         \
16                              "mov %%i6, %4\n\t"         \
17                              : "=r" (_pstate),          \
18                                "=r" (_asi),             \
19                                "=r" (_pil),             \
20                                "=r" (_i7),              \
21                                "=r" (_fp));             \
22         (regs)->tstate = (_pstate << 8) |               \
23                 (_asi << 24) | (_pil << 20);            \
24         (regs)->tpc = (ip);                             \
25         (regs)->tnpc = (regs)->tpc + 4;                 \
26         (regs)->u_regs[UREG_I6] = _fp;                  \
27         (regs)->u_regs[UREG_I7] = _i7;                  \
28 } while (0)
29 #else
30 static inline void init_hw_perf_events(void)    { }
31 #endif
32
33 #endif