Bug 919968 - Simplify ContextToPC() and make it work on non-Linux ARM. r=luke

This commit is contained in:
Jan Beich 2013-09-25 09:48:21 -04:00
parent 48781f4076
commit 6f0a692644

View File

@ -64,7 +64,6 @@ using JS::GenericNaN;
# define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_PC])
# endif
# define RIP_sig(p) ((p)->uc_mcontext.gregs[REG_RIP])
# define PC_sig(p) ((p)->uc_mcontext.arm_pc)
# define RAX_sig(p) ((p)->uc_mcontext.gregs[REG_RAX])
# define RCX_sig(p) ((p)->uc_mcontext.gregs[REG_RCX])
# define RDX_sig(p) ((p)->uc_mcontext.gregs[REG_RDX])
@ -80,7 +79,11 @@ using JS::GenericNaN;
# define R12_sig(p) ((p)->uc_mcontext.gregs[REG_R12])
# define R13_sig(p) ((p)->uc_mcontext.gregs[REG_R13])
# define R14_sig(p) ((p)->uc_mcontext.gregs[REG_R14])
# define R15_sig(p) ((p)->uc_mcontext.gregs[REG_R15])
# if defined(__linux__) && defined(__arm__)
# define R15_sig(p) ((p)->uc_mcontext.arm_pc)
# else
# define R15_sig(p) ((p)->uc_mcontext.gregs[REG_R15])
# endif
#elif defined(__NetBSD__)
# define XMM_sig(p,i) (((struct fxsave64 *)(p)->uc_mcontext.__fpregs)->fx_xmm[i])
# define EIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EIP])
@ -124,7 +127,11 @@ using JS::GenericNaN;
# define R12_sig(p) ((p)->uc_mcontext.mc_r12)
# define R13_sig(p) ((p)->uc_mcontext.mc_r13)
# define R14_sig(p) ((p)->uc_mcontext.mc_r14)
# define R15_sig(p) ((p)->uc_mcontext.mc_r15)
# if defined(__FreeBSD__) && defined(__arm__)
# define R15_sig(p) ((p)->uc_mcontext.__gregs[_REG_R15])
# else
# define R15_sig(p) ((p)->uc_mcontext.mc_r15)
# endif
#elif defined(XP_MACOSX)
// Mach requires special treatment.
#else
@ -381,20 +388,20 @@ static bool IsSignalHandlingBroken() { return false; }
# define CONTEXT ucontext_t
#endif
#if defined(JS_CPU_X64)
# define PC_sig(p) RIP_sig(p)
#elif defined(JS_CPU_X86)
# define PC_sig(p) EIP_sig(p)
#elif defined(JS_CPU_ARM)
# define PC_sig(p) R15_sig(p)
#endif
#if !defined(XP_MACOSX)
static uint8_t **
ContextToPC(CONTEXT *context)
{
# if defined(JS_CPU_X64)
JS_STATIC_ASSERT(sizeof(RIP_sig(context)) == sizeof(void*));
return reinterpret_cast<uint8_t**>(&RIP_sig(context));
# elif defined(JS_CPU_X86)
JS_STATIC_ASSERT(sizeof(EIP_sig(context)) == sizeof(void*));
return reinterpret_cast<uint8_t**>(&EIP_sig(context));
# elif defined(JS_CPU_ARM)
JS_STATIC_ASSERT(sizeof(PC_sig(context)) == sizeof(void*));
return reinterpret_cast<uint8_t**>(&PC_sig(context));
# endif
}
# if defined(JS_CPU_X64)