|
PAPI
5.0.1.0
|
00001 #ifndef _LINUX_CONTEXT_H 00002 #define _LINUX_CONTEXT_H 00003 00004 /* Signal handling functions */ 00005 00006 #undef hwd_siginfo_t 00007 00008 /* Changed from struct siginfo due to POSIX and Fedora 18 */ 00009 /* If this breaks anything then we need to add an aufoconf test */ 00010 typedef siginfo_t hwd_siginfo_t; 00011 00012 #undef hwd_ucontext_t 00013 typedef ucontext_t hwd_ucontext_t; 00014 00015 #if defined(__ia64__) 00016 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_ip 00017 #elif defined(__i386__) 00018 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.gregs[REG_EIP] 00019 #elif defined(__x86_64__) 00020 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.gregs[REG_RIP] 00021 #elif defined(__powerpc__) && !defined(__powerpc64__) 00022 /* 00023 * The index of the Next IP (REG_NIP) was obtained by looking at kernel 00024 * source code. It wasn't documented anywhere else that I could find. 00025 */ 00026 #define REG_NIP 32 00027 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.uc_regs->gregs[REG_NIP] 00028 #elif defined(__powerpc64__) 00029 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.regs->nip 00030 #elif defined(__sparc__) 00031 #define OVERFLOW_ADDRESS(ctx) ((struct sigcontext *)ctx.ucontext)->si_regs.pc 00032 #elif defined(__arm__) 00033 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.arm_pc 00034 #elif defined(__mips__) 00035 #define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc 00036 #else 00037 #error "OVERFLOW_ADDRESS() undefined!" 00038 #endif 00039 00040 #define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(OVERFLOW_ADDRESS(ctx)) 00041 00042 #endif