mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
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
This commit is contained in:
parent
acc142b623
commit
a305597850
3 changed files with 24 additions and 27 deletions
|
@ -104,15 +104,19 @@
|
|||
li r10, MSR_KERNEL /* can take exceptions */
|
||||
mtmsr r10 /* (except for mach check in rtas) */
|
||||
#endif
|
||||
stw r0,GPR0(r11)
|
||||
COMMON_EXCEPTION_PROLOG_END \trapno
|
||||
_ASM_NOKPROBE_SYMBOL(\name\()_virt)
|
||||
.endm
|
||||
|
||||
.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(r11)
|
||||
stw r10,8(r1)
|
||||
li r10, \trapno
|
||||
stw r10,_TRAP(r11)
|
||||
SAVE_4GPRS(3, r11)
|
||||
SAVE_2GPRS(7, r11)
|
||||
_ASM_NOKPROBE_SYMBOL(\name\()_virt)
|
||||
stw r10,_TRAP(r1)
|
||||
SAVE_4GPRS(3, r1)
|
||||
SAVE_2GPRS(7, r1)
|
||||
.endm
|
||||
|
||||
.macro prepare_transfer_to_handler
|
||||
|
|
|
@ -157,14 +157,7 @@ _ENTRY(crit_esr)
|
|||
mfspr r12,SPRN_SRR2
|
||||
mfspr r9,SPRN_SRR3
|
||||
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 + 2
|
||||
stw r10,_TRAP(r11)
|
||||
SAVE_4GPRS(3, r11)
|
||||
SAVE_2GPRS(7, r11)
|
||||
COMMON_EXCEPTION_PROLOG_END \trapno + 2
|
||||
_ASM_NOKPROBE_SYMBOL(\name\()_virt)
|
||||
.endm
|
||||
|
||||
|
|
|
@ -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; \
|
||||
|
|
Loading…
Reference in a new issue