summaryrefslogtreecommitdiffstats
path: root/runtime/thread_linux.cc
diff options
context:
space:
mode:
authorDave Allison <dallison@google.com>2014-07-16 16:04:32 -0700
committerDave Allison <dallison@google.com>2014-08-07 09:26:35 -0700
commitdfd3b47813c14c5f1607cbe7b10a28b1b2f29cbc (patch)
treeb71dbae2ef905c08eb4cf615c8b44868cc314531 /runtime/thread_linux.cc
parent8b62dc0f993d0445401655fc274e5225498fa81c (diff)
downloadart-dfd3b47813c14c5f1607cbe7b10a28b1b2f29cbc.tar.gz
art-dfd3b47813c14c5f1607cbe7b10a28b1b2f29cbc.tar.bz2
art-dfd3b47813c14c5f1607cbe7b10a28b1b2f29cbc.zip
Add implicit checks for x86_64 architecture.
This combines the x86 and x86_64 fault handlers into one. It also merges in the change to the entrypoints for X86_64. Replaces generic instruction length calculator with one that only works with the specific instructions we use. Bug: 16256184 Change-Id: I1e8ab5ad43f46060de9597615b423c89a836035c Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
Diffstat (limited to 'runtime/thread_linux.cc')
-rw-r--r--runtime/thread_linux.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/runtime/thread_linux.cc b/runtime/thread_linux.cc
index ee66ccc29a..9aacb301ec 100644
--- a/runtime/thread_linux.cc
+++ b/runtime/thread_linux.cc
@@ -32,11 +32,18 @@ static void SigAltStack(stack_t* new_stack, stack_t* old_stack) {
}
}
+// The default SIGSTKSZ on linux is 8K. If we do any logging in a signal
+// handler this is too small. We allocate 16K instead.
+static constexpr int kHostAltSigStackSize = 16*1024; // 16K signal stack.
+
void Thread::SetUpAlternateSignalStack() {
// Create and set an alternate signal stack.
+#ifdef HAVE_ANDROID_OS
+ LOG(FATAL) << "Invalid use of alternate signal stack on Android";
+#endif
stack_t ss;
- ss.ss_sp = new uint8_t[SIGSTKSZ];
- ss.ss_size = SIGSTKSZ;
+ ss.ss_sp = new uint8_t[kHostAltSigStackSize];
+ ss.ss_size = kHostAltSigStackSize;
ss.ss_flags = 0;
CHECK(ss.ss_sp != NULL);
SigAltStack(&ss, NULL);
@@ -56,7 +63,7 @@ void Thread::TearDownAlternateSignalStack() {
// Tell the kernel to stop using it.
ss.ss_sp = NULL;
ss.ss_flags = SS_DISABLE;
- ss.ss_size = SIGSTKSZ; // Avoid ENOMEM failure with Mac OS' buggy libc.
+ ss.ss_size = kHostAltSigStackSize; // Avoid ENOMEM failure with Mac OS' buggy libc.
SigAltStack(&ss, NULL);
// Free it.