base/regdump-arm.S, base/regdump.h: Save CPSR before `regdump_gpsave'.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 11 Oct 2020 23:03:58 +0000 (00:03 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 11 Oct 2020 23:03:58 +0000 (00:03 +0100)
Alas, the processor flags are clobbered by the PLT on-demand linkage
machinery, so we must save them in the macro before calling out to the
library.

base/regdump-arm.S
base/regdump.h

index 963a60e..6adcbdd 100644 (file)
@@ -60,15 +60,8 @@ FUNC(regdump_gpsave)
        add     r0, r4, #REGDUMP_GPSIZE
        str     r0, [r4, #13*4]
 
-       // Capture the status flags and return address.  If the return
-       // address has its low bit set, then the caller was in Thumb state:
-       // clear the bit from the reconstructed PC, and set the corresponding
-       // CPSR bit.
-       mrs     r0, cpsr
-       tst     r14, #1
+       // Clear the magic Thumb-state bit from the return address.
        bic     r1, r14, #1
-       orrne   r0, r0, #0x00000020
-       str     r0, [r13, #4*REGIX_CPSR]
        str     r1, [r13, #15*4]
 
        // Load the focus address and save it as r6.
index e056820..a07072d 100644 (file)
@@ -612,6 +612,8 @@ DO16(REGDEF_NEONQ)
        sub     r13, r13, #REGDUMP_GPSIZE
 
        // Save flags and general-purpose registers.
+       mrs     r14, cpsr
+       str     r14, [r13, #4*REGIX_CPSR]
        str     r12, [r13, #4*12]
        bl      regdump_gpsave