Merge pull request #4023 from bentley/openbsd-context
Clean up context definition errors.
This commit is contained in:
commit
e21cc8937b
|
@ -34,7 +34,7 @@ typedef CONTEXT SContext;
|
||||||
#define CTX_R15 R15
|
#define CTX_R15 R15
|
||||||
#define CTX_RIP Rip
|
#define CTX_RIP Rip
|
||||||
#else
|
#else
|
||||||
#error No context definition for OS
|
#error No context definition for architecture
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__APPLE__) && !defined(USE_SIGACTION_ON_APPLE)
|
#elif defined(__APPLE__) && !defined(USE_SIGACTION_ON_APPLE)
|
||||||
// for modules:
|
// for modules:
|
||||||
|
@ -63,7 +63,7 @@ typedef x86_thread_state64_t SContext;
|
||||||
#define CTX_R15 __r15
|
#define CTX_R15 __r15
|
||||||
#define CTX_RIP __rip
|
#define CTX_RIP __rip
|
||||||
#else
|
#else
|
||||||
#error No context definition for OS
|
#error No context definition for architecture
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -114,7 +114,31 @@ typedef mcontext_t SContext;
|
||||||
#define CTX_SP sp
|
#define CTX_SP sp
|
||||||
#define CTX_PC pc
|
#define CTX_PC pc
|
||||||
#else
|
#else
|
||||||
#warning No context definition for OS
|
#error No context definition for architecture
|
||||||
|
#endif
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
#include <signal.h>
|
||||||
|
typedef ucontext_t SContext;
|
||||||
|
#if _M_X86_64
|
||||||
|
#define CTX_RAX sc_rax
|
||||||
|
#define CTX_RBX sc_rbx
|
||||||
|
#define CTX_RCX sc_rcx
|
||||||
|
#define CTX_RDX sc_rdx
|
||||||
|
#define CTX_RDI sc_rdi
|
||||||
|
#define CTX_RSI sc_rsi
|
||||||
|
#define CTX_RBP sc_rbp
|
||||||
|
#define CTX_RSP sc_rsp
|
||||||
|
#define CTX_R8 sc_r8
|
||||||
|
#define CTX_R9 sc_r9
|
||||||
|
#define CTX_R10 sc_r10
|
||||||
|
#define CTX_R11 sc_r11
|
||||||
|
#define CTX_R12 sc_r12
|
||||||
|
#define CTX_R13 sc_r13
|
||||||
|
#define CTX_R14 sc_r14
|
||||||
|
#define CTX_R15 sc_r15
|
||||||
|
#define CTX_RIP sc_rip
|
||||||
|
#else
|
||||||
|
#error No context definition for architecture
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
@ -138,7 +162,7 @@ typedef mcontext_t SContext;
|
||||||
#define CTX_R15 __gregs[_REG_R15]
|
#define CTX_R15 __gregs[_REG_R15]
|
||||||
#define CTX_RIP __gregs[_REG_RIP]
|
#define CTX_RIP __gregs[_REG_RIP]
|
||||||
#else
|
#else
|
||||||
#error No context definition for OS
|
#error No context definition for architecture
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
@ -162,8 +186,10 @@ typedef mcontext_t SContext;
|
||||||
#define CTX_R15 mc_r15
|
#define CTX_R15 mc_r15
|
||||||
#define CTX_RIP mc_rip
|
#define CTX_RIP mc_rip
|
||||||
#else
|
#else
|
||||||
#error No context definition for OS
|
#error No context definition for architecture
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#error No context definition for OS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _M_X86_64
|
#if _M_X86_64
|
||||||
|
|
|
@ -249,7 +249,11 @@ static void sigsegv_handler(int sig, siginfo_t* info, void* raw_context)
|
||||||
uintptr_t bad_address = (uintptr_t)info->si_addr;
|
uintptr_t bad_address = (uintptr_t)info->si_addr;
|
||||||
|
|
||||||
// Get all the information we can out of the context.
|
// Get all the information we can out of the context.
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
ucontext_t* ctx = context;
|
||||||
|
#else
|
||||||
mcontext_t* ctx = &context->uc_mcontext;
|
mcontext_t* ctx = &context->uc_mcontext;
|
||||||
|
#endif
|
||||||
// assume it's not a write
|
// assume it's not a write
|
||||||
if (!JitInterface::HandleFault(bad_address,
|
if (!JitInterface::HandleFault(bad_address,
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
Loading…
Reference in New Issue