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>
diff --git a/runtime/thread_linux.cc b/runtime/thread_linux.cc
index ee66ccc..9aacb30 100644
--- a/runtime/thread_linux.cc
+++ b/runtime/thread_linux.cc
@@ -32,11 +32,18 @@
   }
 }
 
+// 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 @@
   // 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.