Revision: 18961
Author:   [email protected]
Date:     Thu Jan 30 18:17:08 2014 UTC
Log:      A64: Fix some compile errors when building for Android.

 - replace __arm__ define checks with __aarch64__
 - add 64 bit ucontext_t struct definition
 - fix V8_HOST_ARCH_A64 compile errors in sampler.cc
 - add aarch64 brk assembly instruction for debug break

[email protected]

Review URL: https://codereview.chromium.org/148913008
http://code.google.com/p/v8/source/detail?r=18961

Modified:
 /branches/experimental/a64/src/a64/cpu-a64.cc
 /branches/experimental/a64/src/isolate.cc
 /branches/experimental/a64/src/isolate.h
 /branches/experimental/a64/src/platform-freebsd.cc
 /branches/experimental/a64/src/platform-linux.cc
 /branches/experimental/a64/src/sampler.cc

=======================================
--- /branches/experimental/a64/src/a64/cpu-a64.cc Mon Jan 27 19:23:17 2014 UTC +++ /branches/experimental/a64/src/a64/cpu-a64.cc Thu Jan 30 18:17:08 2014 UTC
@@ -26,9 +26,6 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 // CPU specific code for arm independent of OS goes here.
-#ifdef __arm__
-#include <sys/syscall.h>  // For cache flushing.
-#endif

 #include "v8.h"

=======================================
--- /branches/experimental/a64/src/isolate.cc   Thu Jan 30 12:09:30 2014 UTC
+++ /branches/experimental/a64/src/isolate.cc   Thu Jan 30 18:17:08 2014 UTC
@@ -1807,7 +1807,7 @@
   thread_manager_->isolate_ = this;

 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \
-    V8_TARGET_ARCH_A64 && !defined(__arm__) || \
+    V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \
     V8_TARGET_ARCH_MIPS && !defined(__mips__)
   simulator_initialized_ = false;
   simulator_i_cache_ = NULL;
=======================================
--- /branches/experimental/a64/src/isolate.h    Thu Jan 30 12:09:30 2014 UTC
+++ /branches/experimental/a64/src/isolate.h    Thu Jan 30 18:17:08 2014 UTC
@@ -101,8 +101,8 @@
 class DebuggerAgent;
 #endif

-#if !defined(__arm__) && V8_TARGET_ARCH_A64 || \
-    !defined(__arm__) && V8_TARGET_ARCH_ARM || \
+#if !defined(__arm__) && V8_TARGET_ARCH_ARM || \
+    !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \
     !defined(__mips__) && V8_TARGET_ARCH_MIPS
 class Redirection;
 class Simulator;
@@ -403,7 +403,7 @@
           stack_limit_(0),
           thread_state_(NULL),
 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \
-    !defined(__arm__) && V8_TARGET_ARCH_A64 || \
+    !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \
     !defined(__mips__) && V8_TARGET_ARCH_MIPS
           simulator_(NULL),
 #endif
@@ -417,7 +417,7 @@
     void set_thread_state(ThreadState* value) { thread_state_ = value; }

 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \
-    !defined(__arm__) && V8_TARGET_ARCH_A64 || \
+    !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \
     !defined(__mips__) && V8_TARGET_ARCH_MIPS
     Simulator* simulator() const { return simulator_; }
     void set_simulator(Simulator* simulator) {
@@ -436,7 +436,7 @@
     ThreadState* thread_state_;

 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \
-    !defined(__arm__) && V8_TARGET_ARCH_A64 || \
+    !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \
     !defined(__mips__) && V8_TARGET_ARCH_MIPS
     Simulator* simulator_;
 #endif
@@ -1013,7 +1013,7 @@
 #endif

 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \
-    V8_TARGET_ARCH_A64 && !defined(__arm__) || \
+    V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \
     V8_TARGET_ARCH_MIPS && !defined(__mips__)
   bool simulator_initialized() { return simulator_initialized_; }
   void set_simulator_initialized(bool initialized) {
@@ -1327,7 +1327,7 @@
   double time_millis_at_init_;

 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \
-    V8_TARGET_ARCH_A64 && !defined(__arm__) || \
+    V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \
     V8_TARGET_ARCH_MIPS && !defined(__mips__)
   bool simulator_initialized_;
   HashMap* simulator_i_cache_;
=======================================
--- /branches/experimental/a64/src/platform-freebsd.cc Tue Jan 28 15:50:06 2014 UTC +++ /branches/experimental/a64/src/platform-freebsd.cc Thu Jan 30 18:17:08 2014 UTC
@@ -189,6 +189,8 @@
 void OS::DebugBreak() {
 #if (defined(__arm__) || defined(__thumb__))
   asm("bkpt 0");
+#elif defined(__aarch64__)
+  asm("brk 0");
 #else
   asm("int $3");
 #endif
=======================================
--- /branches/experimental/a64/src/platform-linux.cc Thu Jan 30 12:09:30 2014 UTC +++ /branches/experimental/a64/src/platform-linux.cc Thu Jan 30 18:17:08 2014 UTC
@@ -58,7 +58,8 @@
 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'.
 // Old versions of the C library <signal.h> didn't define the type.
 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \
-    defined(__arm__) && !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
+    (defined(__arm__) || defined(__aarch64__)) && \
+    !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
 #include <asm/sigcontext.h>
 #endif

@@ -438,10 +439,10 @@
 void OS::DebugBreak() {
 // TODO(lrn): Introduce processor define for runtime system (!= V8_ARCH_x,
 //  which is the architecture of generated code).
-#if defined(__aarch64__)
-  asm("hlt 0");
-#elif defined(__arm__) || defined(__thumb__)
+#if defined(__arm__) || defined(__thumb__)
   asm("bkpt 0");
+#elif defined(__aarch64__)
+  asm("brk 0");
 #elif defined(__mips__)
   asm("break");
 #elif defined(__native_client__)
=======================================
--- /branches/experimental/a64/src/sampler.cc   Tue Jan 28 13:51:10 2014 UTC
+++ /branches/experimental/a64/src/sampler.cc   Thu Jan 30 18:17:08 2014 UTC
@@ -46,7 +46,8 @@
 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'.
 // Old versions of the C library <signal.h> didn't define the type.
 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \
-    defined(__arm__) && !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
+    (defined(__arm__) || defined(__aarch64__)) && \
+    !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
 #include <asm/sigcontext.h>
 #endif

@@ -80,9 +81,6 @@
 //
 // See http://code.google.com/p/android/issues/detail?id=34784

-// TODO(jbramley): This is not (and has never been) defined for A64. Does A64's
-// Android provide ucontext_t? Should we add an A64 variant?
-
 #if defined(__arm__)

 typedef struct sigcontext mcontext_t;
@@ -95,6 +93,18 @@
   // Other fields are not used by V8, don't define them here.
 } ucontext_t;

+#elif defined(__aarch64__)
+
+typedef struct sigcontext mcontext_t;
+
+typedef struct ucontext {
+  uint64_t uc_flags;
+  struct ucontext *uc_link;
+  stack_t uc_stack;
+  mcontext_t uc_mcontext;
+  // Other fields are not used by V8, don't define them here.
+} ucontext_t;
+
 #elif defined(__mips__)
 // MIPS version of sigcontext, for Android bionic.
 typedef struct {
@@ -376,10 +386,10 @@
 #endif  // defined(__GLIBC__) && !defined(__UCLIBC__) &&
         // (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
 #elif V8_HOST_ARCH_A64
-  sample->pc = reinterpret_cast<Address>(mcontext.pc);
-  sample->sp = reinterpret_cast<Address>(mcontext.sp);
+  state.pc = reinterpret_cast<Address>(mcontext.pc);
+  state.sp = reinterpret_cast<Address>(mcontext.sp);
   // FP is an alias for x29.
-  sample->fp = reinterpret_cast<Address>(mcontext.regs[29]);
+  state.fp = reinterpret_cast<Address>(mcontext.regs[29]);
 #elif V8_HOST_ARCH_MIPS
   state.pc = reinterpret_cast<Address>(mcontext.pc);
   state.sp = reinterpret_cast<Address>(mcontext.gregs[29]);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to