Blame src/linux-context.h

Packit Service a1973e
#ifndef _LINUX_CONTEXT_H
Packit Service a1973e
#define _LINUX_CONTEXT_H
Packit Service a1973e
Packit Service a1973e
/* Signal handling functions */
Packit Service a1973e
Packit Service a1973e
#undef hwd_siginfo_t
Packit Service a1973e
Packit Service a1973e
/* Changed from struct siginfo due to POSIX and Fedora 18       */
Packit Service a1973e
/* If this breaks anything then we need to add an aufoconf test */
Packit Service a1973e
typedef siginfo_t hwd_siginfo_t;
Packit Service a1973e
Packit Service a1973e
#undef hwd_ucontext_t
Packit Service a1973e
typedef ucontext_t hwd_ucontext_t;
Packit Service a1973e
Packit Service a1973e
#if defined(__ia64__)
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.sc_ip
Packit Service a1973e
#elif defined(__i386__)
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.gregs[REG_EIP]
Packit Service a1973e
#elif defined(__x86_64__)
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.gregs[REG_RIP]
Packit Service a1973e
#elif defined(__powerpc__) && !defined(__powerpc64__)
Packit Service a1973e
/*
Packit Service a1973e
 * The index of the Next IP (REG_NIP) was obtained by looking at kernel
Packit Service a1973e
 * source code.  It wasn't documented anywhere else that I could find.
Packit Service a1973e
 */
Packit Service a1973e
#define REG_NIP 32
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.uc_regs->gregs[REG_NIP]
Packit Service a1973e
#elif defined(__powerpc64__)
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.regs->nip
Packit Service a1973e
#elif defined(__sparc__)
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ((struct sigcontext *)ctx.ucontext)->si_regs.pc
Packit Service a1973e
#elif defined(__arm__)
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.arm_pc
Packit Service a1973e
#elif defined(__aarch64__)
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc
Packit Service a1973e
#elif defined(__mips__)
Packit Service a1973e
#define OVERFLOW_ADDRESS(ctx) ctx.ucontext->uc_mcontext.pc
Packit Service a1973e
#else
Packit Service a1973e
#error "OVERFLOW_ADDRESS() undefined!"
Packit Service a1973e
#endif
Packit Service a1973e
Packit Service a1973e
#define GET_OVERFLOW_ADDRESS(ctx) (caddr_t)(OVERFLOW_ADDRESS(ctx))
Packit Service a1973e
Packit Service a1973e
#endif