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

powerpc: add a definition for the marker offset within the interrupt frame

Define a constant rather than open-code the offset for the
"regs" marker.
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-9-npiggin@gmail.com
parent c03be0a3
...@@ -125,6 +125,7 @@ struct pt_regs ...@@ -125,6 +125,7 @@ struct pt_regs
#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_INT_FRAME_REGS STACK_FRAME_OVERHEAD
#define STACK_INT_FRAME_MARKER (STACK_FRAME_OVERHEAD - 16)
#define STACK_FRAME_MARKER 12 #define STACK_FRAME_MARKER 12
#ifdef CONFIG_PPC64_ELF_ABI_V2 #ifdef CONFIG_PPC64_ELF_ABI_V2
...@@ -145,6 +146,7 @@ struct pt_regs ...@@ -145,6 +146,7 @@ struct pt_regs
#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_INT_FRAME_REGS STACK_FRAME_OVERHEAD
#define STACK_INT_FRAME_MARKER (STACK_FRAME_OVERHEAD - 8)
#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
......
...@@ -114,7 +114,7 @@ transfer_to_syscall: ...@@ -114,7 +114,7 @@ transfer_to_syscall:
addi r12,r12,STACK_FRAME_REGS_MARKER@l addi r12,r12,STACK_FRAME_REGS_MARKER@l
stw r9,_MSR(r1) stw r9,_MSR(r1)
li r2, INTERRUPT_SYSCALL li r2, INTERRUPT_SYSCALL
stw r12,8(r1) stw r12,STACK_INT_FRAME_MARKER(r1)
stw r2,_TRAP(r1) stw r2,_TRAP(r1)
SAVE_GPR(0, r1) SAVE_GPR(0, r1)
SAVE_GPRS(3, 8, r1) SAVE_GPRS(3, 8, r1)
......
...@@ -391,7 +391,7 @@ exc_##n##_common: \ ...@@ -391,7 +391,7 @@ exc_##n##_common: \
std r10,_CCR(r1); /* store orig CR in stackframe */ \ std r10,_CCR(r1); /* store orig CR in stackframe */ \
std r9,GPR1(r1); /* store stack frame back link */ \ std r9,GPR1(r1); /* store stack frame back link */ \
std r11,SOFTE(r1); /* and save it to stackframe */ \ std r11,SOFTE(r1); /* and save it to stackframe */ \
std r12,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */ \ std r12,STACK_INT_FRAME_MARKER(r1); /* mark the frame */ \
std r3,_TRAP(r1); /* set trap number */ \ std r3,_TRAP(r1); /* set trap number */ \
std r0,RESULT(r1); /* clear regs->result */ \ std r0,RESULT(r1); /* clear regs->result */ \
SAVE_NVGPRS(r1); SAVE_NVGPRS(r1);
......
...@@ -591,7 +591,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR) ...@@ -591,7 +591,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
li r10,0 li r10,0
LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER) LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER)
std r10,RESULT(r1) /* clear regs->result */ std r10,RESULT(r1) /* clear regs->result */
std r11,STACK_FRAME_OVERHEAD-16(r1) /* mark the frame */ std r11,STACK_INT_FRAME_MARKER(r1) /* mark the frame */
.endm .endm
/* /*
......
...@@ -112,7 +112,7 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt) ...@@ -112,7 +112,7 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
stw r0,GPR0(r1) stw r0,GPR0(r1)
lis r10,STACK_FRAME_REGS_MARKER@ha /* exception frame marker */ lis r10,STACK_FRAME_REGS_MARKER@ha /* exception frame marker */
addi r10,r10,STACK_FRAME_REGS_MARKER@l addi r10,r10,STACK_FRAME_REGS_MARKER@l
stw r10,8(r1) stw r10,STACK_INT_FRAME_MARKER(r1)
li r10, \trapno li r10, \trapno
stw r10,_TRAP(r1) stw r10,_TRAP(r1)
SAVE_GPRS(3, 8, r1) SAVE_GPRS(3, 8, r1)
......
...@@ -84,7 +84,7 @@ END_BTB_FLUSH_SECTION ...@@ -84,7 +84,7 @@ END_BTB_FLUSH_SECTION
stw r0,GPR0(r1) stw r0,GPR0(r1)
lis r10, STACK_FRAME_REGS_MARKER@ha /* exception frame marker */ lis r10, STACK_FRAME_REGS_MARKER@ha /* exception frame marker */
addi r10, r10, STACK_FRAME_REGS_MARKER@l addi r10, r10, STACK_FRAME_REGS_MARKER@l
stw r10, 8(r1) stw r10, STACK_INT_FRAME_MARKER(r1)
li r10, \trapno li r10, \trapno
stw r10,_TRAP(r1) stw r10,_TRAP(r1)
SAVE_GPRS(3, 8, r1) SAVE_GPRS(3, 8, r1)
......
...@@ -77,11 +77,11 @@ _ASM_NOKPROBE_SYMBOL(system_call_vectored_\name) ...@@ -77,11 +77,11 @@ _ASM_NOKPROBE_SYMBOL(system_call_vectored_\name)
std r11,_TRAP(r1) std r11,_TRAP(r1)
std r12,_CCR(r1) std r12,_CCR(r1)
std r3,ORIG_GPR3(r1) std r3,ORIG_GPR3(r1)
LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER)
std r11,STACK_INT_FRAME_MARKER(r1) /* "regs" marker */
/* Calling convention has r3 = regs, r4 = orig r0 */ /* Calling convention has r3 = regs, r4 = orig r0 */
addi r3,r1,STACK_INT_FRAME_REGS addi r3,r1,STACK_INT_FRAME_REGS
mr r4,r0 mr r4,r0
LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER)
std r11,-16(r3) /* "regshere" marker */
BEGIN_FTR_SECTION BEGIN_FTR_SECTION
HMT_MEDIUM HMT_MEDIUM
...@@ -250,11 +250,11 @@ END_BTB_FLUSH_SECTION ...@@ -250,11 +250,11 @@ END_BTB_FLUSH_SECTION
std r11,_TRAP(r1) std r11,_TRAP(r1)
std r12,_CCR(r1) std r12,_CCR(r1)
std r3,ORIG_GPR3(r1) std r3,ORIG_GPR3(r1)
LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER)
std r11,STACK_INT_FRAME_MARKER(r1) /* "regs" marker */
/* Calling convention has r3 = regs, r4 = orig r0 */ /* Calling convention has r3 = regs, r4 = orig r0 */
addi r3,r1,STACK_INT_FRAME_REGS addi r3,r1,STACK_INT_FRAME_REGS
mr r4,r0 mr r4,r0
LOAD_REG_IMMEDIATE(r11, STACK_FRAME_REGS_MARKER)
std r11,-16(r3) /* "regshere" marker */
#ifdef CONFIG_PPC_BOOK3S #ifdef CONFIG_PPC_BOOK3S
li r11,1 li r11,1
...@@ -637,7 +637,7 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) ...@@ -637,7 +637,7 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
* Leaving a stale STACK_FRAME_REGS_MARKER on the stack can confuse * Leaving a stale STACK_FRAME_REGS_MARKER on the stack can confuse
* the reliable stack unwinder later on. Clear it. * the reliable stack unwinder later on. Clear it.
*/ */
std r0,STACK_FRAME_OVERHEAD-16(r1) std r0,STACK_INT_FRAME_MARKER(r1)
REST_GPRS(2, 5, r1) REST_GPRS(2, 5, r1)
......
...@@ -2729,7 +2729,7 @@ kvmppc_bad_host_intr: ...@@ -2729,7 +2729,7 @@ kvmppc_bad_host_intr:
std r6, SOFTE(r1) std r6, SOFTE(r1)
LOAD_PACA_TOC() LOAD_PACA_TOC()
LOAD_REG_IMMEDIATE(3, STACK_FRAME_REGS_MARKER) LOAD_REG_IMMEDIATE(3, STACK_FRAME_REGS_MARKER)
std r3, STACK_FRAME_OVERHEAD-16(r1) std r3, STACK_INT_FRAME_MARKER(r1)
/* /*
* XXX On POWER7 and POWER8, we just spin here since we don't * XXX On POWER7 and POWER8, we just spin here since we don't
......
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