Commit c03be0a3 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc: add definition for pt_regs offset within an interrupt frame

This is a common offset that currently uses the overloaded
STACK_FRAME_OVERHEAD constant. It's easier to read and more
flexible to use a specific regs offset for this.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221127124942.1665522-8-npiggin@gmail.com
parent 37195b82
...@@ -124,6 +124,7 @@ struct pt_regs ...@@ -124,6 +124,7 @@ struct pt_regs
#define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */ #define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */
#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \ #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \
STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)
#define STACK_INT_FRAME_REGS STACK_FRAME_OVERHEAD
#define STACK_FRAME_MARKER 12 #define STACK_FRAME_MARKER 12
#ifdef CONFIG_PPC64_ELF_ABI_V2 #ifdef CONFIG_PPC64_ELF_ABI_V2
...@@ -143,6 +144,7 @@ struct pt_regs ...@@ -143,6 +144,7 @@ struct pt_regs
#define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */ #define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */
#define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */ #define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */
#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD) #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD)
#define STACK_INT_FRAME_REGS STACK_FRAME_OVERHEAD
#define STACK_FRAME_MARKER 2 #define STACK_FRAME_MARKER 2
#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD #define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
#endif #endif
#define STACK_PT_REGS_OFFSET(sym, val) \ #define STACK_PT_REGS_OFFSET(sym, val) \
DEFINE(sym, STACK_FRAME_OVERHEAD + offsetof(struct pt_regs, val)) DEFINE(sym, STACK_INT_FRAME_REGS + offsetof(struct pt_regs, val))
int main(void) int main(void)
{ {
...@@ -167,9 +167,8 @@ int main(void) ...@@ -167,9 +167,8 @@ int main(void)
OFFSET(THREAD_CKVRSTATE, thread_struct, ckvr_state.vr); OFFSET(THREAD_CKVRSTATE, thread_struct, ckvr_state.vr);
OFFSET(THREAD_CKVRSAVE, thread_struct, ckvrsave); OFFSET(THREAD_CKVRSAVE, thread_struct, ckvrsave);
OFFSET(THREAD_CKFPSTATE, thread_struct, ckfp_state.fpr); OFFSET(THREAD_CKFPSTATE, thread_struct, ckfp_state.fpr);
/* Local pt_regs on stack for Transactional Memory funcs. */ /* Local pt_regs on stack in int frame form, plus 16 bytes for TM */
DEFINE(TM_FRAME_SIZE, STACK_FRAME_OVERHEAD + DEFINE(TM_FRAME_SIZE, STACK_INT_FRAME_SIZE + 16);
sizeof(struct pt_regs) + 16);
#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
OFFSET(TI_LOCAL_FLAGS, thread_info, local_flags); OFFSET(TI_LOCAL_FLAGS, thread_info, local_flags);
......
...@@ -123,12 +123,12 @@ transfer_to_syscall: ...@@ -123,12 +123,12 @@ transfer_to_syscall:
kuep_lock kuep_lock
/* Calling convention has r3 = regs, r4 = orig r0 */ /* Calling convention has r3 = regs, r4 = orig r0 */
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
mr r4,r0 mr r4,r0
bl system_call_exception bl system_call_exception
ret_from_syscall: ret_from_syscall:
addi r4,r1,STACK_FRAME_OVERHEAD addi r4,r1,STACK_INT_FRAME_REGS
li r5,0 li r5,0
bl syscall_exit_prepare bl syscall_exit_prepare
#ifdef CONFIG_PPC_47x #ifdef CONFIG_PPC_47x
...@@ -293,7 +293,7 @@ _ASM_NOKPROBE_SYMBOL(fast_exception_return) ...@@ -293,7 +293,7 @@ _ASM_NOKPROBE_SYMBOL(fast_exception_return)
.globl interrupt_return .globl interrupt_return
interrupt_return: interrupt_return:
lwz r4,_MSR(r1) lwz r4,_MSR(r1)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
andi. r0,r4,MSR_PR andi. r0,r4,MSR_PR
beq .Lkernel_interrupt_return beq .Lkernel_interrupt_return
bl interrupt_exit_user_prepare bl interrupt_exit_user_prepare
......
...@@ -455,7 +455,7 @@ exc_##n##_bad_stack: \ ...@@ -455,7 +455,7 @@ exc_##n##_bad_stack: \
EXCEPTION_COMMON(trapnum) \ EXCEPTION_COMMON(trapnum) \
ack(r8); \ ack(r8); \
CHECK_NAPPING(); \ CHECK_NAPPING(); \
addi r3,r1,STACK_FRAME_OVERHEAD; \ addi r3,r1,STACK_INT_FRAME_REGS; \
bl hdlr; \ bl hdlr; \
b interrupt_return b interrupt_return
...@@ -504,7 +504,7 @@ __end_interrupts: ...@@ -504,7 +504,7 @@ __end_interrupts:
EXCEPTION_COMMON_CRIT(0x100) EXCEPTION_COMMON_CRIT(0x100)
bl special_reg_save bl special_reg_save
CHECK_NAPPING(); CHECK_NAPPING();
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unknown_nmi_exception bl unknown_nmi_exception
b ret_from_crit_except b ret_from_crit_except
...@@ -515,7 +515,7 @@ __end_interrupts: ...@@ -515,7 +515,7 @@ __end_interrupts:
EXCEPTION_COMMON_MC(0x000) EXCEPTION_COMMON_MC(0x000)
bl special_reg_save bl special_reg_save
CHECK_NAPPING(); CHECK_NAPPING();
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl machine_check_exception bl machine_check_exception
b ret_from_mc_except b ret_from_mc_except
...@@ -570,7 +570,7 @@ __end_interrupts: ...@@ -570,7 +570,7 @@ __end_interrupts:
std r14,_ESR(r1) std r14,_ESR(r1)
ld r14,PACA_EXGEN+EX_R14(r13) ld r14,PACA_EXGEN+EX_R14(r13)
EXCEPTION_COMMON(0x700) EXCEPTION_COMMON(0x700)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl program_check_exception bl program_check_exception
REST_NVGPRS(r1) REST_NVGPRS(r1)
b interrupt_return b interrupt_return
...@@ -586,7 +586,7 @@ __end_interrupts: ...@@ -586,7 +586,7 @@ __end_interrupts:
beq- 1f beq- 1f
bl load_up_fpu bl load_up_fpu
b fast_interrupt_return b fast_interrupt_return
1: addi r3,r1,STACK_FRAME_OVERHEAD 1: addi r3,r1,STACK_INT_FRAME_REGS
bl kernel_fp_unavailable_exception bl kernel_fp_unavailable_exception
b interrupt_return b interrupt_return
...@@ -606,7 +606,7 @@ BEGIN_FTR_SECTION ...@@ -606,7 +606,7 @@ BEGIN_FTR_SECTION
1: 1:
END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
#endif #endif
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl altivec_unavailable_exception bl altivec_unavailable_exception
b interrupt_return b interrupt_return
...@@ -616,7 +616,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) ...@@ -616,7 +616,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
BOOKE_INTERRUPT_ALTIVEC_ASSIST, BOOKE_INTERRUPT_ALTIVEC_ASSIST,
PROLOG_ADDITION_NONE) PROLOG_ADDITION_NONE)
EXCEPTION_COMMON(0x220) EXCEPTION_COMMON(0x220)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
BEGIN_FTR_SECTION BEGIN_FTR_SECTION
bl altivec_assist_exception bl altivec_assist_exception
...@@ -643,7 +643,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) ...@@ -643,7 +643,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
EXCEPTION_COMMON_CRIT(0x9f0) EXCEPTION_COMMON_CRIT(0x9f0)
bl special_reg_save bl special_reg_save
CHECK_NAPPING(); CHECK_NAPPING();
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
#ifdef CONFIG_BOOKE_WDT #ifdef CONFIG_BOOKE_WDT
bl WatchdogException bl WatchdogException
#else #else
...@@ -664,7 +664,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) ...@@ -664,7 +664,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
NORMAL_EXCEPTION_PROLOG(0xf20, BOOKE_INTERRUPT_AP_UNAVAIL, NORMAL_EXCEPTION_PROLOG(0xf20, BOOKE_INTERRUPT_AP_UNAVAIL,
PROLOG_ADDITION_NONE) PROLOG_ADDITION_NONE)
EXCEPTION_COMMON(0xf20) EXCEPTION_COMMON(0xf20)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unknown_exception bl unknown_exception
b interrupt_return b interrupt_return
...@@ -731,7 +731,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) ...@@ -731,7 +731,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
ld r14,PACA_EXCRIT+EX_R14(r13) ld r14,PACA_EXCRIT+EX_R14(r13)
ld r15,PACA_EXCRIT+EX_R15(r13) ld r15,PACA_EXCRIT+EX_R15(r13)
EXCEPTION_COMMON_CRIT(0xd00) EXCEPTION_COMMON_CRIT(0xd00)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl DebugException bl DebugException
REST_NVGPRS(r1) REST_NVGPRS(r1)
b interrupt_return b interrupt_return
...@@ -802,7 +802,7 @@ kernel_dbg_exc: ...@@ -802,7 +802,7 @@ kernel_dbg_exc:
ld r14,PACA_EXDBG+EX_R14(r13) ld r14,PACA_EXDBG+EX_R14(r13)
ld r15,PACA_EXDBG+EX_R15(r13) ld r15,PACA_EXDBG+EX_R15(r13)
EXCEPTION_COMMON_DBG(0xd08) EXCEPTION_COMMON_DBG(0xd08)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl DebugException bl DebugException
REST_NVGPRS(r1) REST_NVGPRS(r1)
b interrupt_return b interrupt_return
...@@ -812,7 +812,7 @@ kernel_dbg_exc: ...@@ -812,7 +812,7 @@ kernel_dbg_exc:
PROLOG_ADDITION_NONE) PROLOG_ADDITION_NONE)
EXCEPTION_COMMON(0x260) EXCEPTION_COMMON(0x260)
CHECK_NAPPING() CHECK_NAPPING()
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
/* /*
* XXX: Returning from performance_monitor_exception taken as a * XXX: Returning from performance_monitor_exception taken as a
* soft-NMI (Linux irqs disabled) may be risky to use interrupt_return * soft-NMI (Linux irqs disabled) may be risky to use interrupt_return
...@@ -834,7 +834,7 @@ kernel_dbg_exc: ...@@ -834,7 +834,7 @@ kernel_dbg_exc:
EXCEPTION_COMMON_CRIT(0x2a0) EXCEPTION_COMMON_CRIT(0x2a0)
bl special_reg_save bl special_reg_save
CHECK_NAPPING(); CHECK_NAPPING();
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unknown_nmi_exception bl unknown_nmi_exception
b ret_from_crit_except b ret_from_crit_except
...@@ -846,7 +846,7 @@ kernel_dbg_exc: ...@@ -846,7 +846,7 @@ kernel_dbg_exc:
GDBELL_EXCEPTION_PROLOG(0x2c0, BOOKE_INTERRUPT_GUEST_DBELL, GDBELL_EXCEPTION_PROLOG(0x2c0, BOOKE_INTERRUPT_GUEST_DBELL,
PROLOG_ADDITION_NONE) PROLOG_ADDITION_NONE)
EXCEPTION_COMMON(0x2c0) EXCEPTION_COMMON(0x2c0)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unknown_exception bl unknown_exception
b interrupt_return b interrupt_return
...@@ -857,7 +857,7 @@ kernel_dbg_exc: ...@@ -857,7 +857,7 @@ kernel_dbg_exc:
EXCEPTION_COMMON_CRIT(0x2e0) EXCEPTION_COMMON_CRIT(0x2e0)
bl special_reg_save bl special_reg_save
CHECK_NAPPING(); CHECK_NAPPING();
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unknown_nmi_exception bl unknown_nmi_exception
b ret_from_crit_except b ret_from_crit_except
...@@ -866,7 +866,7 @@ kernel_dbg_exc: ...@@ -866,7 +866,7 @@ kernel_dbg_exc:
NORMAL_EXCEPTION_PROLOG(0x310, BOOKE_INTERRUPT_HV_SYSCALL, NORMAL_EXCEPTION_PROLOG(0x310, BOOKE_INTERRUPT_HV_SYSCALL,
PROLOG_ADDITION_NONE) PROLOG_ADDITION_NONE)
EXCEPTION_COMMON(0x310) EXCEPTION_COMMON(0x310)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unknown_exception bl unknown_exception
b interrupt_return b interrupt_return
...@@ -875,7 +875,7 @@ kernel_dbg_exc: ...@@ -875,7 +875,7 @@ kernel_dbg_exc:
NORMAL_EXCEPTION_PROLOG(0x320, BOOKE_INTERRUPT_HV_PRIV, NORMAL_EXCEPTION_PROLOG(0x320, BOOKE_INTERRUPT_HV_PRIV,
PROLOG_ADDITION_NONE) PROLOG_ADDITION_NONE)
EXCEPTION_COMMON(0x320) EXCEPTION_COMMON(0x320)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unknown_exception bl unknown_exception
b interrupt_return b interrupt_return
...@@ -884,7 +884,7 @@ kernel_dbg_exc: ...@@ -884,7 +884,7 @@ kernel_dbg_exc:
NORMAL_EXCEPTION_PROLOG(0x340, BOOKE_INTERRUPT_LRAT_ERROR, NORMAL_EXCEPTION_PROLOG(0x340, BOOKE_INTERRUPT_LRAT_ERROR,
PROLOG_ADDITION_NONE) PROLOG_ADDITION_NONE)
EXCEPTION_COMMON(0x340) EXCEPTION_COMMON(0x340)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unknown_exception bl unknown_exception
b interrupt_return b interrupt_return
...@@ -979,7 +979,7 @@ masked_interrupt_book3e_0x2c0: ...@@ -979,7 +979,7 @@ masked_interrupt_book3e_0x2c0:
* original values stashed away in the PACA * original values stashed away in the PACA
*/ */
storage_fault_common: storage_fault_common:
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl do_page_fault bl do_page_fault
b interrupt_return b interrupt_return
...@@ -988,7 +988,7 @@ storage_fault_common: ...@@ -988,7 +988,7 @@ storage_fault_common:
* continues here. * continues here.
*/ */
alignment_more: alignment_more:
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl alignment_exception bl alignment_exception
REST_NVGPRS(r1) REST_NVGPRS(r1)
b interrupt_return b interrupt_return
...@@ -1069,7 +1069,7 @@ bad_stack_book3e: ...@@ -1069,7 +1069,7 @@ bad_stack_book3e:
ZEROIZE_GPR(12) ZEROIZE_GPR(12)
std r12,0(r11) std r12,0(r11)
LOAD_PACA_TOC() LOAD_PACA_TOC()
1: addi r3,r1,STACK_FRAME_OVERHEAD 1: addi r3,r1,STACK_INT_FRAME_REGS
bl kernel_bad_stack bl kernel_bad_stack
b 1b b 1b
......
This diff is collapsed.
...@@ -127,7 +127,7 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt) ...@@ -127,7 +127,7 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
mfspr r10,SPRN_XER mfspr r10,SPRN_XER
addi r2, r2, -THREAD addi r2, r2, -THREAD
stw r10,_XER(r1) stw r10,_XER(r1)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
.endm .endm
.macro prepare_transfer_to_handler .macro prepare_transfer_to_handler
......
...@@ -972,10 +972,10 @@ _GLOBAL(__giveup_spe) ...@@ -972,10 +972,10 @@ _GLOBAL(__giveup_spe)
li r4,THREAD_ACC li r4,THREAD_ACC
evstddx evr6, r4, r3 /* save off accumulator */ evstddx evr6, r4, r3 /* save off accumulator */
beq 1f beq 1f
lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5) lwz r4,_MSR-STACK_INT_FRAME_REGS(r5)
lis r3,MSR_SPE@h lis r3,MSR_SPE@h
andc r4,r4,r3 /* disable SPE for previous task */ andc r4,r4,r3 /* disable SPE for previous task */
stw r4,_MSR-STACK_FRAME_OVERHEAD(r5) stw r4,_MSR-STACK_INT_FRAME_REGS(r5)
1: 1:
blr blr
#endif /* CONFIG_SPE */ #endif /* CONFIG_SPE */
......
...@@ -99,7 +99,7 @@ END_BTB_FLUSH_SECTION ...@@ -99,7 +99,7 @@ END_BTB_FLUSH_SECTION
mfspr r10,SPRN_XER mfspr r10,SPRN_XER
addi r2, r2, -THREAD addi r2, r2, -THREAD
stw r10,_XER(r1) stw r10,_XER(r1)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
.endm .endm
.macro prepare_transfer_to_handler .macro prepare_transfer_to_handler
......
...@@ -78,7 +78,7 @@ _ASM_NOKPROBE_SYMBOL(system_call_vectored_\name) ...@@ -78,7 +78,7 @@ _ASM_NOKPROBE_SYMBOL(system_call_vectored_\name)
std r12,_CCR(r1) std r12,_CCR(r1)
std r3,ORIG_GPR3(r1) std r3,ORIG_GPR3(r1)
/* Calling convention has r3 = regs, r4 = orig r0 */ /* Calling convention has r3 = regs, r4 = orig r0 */
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
mr r4,r0 mr r4,r0
LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER) LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER)
std r11,-16(r3) /* "regshere" marker */ std r11,-16(r3) /* "regshere" marker */
...@@ -99,7 +99,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) ...@@ -99,7 +99,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR)
bl system_call_exception bl system_call_exception
.Lsyscall_vectored_\name\()_exit: .Lsyscall_vectored_\name\()_exit:
addi r4,r1,STACK_FRAME_OVERHEAD addi r4,r1,STACK_INT_FRAME_REGS
li r5,1 /* scv */ li r5,1 /* scv */
bl syscall_exit_prepare bl syscall_exit_prepare
std r1,PACA_EXIT_SAVE_R1(r13) /* save r1 for restart */ std r1,PACA_EXIT_SAVE_R1(r13) /* save r1 for restart */
...@@ -176,7 +176,7 @@ _ASM_NOKPROBE_SYMBOL(syscall_vectored_\name\()_restart) ...@@ -176,7 +176,7 @@ _ASM_NOKPROBE_SYMBOL(syscall_vectored_\name\()_restart)
ld r1,PACA_EXIT_SAVE_R1(r13) ld r1,PACA_EXIT_SAVE_R1(r13)
LOAD_PACA_TOC() LOAD_PACA_TOC()
ld r3,RESULT(r1) ld r3,RESULT(r1)
addi r4,r1,STACK_FRAME_OVERHEAD addi r4,r1,STACK_INT_FRAME_REGS
li r11,IRQS_ALL_DISABLED li r11,IRQS_ALL_DISABLED
stb r11,PACAIRQSOFTMASK(r13) stb r11,PACAIRQSOFTMASK(r13)
bl syscall_exit_restart bl syscall_exit_restart
...@@ -251,7 +251,7 @@ END_BTB_FLUSH_SECTION ...@@ -251,7 +251,7 @@ END_BTB_FLUSH_SECTION
std r12,_CCR(r1) std r12,_CCR(r1)
std r3,ORIG_GPR3(r1) std r3,ORIG_GPR3(r1)
/* Calling convention has r3 = regs, r4 = orig r0 */ /* Calling convention has r3 = regs, r4 = orig r0 */
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
mr r4,r0 mr r4,r0
LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER) LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER)
std r11,-16(r3) /* "regshere" marker */ std r11,-16(r3) /* "regshere" marker */
...@@ -278,7 +278,7 @@ END_BTB_FLUSH_SECTION ...@@ -278,7 +278,7 @@ END_BTB_FLUSH_SECTION
bl system_call_exception bl system_call_exception
.Lsyscall_exit: .Lsyscall_exit:
addi r4,r1,STACK_FRAME_OVERHEAD addi r4,r1,STACK_INT_FRAME_REGS
li r5,0 /* !scv */ li r5,0 /* !scv */
bl syscall_exit_prepare bl syscall_exit_prepare
std r1,PACA_EXIT_SAVE_R1(r13) /* save r1 for restart */ std r1,PACA_EXIT_SAVE_R1(r13) /* save r1 for restart */
...@@ -357,7 +357,7 @@ _ASM_NOKPROBE_SYMBOL(syscall_restart) ...@@ -357,7 +357,7 @@ _ASM_NOKPROBE_SYMBOL(syscall_restart)
ld r1,PACA_EXIT_SAVE_R1(r13) ld r1,PACA_EXIT_SAVE_R1(r13)
LOAD_PACA_TOC() LOAD_PACA_TOC()
ld r3,RESULT(r1) ld r3,RESULT(r1)
addi r4,r1,STACK_FRAME_OVERHEAD addi r4,r1,STACK_INT_FRAME_REGS
li r11,IRQS_ALL_DISABLED li r11,IRQS_ALL_DISABLED
stb r11,PACAIRQSOFTMASK(r13) stb r11,PACAIRQSOFTMASK(r13)
bl syscall_exit_restart bl syscall_exit_restart
...@@ -388,7 +388,7 @@ _ASM_NOKPROBE_SYMBOL(fast_interrupt_return_srr) ...@@ -388,7 +388,7 @@ _ASM_NOKPROBE_SYMBOL(fast_interrupt_return_srr)
andi. r0,r5,MSR_RI andi. r0,r5,MSR_RI
li r3,0 /* 0 return value, no EMULATE_STACK_STORE */ li r3,0 /* 0 return value, no EMULATE_STACK_STORE */
bne+ .Lfast_kernel_interrupt_return_srr bne+ .Lfast_kernel_interrupt_return_srr
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl unrecoverable_exception bl unrecoverable_exception
b . /* should not get here */ b . /* should not get here */
#else #else
...@@ -406,7 +406,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()) ...@@ -406,7 +406,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\())
beq interrupt_return_\srr\()_kernel beq interrupt_return_\srr\()_kernel
interrupt_return_\srr\()_user: /* make backtraces match the _kernel variant */ interrupt_return_\srr\()_user: /* make backtraces match the _kernel variant */
_ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_user) _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_user)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl interrupt_exit_user_prepare bl interrupt_exit_user_prepare
cmpdi r3,0 cmpdi r3,0
bne- .Lrestore_nvgprs_\srr bne- .Lrestore_nvgprs_\srr
...@@ -503,7 +503,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_user_restart) ...@@ -503,7 +503,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_user_restart)
GET_PACA(r13) GET_PACA(r13)
ld r1,PACA_EXIT_SAVE_R1(r13) ld r1,PACA_EXIT_SAVE_R1(r13)
LOAD_PACA_TOC() LOAD_PACA_TOC()
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
li r11,IRQS_ALL_DISABLED li r11,IRQS_ALL_DISABLED
stb r11,PACAIRQSOFTMASK(r13) stb r11,PACAIRQSOFTMASK(r13)
bl interrupt_exit_user_restart bl interrupt_exit_user_restart
...@@ -518,7 +518,7 @@ RESTART_TABLE(.Linterrupt_return_\srr\()_user_rst_start, .Linterrupt_return_\srr ...@@ -518,7 +518,7 @@ RESTART_TABLE(.Linterrupt_return_\srr\()_user_rst_start, .Linterrupt_return_\srr
.balign IFETCH_ALIGN_BYTES .balign IFETCH_ALIGN_BYTES
interrupt_return_\srr\()_kernel: interrupt_return_\srr\()_kernel:
_ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel) _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel)
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
bl interrupt_exit_kernel_prepare bl interrupt_exit_kernel_prepare
std r1,PACA_EXIT_SAVE_R1(r13) /* save r1 for restart */ std r1,PACA_EXIT_SAVE_R1(r13) /* save r1 for restart */
...@@ -684,7 +684,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel_restart) ...@@ -684,7 +684,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel_restart)
GET_PACA(r13) GET_PACA(r13)
ld r1,PACA_EXIT_SAVE_R1(r13) ld r1,PACA_EXIT_SAVE_R1(r13)
LOAD_PACA_TOC() LOAD_PACA_TOC()
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
li r11,IRQS_ALL_DISABLED li r11,IRQS_ALL_DISABLED
stb r11,PACAIRQSOFTMASK(r13) stb r11,PACAIRQSOFTMASK(r13)
bl interrupt_exit_kernel_restart bl interrupt_exit_kernel_restart
......
...@@ -191,7 +191,7 @@ static int kgdb_break_match(struct pt_regs *regs) ...@@ -191,7 +191,7 @@ static int kgdb_break_match(struct pt_regs *regs)
void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
{ {
struct pt_regs *regs = (struct pt_regs *)(p->thread.ksp + struct pt_regs *regs = (struct pt_regs *)(p->thread.ksp +
STACK_FRAME_OVERHEAD); STACK_INT_FRAME_REGS);
unsigned long *ptr = gdb_regs; unsigned long *ptr = gdb_regs;
int reg; int reg;
......
...@@ -85,7 +85,7 @@ optprobe_template_op_address: ...@@ -85,7 +85,7 @@ optprobe_template_op_address:
TEMPLATE_FOR_IMM_LOAD_INSNS TEMPLATE_FOR_IMM_LOAD_INSNS
/* 2. pt_regs pointer in r4 */ /* 2. pt_regs pointer in r4 */
addi r4,r1,STACK_FRAME_OVERHEAD addi r4,r1,STACK_INT_FRAME_REGS
.global optprobe_template_call_handler .global optprobe_template_call_handler
optprobe_template_call_handler: optprobe_template_call_handler:
...@@ -96,7 +96,7 @@ optprobe_template_call_handler: ...@@ -96,7 +96,7 @@ optprobe_template_call_handler:
* Parameters for instruction emulation: * Parameters for instruction emulation:
* 1. Pass SP in register r3. * 1. Pass SP in register r3.
*/ */
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_INT_FRAME_REGS
.global optprobe_template_insn .global optprobe_template_insn
optprobe_template_insn: optprobe_template_insn:
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
_GLOBAL(ppc_save_regs) _GLOBAL(ppc_save_regs)
/* This allows stack frame accessor macros and offsets to be used */ /* This allows stack frame accessor macros and offsets to be used */
subi r3,r3,STACK_FRAME_OVERHEAD subi r3,r3,STACK_INT_FRAME_REGS
PPC_STL r0,GPR0(r3) PPC_STL r0,GPR0(r3)
#ifdef CONFIG_PPC32 #ifdef CONFIG_PPC32
stmw r2,GPR2(r3) stmw r2,GPR2(r3)
......
...@@ -2260,12 +2260,12 @@ void __no_sanitize_address show_stack(struct task_struct *tsk, ...@@ -2260,12 +2260,12 @@ void __no_sanitize_address show_stack(struct task_struct *tsk,
/* /*
* See if this is an exception frame. * See if this is an exception frame.
* We look for the "regshere" marker in the current frame. * We look for the "regs" marker in the current frame.
*/ */
if (validate_sp(sp, tsk, STACK_FRAME_WITH_PT_REGS) if (validate_sp(sp, tsk, STACK_FRAME_WITH_PT_REGS)
&& stack[STACK_FRAME_MARKER] == STACK_FRAME_REGS_MARKER) { && stack[STACK_FRAME_MARKER] == STACK_FRAME_REGS_MARKER) {
struct pt_regs *regs = (struct pt_regs *) struct pt_regs *regs = (struct pt_regs *)
(sp + STACK_FRAME_OVERHEAD); (sp + STACK_INT_FRAME_REGS);
lr = regs->link; lr = regs->link;
printk("%s--- interrupt: %lx at %pS\n", printk("%s--- interrupt: %lx at %pS\n",
......
...@@ -117,7 +117,7 @@ _GLOBAL(tm_reclaim) ...@@ -117,7 +117,7 @@ _GLOBAL(tm_reclaim)
std r2, STK_GOT(r1) std r2, STK_GOT(r1)
stdu r1, -TM_FRAME_SIZE(r1) stdu r1, -TM_FRAME_SIZE(r1)
/* We've a struct pt_regs at [r1+STACK_FRAME_OVERHEAD]. */ /* We've a struct pt_regs at [r1+STACK_INT_FRAME_REGS]. */
std r3, STK_PARAM(R3)(r1) std r3, STK_PARAM(R3)(r1)
SAVE_NVGPRS(r1) SAVE_NVGPRS(r1)
...@@ -222,7 +222,7 @@ _GLOBAL(tm_reclaim) ...@@ -222,7 +222,7 @@ _GLOBAL(tm_reclaim)
* Make r7 look like an exception frame so that we can use the neat * Make r7 look like an exception frame so that we can use the neat
* GPRx(n) macros. r7 is NOT a pt_regs ptr! * GPRx(n) macros. r7 is NOT a pt_regs ptr!
*/ */
subi r7, r7, STACK_FRAME_OVERHEAD subi r7, r7, STACK_INT_FRAME_REGS
/* Sync the userland GPRs 2-12, 14-31 to thread->regs: */ /* Sync the userland GPRs 2-12, 14-31 to thread->regs: */
SAVE_GPR(0, r7) /* user r0 */ SAVE_GPR(0, r7) /* user r0 */
...@@ -359,7 +359,7 @@ _GLOBAL(__tm_recheckpoint) ...@@ -359,7 +359,7 @@ _GLOBAL(__tm_recheckpoint)
stdu r1, -TM_FRAME_SIZE(r1) stdu r1, -TM_FRAME_SIZE(r1)
/* /*
* We've a struct pt_regs at [r1+STACK_FRAME_OVERHEAD]. * We've a struct pt_regs at [r1+STACK_INT_FRAME_REGS].
* This is used for backing up the NVGPRs: * This is used for backing up the NVGPRs:
*/ */
SAVE_NVGPRS(r1) SAVE_NVGPRS(r1)
...@@ -379,7 +379,7 @@ _GLOBAL(__tm_recheckpoint) ...@@ -379,7 +379,7 @@ _GLOBAL(__tm_recheckpoint)
* Make r7 look like an exception frame so that we can use the neat * Make r7 look like an exception frame so that we can use the neat
* GPRx(n) macros. r7 is now NOT a pt_regs ptr! * GPRx(n) macros. r7 is now NOT a pt_regs ptr!
*/ */
subi r7, r7, STACK_FRAME_OVERHEAD subi r7, r7, STACK_INT_FRAME_REGS
/* We need to setup MSR for FP/VMX/VSX register save instructions. */ /* We need to setup MSR for FP/VMX/VSX register save instructions. */
mfmsr r6 mfmsr r6
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
.endif .endif
/* Load &pt_regs in r6 for call below */ /* Load &pt_regs in r6 for call below */
addi r6, r1, STACK_FRAME_OVERHEAD addi r6, r1, STACK_INT_FRAME_REGS
.endm .endm
.macro ftrace_regs_exit allregs .macro ftrace_regs_exit allregs
......
...@@ -16,7 +16,7 @@ _GLOBAL(exec_instr) ...@@ -16,7 +16,7 @@ _GLOBAL(exec_instr)
/* /*
* Stack frame layout (INT_FRAME_SIZE bytes) * Stack frame layout (INT_FRAME_SIZE bytes)
* In-memory pt_regs (SP + STACK_FRAME_OVERHEAD) * In-memory pt_regs (SP + STACK_INT_FRAME_REGS)
* Scratch space (SP + 8) * Scratch space (SP + 8)
* Back chain (SP + 0) * Back chain (SP + 0)
*/ */
......
...@@ -67,7 +67,7 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re ...@@ -67,7 +67,7 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re
* This looks like an interrupt frame for an * This looks like an interrupt frame for an
* interrupt that occurred in the kernel * interrupt that occurred in the kernel
*/ */
regs = (struct pt_regs *)(sp + STACK_FRAME_OVERHEAD); regs = (struct pt_regs *)(sp + STACK_INT_FRAME_REGS);
next_ip = regs->nip; next_ip = regs->nip;
lr = regs->link; lr = regs->link;
level = 0; level = 0;
......
...@@ -1782,14 +1782,13 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr, ...@@ -1782,14 +1782,13 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr,
xmon_print_symbol(ip, " ", "\n"); xmon_print_symbol(ip, " ", "\n");
} }
/* Look for "regshere" marker to see if this is /* Look for "regs" marker to see if this is
an exception frame. */ an exception frame. */
if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long)) if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long))
&& marker == STACK_FRAME_REGS_MARKER) { && marker == STACK_FRAME_REGS_MARKER) {
if (mread(sp + STACK_FRAME_OVERHEAD, &regs, sizeof(regs)) if (mread(sp + STACK_INT_FRAME_REGS, &regs, sizeof(regs)) != sizeof(regs)) {
!= sizeof(regs)) {
printf("Couldn't read registers at %lx\n", printf("Couldn't read registers at %lx\n",
sp + STACK_FRAME_OVERHEAD); sp + STACK_INT_FRAME_REGS);
break; break;
} }
printf("--- Exception: %lx %s at ", regs.trap, printf("--- Exception: %lx %s at ", regs.trap,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment