提交 0305a9d0 编写于 作者: D dholmes

8077674: BSD build failures due to undefined macros

Reviewed-by: dsamersoff, kbarrett, hseigel
上级 dc06c5e9
...@@ -1197,12 +1197,18 @@ pid_t os::Bsd::gettid() { ...@@ -1197,12 +1197,18 @@ pid_t os::Bsd::gettid() {
guarantee(retval != 0, "just checking"); guarantee(retval != 0, "just checking");
return retval; return retval;
#elif __FreeBSD__ #else
#ifdef __FreeBSD__
retval = syscall(SYS_thr_self); retval = syscall(SYS_thr_self);
#elif __OpenBSD__ #else
#ifdef __OpenBSD__
retval = syscall(SYS_getthrid); retval = syscall(SYS_getthrid);
#elif __NetBSD__ #else
#ifdef __NetBSD__
retval = (pid_t) syscall(SYS__lwp_self); retval = (pid_t) syscall(SYS__lwp_self);
#endif
#endif
#endif
#endif #endif
if (retval == -1) { if (retval == -1) {
......
...@@ -209,17 +209,23 @@ bool os::have_special_privileges() { ...@@ -209,17 +209,23 @@ bool os::have_special_privileges() {
#ifndef SYS_gettid #ifndef SYS_gettid
// i386: 224, ia64: 1105, amd64: 186, sparc 143 // i386: 224, ia64: 1105, amd64: 186, sparc 143
#ifdef __ia64__ #ifdef __ia64__
#define SYS_gettid 1105 #define SYS_gettid 1105
#elif __i386__ #else
#define SYS_gettid 224 #ifdef __i386__
#elif __amd64__ #define SYS_gettid 224
#define SYS_gettid 186 #else
#elif __sparc__ #ifdef __amd64__
#define SYS_gettid 143 #define SYS_gettid 186
#else #else
#error define gettid for the arch #ifdef __sparc__
#endif #define SYS_gettid 143
#else
#error define gettid for the arch
#endif
#endif
#endif
#endif
#endif #endif
// Cpu architecture string // Cpu architecture string
......
...@@ -110,11 +110,13 @@ static FILETIME process_user_time; ...@@ -110,11 +110,13 @@ static FILETIME process_user_time;
static FILETIME process_kernel_time; static FILETIME process_kernel_time;
#ifdef _M_IA64 #ifdef _M_IA64
#define __CPU__ ia64 #define __CPU__ ia64
#elif _M_AMD64
#define __CPU__ amd64
#else #else
#define __CPU__ i486 #ifdef _M_AMD64
#define __CPU__ amd64
#else
#define __CPU__ i486
#endif
#endif #endif
// save DLL module handle, used by GetModuleFileName // save DLL module handle, used by GetModuleFileName
...@@ -2138,20 +2140,22 @@ LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo, address handler ...@@ -2138,20 +2140,22 @@ LONG Handle_Exception(struct _EXCEPTION_POINTERS* exceptionInfo, address handler
// at the beginning of the target bundle. // at the beginning of the target bundle.
exceptionInfo->ContextRecord->StIPSR &= 0xFFFFF9FFFFFFFFFF; exceptionInfo->ContextRecord->StIPSR &= 0xFFFFF9FFFFFFFFFF;
assert(((DWORD64)handler & 0xF) == 0, "Target address must point to the beginning of a bundle!"); assert(((DWORD64)handler & 0xF) == 0, "Target address must point to the beginning of a bundle!");
#elif _M_AMD64 #else
#ifdef _M_AMD64
// Do not blow up if no thread info available. // Do not blow up if no thread info available.
if (thread) { if (thread) {
thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Rip); thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Rip);
} }
// Set pc to handler // Set pc to handler
exceptionInfo->ContextRecord->Rip = (DWORD64)handler; exceptionInfo->ContextRecord->Rip = (DWORD64)handler;
#else #else
// Do not blow up if no thread info available. // Do not blow up if no thread info available.
if (thread) { if (thread) {
thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Eip); thread->set_saved_exception_pc((address)(DWORD_PTR)exceptionInfo->ContextRecord->Eip);
} }
// Set pc to handler // Set pc to handler
exceptionInfo->ContextRecord->Eip = (DWORD)(DWORD_PTR)handler; exceptionInfo->ContextRecord->Eip = (DWORD)(DWORD_PTR)handler;
#endif
#endif #endif
// Continue the execution // Continue the execution
...@@ -2250,7 +2254,8 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { ...@@ -2250,7 +2254,8 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
// (division by zero is handled explicitly) // (division by zero is handled explicitly)
#ifdef _M_IA64 #ifdef _M_IA64
assert(0, "Fix Handle_IDiv_Exception"); assert(0, "Fix Handle_IDiv_Exception");
#elif _M_AMD64 #else
#ifdef _M_AMD64
PCONTEXT ctx = exceptionInfo->ContextRecord; PCONTEXT ctx = exceptionInfo->ContextRecord;
address pc = (address)ctx->Rip; address pc = (address)ctx->Rip;
assert(pc[0] == 0xF7, "not an idiv opcode"); assert(pc[0] == 0xF7, "not an idiv opcode");
...@@ -2261,7 +2266,7 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { ...@@ -2261,7 +2266,7 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
ctx->Rax = (DWORD)min_jint; // result ctx->Rax = (DWORD)min_jint; // result
ctx->Rdx = (DWORD)0; // remainder ctx->Rdx = (DWORD)0; // remainder
// Continue the execution // Continue the execution
#else #else
PCONTEXT ctx = exceptionInfo->ContextRecord; PCONTEXT ctx = exceptionInfo->ContextRecord;
address pc = (address)ctx->Eip; address pc = (address)ctx->Eip;
assert(pc[0] == 0xF7, "not an idiv opcode"); assert(pc[0] == 0xF7, "not an idiv opcode");
...@@ -2272,6 +2277,7 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) { ...@@ -2272,6 +2277,7 @@ LONG Handle_IDiv_Exception(struct _EXCEPTION_POINTERS* exceptionInfo) {
ctx->Eax = (DWORD)min_jint; // result ctx->Eax = (DWORD)min_jint; // result
ctx->Edx = (DWORD)0; // remainder ctx->Edx = (DWORD)0; // remainder
// Continue the execution // Continue the execution
#endif
#endif #endif
return EXCEPTION_CONTINUE_EXECUTION; return EXCEPTION_CONTINUE_EXECUTION;
} }
...@@ -2351,10 +2357,12 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { ...@@ -2351,10 +2357,12 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
// This is needed for IA64 because "relocation" / "implicit null check" / "poll instruction" // This is needed for IA64 because "relocation" / "implicit null check" / "poll instruction"
// information is saved in the Unix format. // information is saved in the Unix format.
address pc_unix_format = (address) ((((uint64_t)pc) & 0xFFFFFFFFFFFFFFF0) | ((((uint64_t)pc) & 0xF) >> 2)); address pc_unix_format = (address) ((((uint64_t)pc) & 0xFFFFFFFFFFFFFFF0) | ((((uint64_t)pc) & 0xF) >> 2));
#elif _M_AMD64
address pc = (address) exceptionInfo->ContextRecord->Rip;
#else #else
#ifdef _M_AMD64
address pc = (address) exceptionInfo->ContextRecord->Rip;
#else
address pc = (address) exceptionInfo->ContextRecord->Eip; address pc = (address) exceptionInfo->ContextRecord->Eip;
#endif
#endif #endif
Thread* t = ThreadLocalStorage::get_thread_slow(); // slow & steady Thread* t = ThreadLocalStorage::get_thread_slow(); // slow & steady
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册