diff options
author | 2021-03-12 12:50:43 +0000 | |
---|---|---|
committer | 2021-03-29 13:22:10 +1100 | |
commit | a305597850c96e2f2d349533cf3b514fa4b7b9f8 (patch) | |
tree | bf7a230c5e9b29c54a5f1fbc8935b63a1d0628c4 /arch/powerpc/kernel/head_booke.h | |
parent | powerpc/32: Remove the xfer parameter in EXCEPTION() macro (diff) | |
download | linux-a305597850c96e2f2d349533cf3b514fa4b7b9f8.tar.gz linux-a305597850c96e2f2d349533cf3b514fa4b7b9f8.tar.bz2 linux-a305597850c96e2f2d349533cf3b514fa4b7b9f8.zip |
powerpc/32: Refactor saving of volatile registers in exception prologs
Exception prologs all do the same at the end:
- Save trapno in stack
- Mark stack with exception marker
- Save r0
- Save r3 to r8
Refactor that into a COMMON_EXCEPTION_PROLOG_END macro.
At the same time use r1 instead of r11.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/e1c45d2e895e0693c42d2a6840df1105a148efea.1615552867.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/kernel/head_booke.h')
-rw-r--r-- | arch/powerpc/kernel/head_booke.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h index fa566e89f18b..4d583fbef0b6 100644 --- a/arch/powerpc/kernel/head_booke.h +++ b/arch/powerpc/kernel/head_booke.h @@ -78,14 +78,18 @@ END_BTB_FLUSH_SECTION stw r1, 0(r11); \ mr r1, r11; \ rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\ - stw r0,GPR0(r11); \ - lis r10, STACK_FRAME_REGS_MARKER@ha;/* exception frame marker */ \ - addi r10, r10, STACK_FRAME_REGS_MARKER@l; \ - stw r10, 8(r11); \ - li r10, trapno; \ - stw r10,_TRAP(r11); \ - SAVE_4GPRS(3, r11); \ - SAVE_2GPRS(7, r11) + COMMON_EXCEPTION_PROLOG_END trapno + +.macro COMMON_EXCEPTION_PROLOG_END trapno + stw r0,GPR0(r1) + lis r10, STACK_FRAME_REGS_MARKER@ha /* exception frame marker */ + addi r10, r10, STACK_FRAME_REGS_MARKER@l + stw r10, 8(r1) + li r10, \trapno + stw r10,_TRAP(r1) + SAVE_4GPRS(3, r1) + SAVE_2GPRS(7, r1) +.endm .macro prepare_transfer_to_handler bl prepare_transfer_to_handler @@ -231,11 +235,7 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) stw r1,0(r11); \ mr r1,r11; \ rlwinm r9,r9,0,14,12; /* clear MSR_WE (necessary?) */\ - li r10, trapno; \ - stw r10,_TRAP(r11); \ - stw r0,GPR0(r11); \ - SAVE_4GPRS(3, r11); \ - SAVE_2GPRS(7, r11) + COMMON_EXCEPTION_PROLOG_END trapno #define SAVE_xSRR(xSRR) \ mfspr r0,SPRN_##xSRR##0; \ |