summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christopher Ferris <cferris@google.com> 2014-07-11 05:43:02 +0000
committer Christopher Ferris <cferris@google.com> 2014-07-11 05:43:02 +0000
commitbc8a28896af5b99f0a42028f98bf0c74eb8047c9 (patch)
tree3f73a362e1cbeec7f4f6aa7224dc0bd8de1942c5
parente9343344d9bd268a05d1eae1ce80a3278ec19c89 (diff)
Revert "Fix mac build"
This reverts commit e9343344d9bd268a05d1eae1ce80a3278ec19c89. Change-Id: I43d1717af9c3b1237dcacec66f55a4e4b8e1f0fe
-rw-r--r--runtime/arch/x86/fault_handler_x86.cc40
-rw-r--r--runtime/arch/x86_64/quick_entrypoints_x86_64.S4
-rw-r--r--sigchainlib/Android.mk2
-rw-r--r--sigchainlib/sigchain.cc4
4 files changed, 18 insertions, 32 deletions
diff --git a/runtime/arch/x86/fault_handler_x86.cc b/runtime/arch/x86/fault_handler_x86.cc
index 435f280a6b..f62200aabe 100644
--- a/runtime/arch/x86/fault_handler_x86.cc
+++ b/runtime/arch/x86/fault_handler_x86.cc
@@ -26,16 +26,6 @@
#include "thread.h"
#include "thread-inl.h"
-#if defined(__APPLE__)
-#define ucontext __darwin_ucontext
-#define CTX_ESP uc_mcontext->__ss.__esp
-#define CTX_EIP uc_mcontext->__ss.__eip
-#define CTX_EAX uc_mcontext->__ss.__eax
-#else
-#define CTX_ESP uc_mcontext.gregs[REG_ESP]
-#define CTX_EIP uc_mcontext.gregs[REG_EIP]
-#define CTX_EAX uc_mcontext.gregs[REG_EAX]
-#endif
//
// X86 specific fault handler functions.
@@ -173,7 +163,7 @@ void FaultManager::GetMethodAndReturnPCAndSP(siginfo_t* siginfo, void* context,
mirror::ArtMethod** out_method,
uintptr_t* out_return_pc, uintptr_t* out_sp) {
struct ucontext* uc = reinterpret_cast<struct ucontext*>(context);
- *out_sp = static_cast<uintptr_t>(uc->CTX_ESP);
+ *out_sp = static_cast<uintptr_t>(uc->uc_mcontext.gregs[REG_ESP]);
VLOG(signals) << "sp: " << std::hex << *out_sp;
if (*out_sp == 0) {
return;
@@ -185,13 +175,13 @@ void FaultManager::GetMethodAndReturnPCAndSP(siginfo_t* siginfo, void* context,
uintptr_t* overflow_addr = reinterpret_cast<uintptr_t*>(
reinterpret_cast<uint8_t*>(*out_sp) - GetStackOverflowReservedBytes(kX86));
if (overflow_addr == fault_addr) {
- *out_method = reinterpret_cast<mirror::ArtMethod*>(uc->CTX_EAX);
+ *out_method = reinterpret_cast<mirror::ArtMethod*>(uc->uc_mcontext.gregs[REG_EAX]);
} else {
// The method is at the top of the stack.
*out_method = reinterpret_cast<mirror::ArtMethod*>(reinterpret_cast<uintptr_t*>(*out_sp)[0]);
}
- uint8_t* pc = reinterpret_cast<uint8_t*>(uc->CTX_EIP);
+ uint8_t* pc = reinterpret_cast<uint8_t*>(uc->uc_mcontext.gregs[REG_EIP]);
VLOG(signals) << HexDump(pc, 32, true, "PC ");
uint32_t instr_size = GetInstructionSize(pc);
@@ -200,8 +190,8 @@ void FaultManager::GetMethodAndReturnPCAndSP(siginfo_t* siginfo, void* context,
bool NullPointerHandler::Action(int sig, siginfo_t* info, void* context) {
struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
- uint8_t* pc = reinterpret_cast<uint8_t*>(uc->CTX_EIP);
- uint8_t* sp = reinterpret_cast<uint8_t*>(uc->CTX_ESP);
+ uint8_t* pc = reinterpret_cast<uint8_t*>(uc->uc_mcontext.gregs[REG_EIP]);
+ uint8_t* sp = reinterpret_cast<uint8_t*>(uc->uc_mcontext.gregs[REG_ESP]);
uint32_t instr_size = GetInstructionSize(pc);
// We need to arrange for the signal handler to return to the null pointer
@@ -213,9 +203,10 @@ bool NullPointerHandler::Action(int sig, siginfo_t* info, void* context) {
uint32_t retaddr = reinterpret_cast<uint32_t>(pc + instr_size);
uint32_t* next_sp = reinterpret_cast<uint32_t*>(sp - 4);
*next_sp = retaddr;
- uc->CTX_ESP = reinterpret_cast<uint32_t>(next_sp);
+ uc->uc_mcontext.gregs[REG_ESP] = reinterpret_cast<uint32_t>(next_sp);
- uc->CTX_EIP = reinterpret_cast<uintptr_t>(art_quick_throw_null_pointer_exception);
+ uc->uc_mcontext.gregs[REG_EIP] =
+ reinterpret_cast<uintptr_t>(art_quick_throw_null_pointer_exception);
VLOG(signals) << "Generating null pointer exception";
return true;
}
@@ -239,8 +230,8 @@ bool SuspensionHandler::Action(int sig, siginfo_t* info, void* context) {
uint8_t checkinst2[] = {0x85, 0x00};
struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
- uint8_t* pc = reinterpret_cast<uint8_t*>(uc->CTX_EIP);
- uint8_t* sp = reinterpret_cast<uint8_t*>(uc->CTX_ESP);
+ uint8_t* pc = reinterpret_cast<uint8_t*>(uc->uc_mcontext.gregs[REG_EIP]);
+ uint8_t* sp = reinterpret_cast<uint8_t*>(uc->uc_mcontext.gregs[REG_ESP]);
if (pc[0] != checkinst2[0] || pc[1] != checkinst2[1]) {
// Second instruction is not correct (test eax,[eax]).
@@ -273,9 +264,9 @@ bool SuspensionHandler::Action(int sig, siginfo_t* info, void* context) {
uint32_t retaddr = reinterpret_cast<uint32_t>(pc + 2);
uint32_t* next_sp = reinterpret_cast<uint32_t*>(sp - 4);
*next_sp = retaddr;
- uc->CTX_ESP = reinterpret_cast<uint32_t>(next_sp);
+ uc->uc_mcontext.gregs[REG_ESP] = reinterpret_cast<uint32_t>(next_sp);
- uc->CTX_EIP = reinterpret_cast<uintptr_t>(art_quick_test_suspend);
+ uc->uc_mcontext.gregs[REG_EIP] = reinterpret_cast<uintptr_t>(art_quick_test_suspend);
// Now remove the suspend trigger that caused this fault.
Thread::Current()->RemoveSuspendTrigger();
@@ -295,7 +286,7 @@ bool SuspensionHandler::Action(int sig, siginfo_t* info, void* context) {
bool StackOverflowHandler::Action(int sig, siginfo_t* info, void* context) {
struct ucontext *uc = reinterpret_cast<struct ucontext*>(context);
- uintptr_t sp = static_cast<uintptr_t>(uc->CTX_ESP);
+ uintptr_t sp = static_cast<uintptr_t>(uc->uc_mcontext.gregs[REG_ESP]);
uintptr_t fault_addr = reinterpret_cast<uintptr_t>(info->si_addr);
VLOG(signals) << "fault_addr: " << std::hex << fault_addr;
@@ -324,10 +315,11 @@ bool StackOverflowHandler::Action(int sig, siginfo_t* info, void* context) {
// the previous frame.
// Tell the stack overflow code where the new stack pointer should be.
- uc->CTX_EAX = pregion;
+ uc->uc_mcontext.gregs[REG_EAX] = pregion;
// Now arrange for the signal handler to return to art_quick_throw_stack_overflow_from_signal.
- uc->CTX_EIP = reinterpret_cast<uintptr_t>(art_quick_throw_stack_overflow_from_signal);
+ uc->uc_mcontext.gregs[REG_EIP] = reinterpret_cast<uintptr_t>(
+ art_quick_throw_stack_overflow_from_signal);
return true;
}
diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
index 885fbfde5b..7f7226c0ad 100644
--- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S
+++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
@@ -18,7 +18,7 @@
MACRO0(SETUP_FP_CALLEE_SAVE_FRAME)
// Create space for ART FP callee-saved registers
- subq MACRO_LITERAL(4 * 8), %rsp
+ subq LITERAL(4 * 8), %rsp
CFI_ADJUST_CFA_OFFSET(4 * 8)
movq %xmm12, 0(%rsp)
movq %xmm13, 8(%rsp)
@@ -32,7 +32,7 @@ MACRO0(RESTORE_FP_CALLEE_SAVE_FRAME)
movq 8(%rsp), %xmm13
movq 16(%rsp), %xmm14
movq 24(%rsp), %xmm15
- addq MACRO_LITERAL(4 * 8), %rsp
+ addq LITERAL(4 * 8), %rsp
CFI_ADJUST_CFA_OFFSET(- 4 * 8)
END_MACRO
diff --git a/sigchainlib/Android.mk b/sigchainlib/Android.mk
index d86735d120..20c8cacf3a 100644
--- a/sigchainlib/Android.mk
+++ b/sigchainlib/Android.mk
@@ -23,7 +23,6 @@ LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
LOCAL_SRC_FILES := sigchain.cc
-LOCAL_CLANG = $(ART_TARGET_CLANG)
LOCAL_MODULE:= libsigchain
LOCAL_SHARED_LIBRARIES := liblog libdl
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
@@ -36,7 +35,6 @@ LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
LOCAL_MODULE_TAGS := optional
LOCAL_IS_HOST_MODULE := true
LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
-LOCAL_CLANG = $(ART_HOST_CLANG)
LOCAL_SRC_FILES := sigchain.cc
LOCAL_MODULE:= libsigchain
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
diff --git a/sigchainlib/sigchain.cc b/sigchainlib/sigchain.cc
index 6f93083832..458ad6958b 100644
--- a/sigchainlib/sigchain.cc
+++ b/sigchainlib/sigchain.cc
@@ -26,10 +26,6 @@
#include <stdio.h>
#include <stdlib.h>
-#if defined(__APPLE__)
-#define _NSIG NSIG
-#endif
-
namespace art {
class SignalAction {