PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
linux-context.h
Go to the documentation of this file.
1 #ifndef _LINUX_CONTEXT_H
2 #define _LINUX_CONTEXT_H
3 
4 /* Signal handling functions */
5 
6 #undef hwd_siginfo_t
7 
8 /* Changed from struct siginfo due to POSIX and Fedora 18 */
9 /* If this breaks anything then we need to add an aufoconf test */
10 typedef siginfo_t hwd_siginfo_t;
11 
12 #undef hwd_ucontext_t
13 typedef ucontext_t hwd_ucontext_t;
14 
15 #if defined(__ia64__)
16 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_ip
17 #elif defined(__i386__)
18 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.gregs[REG_EIP]
19 #elif defined(__x86_64__)
20 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.gregs[REG_RIP]
21 #elif defined(__powerpc__) && !defined(__powerpc64__)
22 /*
23  * The index of the Next IP (REG_NIP) was obtained by looking at kernel
24  * source code. It wasn't documented anywhere else that I could find.
25  */
26 #define REG_NIP 32
27 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.uc_regs->gregs[REG_NIP]
28 #elif defined(__powerpc64__)
29 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.regs->nip
30 #elif defined(__sparc__)
31 #define OVERFLOW_ADDRESS(ctx) ((struct sigcontext *)ctx.ucontext)->si_regs.pc
32 #elif defined(__arm__)
33 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.arm_pc
34 #elif defined(__aarch64__)
35 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc
36 #elif defined(__mips__)
37 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc
38 #else
39 #error "OVERFLOW_ADDRESS() undefined!"
40 #endif
41 
42 #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(OVERFLOW_ADDRESS(ctx))
43 
44 #endif
#define hwd_ucontext_t
#define hwd_siginfo_t