[PATCH] D22292: [libunwind] Fix unw_getcontext for ARMv6-m

Oliver Stannard via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 01:58:57 PDT 2016


olista01 added inline comments.

================
Comment at: src/UnwindRegistersRestore.S:325-336
@@ -324,5 +324,14 @@
 DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm20restoreCoreAndJumpToEv)
-#if !defined(__ARM_ARCH_ISA_ARM)
-  ldr r2, [r0, #52]
-  ldr r3, [r0, #60]
+#if !defined(__ARM_ARCH_ISA_ARM) && __ARM_ARCH_ISA_THUMB == 1
+  @ r8-r11: ldm into r1-r4, then mov to r8-r11
+  add r0, #0x20
+  ldm r0!, {r1-r4}
+  sub r0, #0x30
+  mov r8, r1
+  mov r9, r2
+  mov r10, r3
+  mov r11, r4
+  @ r12 does not need loading, it it the intra-procedure-call scratch register
+  ldr r2, [r0, #0x34]
+  ldr r3, [r0, #0x3c]
   mov sp, r2
----------------
> Maybe we should have three implementations?

Previously, we had two implementations:
* The first one is used for all thumb-only targets, but is only valid thumb2 code, and doesn't save the high registers
* The second one is ARM code used for all targets that have ARM (despite the comment about thumb2)

Now we have:
* The first one is used for Thumb1-only targets
* The second one is used for targets that have Thumb2 or ARM, and assembles as either ISA (with a preference for ARM, if that is available)


https://reviews.llvm.org/D22292





More information about the cfe-commits mailing list