[libcxxabi] r231578 - Unwind: tweak register handling for AArch64

Saleem Abdulrasool compnerd at compnerd.org
Sat Mar 7 13:36:08 PST 2015


Author: compnerd
Date: Sat Mar  7 15:36:08 2015
New Revision: 231578

URL: http://llvm.org/viewvc/llvm-project?rev=231578&view=rev
Log:
Unwind: tweak register handling for AArch64

AArch64 uses // as the comment character (although, Darwin uses ;).  However,
since we are using the C preprocessor on these files, // can be used as the
comment character across the board.

Tweak the platform guard to recognise __aarch64__ as well as __arm64__ for the
platform identifier.

Modified:
    libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S
    libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S

Modified: libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S?rev=231578&r1=231577&r2=231578&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S (original)
+++ libcxxabi/trunk/src/Unwind/UnwindRegistersRestore.S Sat Mar  7 15:36:08 2015
@@ -258,17 +258,17 @@ Lnovec:
   lwz    r3,20(r3)  ; do r3 last
   bctr
 
-#elif defined(__arm64__)
+#elif defined(__arm64__) || defined(__aarch64__)
 
-;
-; void libunwind::Registers_arm64::jumpto()
-;
-; On entry:
-;  thread_state pointer is in x0
-;
+//
+// void libunwind::Registers_arm64::jumpto()
+//
+// On entry:
+//  thread_state pointer is in x0
+//
   .p2align 2
 DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv)
-  ; skip restore of x0,x1 for now
+  // skip restore of x0,x1 for now
   ldp    x2, x3,  [x0, #0x010]
   ldp    x4, x5,  [x0, #0x020]
   ldp    x6, x7,  [x0, #0x030]
@@ -283,9 +283,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
   ldp    x24,x25, [x0, #0x0C0]
   ldp    x26,x27, [x0, #0x0D0]
   ldp    x28,fp,  [x0, #0x0E0]
-  ldr    lr,      [x0, #0x100]  ; restore pc into lr
+  ldr    lr,      [x0, #0x100]  // restore pc into lr
   ldr    x1,      [x0, #0x0F8]
-  mov    sp,x1          ; restore sp
+  mov    sp,x1                  // restore sp
 
   ldp    d0, d1,  [x0, #0x110]
   ldp    d2, d3,  [x0, #0x120]
@@ -305,8 +305,8 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
   ldr    d30,     [x0, #0x200]
   ldr    d31,     [x0, #0x208]
 
-  ldp    x0, x1,  [x0, #0x000]  ; restore x0,x1
-  ret    lr            ; jump to pc
+  ldp    x0, x1,  [x0, #0x000]  // restore x0,x1
+  ret    lr                     // jump to pc
 
 #elif defined(__arm__) && !defined(__APPLE__)
 

Modified: libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S?rev=231578&r1=231577&r2=231578&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S (original)
+++ libcxxabi/trunk/src/Unwind/UnwindRegistersSave.S Sat Mar  7 15:36:08 2015
@@ -230,14 +230,14 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext
   blr
 
 
-#elif defined(__arm64__)
+#elif defined(__arm64__) || defined(__aarch64__)
 
-;
-; extern int unw_getcontext(unw_context_t* thread_state)
-;
-; On entry:
-;  thread_state pointer is in x0
-;
+//
+// extern int unw_getcontext(unw_context_t* thread_state)
+//
+// On entry:
+//  thread_state pointer is in x0
+//
   .p2align 2
 DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
   stp    x0, x1,  [x0, #0x000]
@@ -258,8 +258,8 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext
   str    lr,      [x0, #0x0F0]
   mov    x1,sp
   str    x1,      [x0, #0x0F8]
-  str    lr,      [x0, #0x100]    ; store return address as pc
-  ; skip cpsr
+  str    lr,      [x0, #0x100]    // store return address as pc
+  // skip cpsr
   stp    d0, d1,  [x0, #0x110]
   stp    d2, d3,  [x0, #0x120]
   stp    d4, d5,  [x0, #0x130]
@@ -277,7 +277,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext
   stp    d28,d29, [x0, #0x1F0]
   str    d30,     [x0, #0x200]
   str    d31,     [x0, #0x208]
-  ldr    x0, #0      ; return UNW_ESUCCESS
+  ldr    x0, #0                   // return UNW_ESUCCESS
   ret
 
 #elif defined(__arm__) && !defined(__APPLE__)





More information about the cfe-commits mailing list