arm64: Save spsr in pt_regs
authorSean Anderson <sean.anderson@seco.com>
Tue, 22 Mar 2022 20:59:28 +0000 (16:59 -0400)
committerTom Rini <trini@konsulko.com>
Fri, 1 Apr 2022 20:56:53 +0000 (16:56 -0400)
This register holds "pstate" which includes (among other things) the
instruction mode the CPU was in when the exception was taken. This is
necessary to correctly interpret instructions at elr.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
arch/arm/cpu/armv8/exceptions.S
arch/arm/include/asm/proc-armv/ptrace.h

index 001913f..504d566 100644 (file)
@@ -77,15 +77,18 @@ _save_el_regs:
        switch_el x11, 3f, 2f, 1f
 3:     mrs     x1, esr_el3
        mrs     x2, elr_el3
+       mrs     x3, spsr_el3
        b       0f
 2:     mrs     x1, esr_el2
        mrs     x2, elr_el2
+       mrs     x3, spsr_el2
        b       0f
 1:     mrs     x1, esr_el1
        mrs     x2, elr_el1
+       mrs     x3, spsr_el1
 0:
        stp     x1, x0, [sp, #-16]!
-       stp     xzr, x2, [sp, #-16]!
+       stp     x3, x2, [sp, #-16]!
        mov     x0, sp
        ret
 
index bebcaf6..3b8fe7a 100644 (file)
@@ -21,7 +21,7 @@
  * on the stack during an exception.
  */
 struct pt_regs {
-       unsigned long unused;
+       unsigned long spsr;
        unsigned long elr;
        unsigned long esr;
        unsigned long regs[31];