mirror of https://gitee.com/openkylin/linux.git
powerpc/32: Set regs parameter in r3 in transfer_to_handler
All exception handlers take regs as first parameter. Instead of setting r3 just before each call to a handler, set it in transfer_to_handler. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/f994a379bb895a2cbd518cb82460ad3f3d3ccdf5.1615552867.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
db297c3b07
commit
e72915560b
|
@ -87,6 +87,7 @@ _ASM_NOKPROBE_SYMBOL(transfer_to_handler_full)
|
|||
.globl transfer_to_handler
|
||||
transfer_to_handler:
|
||||
SAVE_NVGPRS(r11)
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
stw r2,GPR2(r11)
|
||||
stw r12,_NIP(r11)
|
||||
stw r9,_MSR(r11)
|
||||
|
@ -227,7 +228,6 @@ ret_from_kernel_thread:
|
|||
*/
|
||||
.globl handle_page_fault
|
||||
handle_page_fault:
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
bl do_page_fault
|
||||
cmpwi r3,0
|
||||
beq+ ret_from_except
|
||||
|
@ -365,7 +365,6 @@ _ASM_NOKPROBE_SYMBOL(fast_exception_return)
|
|||
3:
|
||||
li r10,-1
|
||||
stw r10,_TRAP(r11)
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
bl transfer_to_handler_full
|
||||
bl unrecoverable_exception
|
||||
trap /* should not get here */
|
||||
|
|
|
@ -183,7 +183,6 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
|
|||
#define EXCEPTION(n, label, hdlr, xfer) \
|
||||
START_EXCEPTION(n, label) \
|
||||
EXCEPTION_PROLOG label; \
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
xfer(n, hdlr)
|
||||
|
||||
#define EXC_XFER_TEMPLATE(hdlr, trap, msr, tfer, ret) \
|
||||
|
@ -215,7 +214,6 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
|
|||
lwz r1, emergency_ctx@l(r1)
|
||||
addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE
|
||||
EXCEPTION_PROLOG_2 vmap_stack_overflow
|
||||
addi r3, r1, STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_STD(0, stack_overflow_exception)
|
||||
.endm
|
||||
|
||||
|
|
|
@ -185,7 +185,6 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
|
|||
#define CRITICAL_EXCEPTION(n, label, hdlr) \
|
||||
START_EXCEPTION(n, label); \
|
||||
CRITICAL_EXCEPTION_PROLOG label; \
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
|
||||
crit_transfer_to_handler, ret_from_crit_exc)
|
||||
|
||||
|
@ -227,13 +226,11 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
|
|||
/* 0x0600 - Alignment Exception */
|
||||
START_EXCEPTION(0x0600, Alignment)
|
||||
EXCEPTION_PROLOG Alignment handle_dar_dsisr=1
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_STD(0x600, alignment_exception)
|
||||
|
||||
/* 0x0700 - Program Exception */
|
||||
START_EXCEPTION(0x0700, ProgramCheck)
|
||||
EXCEPTION_PROLOG ProgramCheck handle_dar_dsisr=1
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_STD(0x700, program_check_exception)
|
||||
|
||||
EXCEPTION(0x0800, Trap_08, unknown_exception, EXC_XFER_STD)
|
||||
|
@ -494,7 +491,6 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
|
|||
/* continue normal handling for a critical exception... */
|
||||
2: mfspr r4,SPRN_DBSR
|
||||
stw r4,_ESR(r11) /* DebugException takes DBSR in _ESR */
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_TEMPLATE(DebugException, 0x2002, \
|
||||
(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
|
||||
crit_transfer_to_handler, ret_from_crit_exc)
|
||||
|
@ -505,21 +501,18 @@ Decrementer:
|
|||
EXCEPTION_PROLOG Decrementer
|
||||
lis r0,TSR_PIS@h
|
||||
mtspr SPRN_TSR,r0 /* Clear the PIT exception */
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_LITE(0x1000, timer_interrupt)
|
||||
|
||||
/* Fixed Interval Timer (FIT) Exception. (from 0x1010) */
|
||||
__HEAD
|
||||
FITException:
|
||||
EXCEPTION_PROLOG FITException
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD;
|
||||
EXC_XFER_STD(0x1010, unknown_exception)
|
||||
|
||||
/* Watchdog Timer (WDT) Exception. (from 0x1020) */
|
||||
__HEAD
|
||||
WDTException:
|
||||
CRITICAL_EXCEPTION_PROLOG WDTException
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD;
|
||||
EXC_XFER_TEMPLATE(WatchdogException, 0x1020+2,
|
||||
(MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)),
|
||||
crit_transfer_to_handler, ret_from_crit_exc)
|
||||
|
|
|
@ -123,7 +123,6 @@ instruction_counter:
|
|||
/* Machine check */
|
||||
START_EXCEPTION(0x200, MachineCheck)
|
||||
EXCEPTION_PROLOG MachineCheck handle_dar_dsisr=1
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_STD(0x200, machine_check_exception)
|
||||
|
||||
/* External interrupt */
|
||||
|
@ -132,7 +131,6 @@ instruction_counter:
|
|||
/* Alignment exception */
|
||||
START_EXCEPTION(0x600, Alignment)
|
||||
EXCEPTION_PROLOG Alignment handle_dar_dsisr=1
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_STD(0x600, alignment_exception)
|
||||
|
||||
/* Program check exception */
|
||||
|
@ -348,7 +346,6 @@ DARFixed:/* Return from dcbx instruction bug workaround */
|
|||
|
||||
1: EXCEPTION_PROLOG_1
|
||||
EXCEPTION_PROLOG_2 DataBreakpoint handle_dar_dsisr=1
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
mfspr r4,SPRN_BAR
|
||||
stw r4,_DAR(r11)
|
||||
EXC_XFER_STD(0x1c00, do_break)
|
||||
|
|
|
@ -267,7 +267,6 @@ __secondary_hold_acknowledge:
|
|||
#endif /* CONFIG_PPC_CHRP */
|
||||
EXCEPTION_PROLOG_1
|
||||
7: EXCEPTION_PROLOG_2 MachineCheck
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
#ifdef CONFIG_PPC_CHRP
|
||||
beq cr1, 1f
|
||||
twi 31, 0, 0
|
||||
|
@ -337,7 +336,6 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE)
|
|||
/* Alignment exception */
|
||||
START_EXCEPTION(0x600, Alignment)
|
||||
EXCEPTION_PROLOG Alignment handle_dar_dsisr=1
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_STD(0x600, alignment_exception)
|
||||
|
||||
/* Program check exception */
|
||||
|
@ -357,8 +355,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_FPU_UNAVAILABLE)
|
|||
beq 1f
|
||||
bl load_up_fpu /* if from user, just load it up */
|
||||
b fast_exception_return
|
||||
1: addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_LITE(0x800, kernel_fp_unavailable_exception)
|
||||
1: EXC_XFER_LITE(0x800, kernel_fp_unavailable_exception)
|
||||
#else
|
||||
b ProgramCheck
|
||||
#endif
|
||||
|
@ -722,13 +719,11 @@ AltiVecUnavailable:
|
|||
bl load_up_altivec /* if from user, just load it up */
|
||||
b fast_exception_return
|
||||
#endif /* CONFIG_ALTIVEC */
|
||||
1: addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_LITE(0xf20, altivec_unavailable_exception)
|
||||
1: EXC_XFER_LITE(0xf20, altivec_unavailable_exception)
|
||||
|
||||
__HEAD
|
||||
PerformanceMonitor:
|
||||
EXCEPTION_PROLOG PerformanceMonitor
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_STD(0xf00, performance_monitor_exception)
|
||||
|
||||
|
||||
|
|
|
@ -294,13 +294,11 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
|
|||
#define EXCEPTION(n, intno, label, hdlr, xfer) \
|
||||
START_EXCEPTION(label); \
|
||||
NORMAL_EXCEPTION_PROLOG(intno); \
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
xfer(n, hdlr)
|
||||
|
||||
#define CRITICAL_EXCEPTION(n, intno, label, hdlr) \
|
||||
START_EXCEPTION(label); \
|
||||
CRITICAL_EXCEPTION_PROLOG(intno); \
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
SAVE_MMU_REGS; \
|
||||
SAVE_xSRR(SRR); \
|
||||
EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
|
||||
|
@ -311,7 +309,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
|
|||
MCHECK_EXCEPTION_PROLOG; \
|
||||
mfspr r5,SPRN_ESR; \
|
||||
stw r5,_ESR(r11); \
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
SAVE_xSRR(DSRR); \
|
||||
SAVE_xSRR(CSRR); \
|
||||
SAVE_MMU_REGS; \
|
||||
|
@ -398,7 +395,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
|
|||
/* continue normal handling for a debug exception... */ \
|
||||
2: mfspr r4,SPRN_DBSR; \
|
||||
stw r4,_ESR(r11); /* DebugException takes DBSR in _ESR */\
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
SAVE_xSRR(CSRR); \
|
||||
SAVE_MMU_REGS; \
|
||||
SAVE_xSRR(SRR); \
|
||||
|
@ -455,7 +451,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
|
|||
/* continue normal handling for a critical exception... */ \
|
||||
2: mfspr r4,SPRN_DBSR; \
|
||||
stw r4,_ESR(r11); /* DebugException takes DBSR in _ESR */\
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
SAVE_MMU_REGS; \
|
||||
SAVE_xSRR(SRR); \
|
||||
EXC_XFER_TEMPLATE(DebugException, 0x2002, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), crit_transfer_to_handler, ret_from_crit_exc)
|
||||
|
@ -482,7 +477,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
|
|||
NORMAL_EXCEPTION_PROLOG(ALIGNMENT); \
|
||||
mfspr r4,SPRN_DEAR; /* Grab the DEAR and save it */ \
|
||||
stw r4,_DEAR(r11); \
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
EXC_XFER_STD(0x0600, alignment_exception)
|
||||
|
||||
#define PROGRAM_EXCEPTION \
|
||||
|
@ -490,7 +484,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
|
|||
NORMAL_EXCEPTION_PROLOG(PROGRAM); \
|
||||
mfspr r4,SPRN_ESR; /* Grab the ESR and save it */ \
|
||||
stw r4,_ESR(r11); \
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
EXC_XFER_STD(0x0700, program_check_exception)
|
||||
|
||||
#define DECREMENTER_EXCEPTION \
|
||||
|
@ -498,7 +491,6 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
|
|||
NORMAL_EXCEPTION_PROLOG(DECREMENTER); \
|
||||
lis r0,TSR_DIS@h; /* Setup the DEC interrupt mask */ \
|
||||
mtspr SPRN_TSR,r0; /* Clear the DEC interrupt */ \
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
EXC_XFER_LITE(0x0900, timer_interrupt)
|
||||
|
||||
#define FP_UNAVAILABLE_EXCEPTION \
|
||||
|
@ -507,8 +499,7 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
|
|||
beq 1f; \
|
||||
bl load_up_fpu; /* if from user, just load it up */ \
|
||||
b fast_exception_return; \
|
||||
1: addi r3,r1,STACK_FRAME_OVERHEAD; \
|
||||
EXC_XFER_STD(0x800, kernel_fp_unavailable_exception)
|
||||
1: EXC_XFER_STD(0x800, kernel_fp_unavailable_exception)
|
||||
|
||||
#else /* __ASSEMBLY__ */
|
||||
struct exception_regs {
|
||||
|
|
|
@ -372,7 +372,6 @@ interrupt_base:
|
|||
bne 1f
|
||||
EXC_XFER_LITE(0x0300, handle_page_fault)
|
||||
1:
|
||||
addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_LITE(0x0300, CacheLockingException)
|
||||
|
||||
/* Instruction Storage Interrupt */
|
||||
|
@ -618,8 +617,7 @@ END_BTB_FLUSH_SECTION
|
|||
beq 1f
|
||||
bl load_up_spe
|
||||
b fast_exception_return
|
||||
1: addi r3,r1,STACK_FRAME_OVERHEAD
|
||||
EXC_XFER_LITE(0x2010, KernelSPE)
|
||||
1: EXC_XFER_LITE(0x2010, KernelSPE)
|
||||
#elif defined(CONFIG_SPE_POSSIBLE)
|
||||
EXCEPTION(0x2020, SPE_UNAVAIL, SPEUnavailable, \
|
||||
unknown_exception, EXC_XFER_STD)
|
||||
|
|
Loading…
Reference in New Issue