Commit 71e70184 authored by Jianlin Lv's avatar Jianlin Lv Committed by Catalin Marinas

arm64: rename S_FRAME_SIZE to PT_REGS_SIZE

S_FRAME_SIZE is the size of the pt_regs structure, no longer the size of
the kernel stack frame, the name is misleading. In keeping with arm32,
rename S_FRAME_SIZE to PT_REGS_SIZE.
Signed-off-by: default avatarJianlin Lv <Jianlin.Lv@arm.com>
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20210112015813.2340969-1-Jianlin.Lv@arm.comSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent b90d72a6
...@@ -75,7 +75,7 @@ int main(void) ...@@ -75,7 +75,7 @@ int main(void)
DEFINE(S_SDEI_TTBR1, offsetof(struct pt_regs, sdei_ttbr1)); DEFINE(S_SDEI_TTBR1, offsetof(struct pt_regs, sdei_ttbr1));
DEFINE(S_PMR_SAVE, offsetof(struct pt_regs, pmr_save)); DEFINE(S_PMR_SAVE, offsetof(struct pt_regs, pmr_save));
DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe)); DEFINE(S_STACKFRAME, offsetof(struct pt_regs, stackframe));
DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs)); DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
BLANK(); BLANK();
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
DEFINE(COMPAT_SIGFRAME_REGS_OFFSET, offsetof(struct compat_sigframe, uc.uc_mcontext.arm_r0)); DEFINE(COMPAT_SIGFRAME_REGS_OFFSET, offsetof(struct compat_sigframe, uc.uc_mcontext.arm_r0));
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
*/ */
.macro ftrace_regs_entry, allregs=0 .macro ftrace_regs_entry, allregs=0
/* Make room for pt_regs, plus a callee frame */ /* Make room for pt_regs, plus a callee frame */
sub sp, sp, #(S_FRAME_SIZE + 16) sub sp, sp, #(PT_REGS_SIZE + 16)
/* Save function arguments (and x9 for simplicity) */ /* Save function arguments (and x9 for simplicity) */
stp x0, x1, [sp, #S_X0] stp x0, x1, [sp, #S_X0]
...@@ -61,15 +61,15 @@ ...@@ -61,15 +61,15 @@
.endif .endif
/* Save the callsite's SP and LR */ /* Save the callsite's SP and LR */
add x10, sp, #(S_FRAME_SIZE + 16) add x10, sp, #(PT_REGS_SIZE + 16)
stp x9, x10, [sp, #S_LR] stp x9, x10, [sp, #S_LR]
/* Save the PC after the ftrace callsite */ /* Save the PC after the ftrace callsite */
str x30, [sp, #S_PC] str x30, [sp, #S_PC]
/* Create a frame record for the callsite above pt_regs */ /* Create a frame record for the callsite above pt_regs */
stp x29, x9, [sp, #S_FRAME_SIZE] stp x29, x9, [sp, #PT_REGS_SIZE]
add x29, sp, #S_FRAME_SIZE add x29, sp, #PT_REGS_SIZE
/* Create our frame record within pt_regs. */ /* Create our frame record within pt_regs. */
stp x29, x30, [sp, #S_STACKFRAME] stp x29, x30, [sp, #S_STACKFRAME]
...@@ -120,7 +120,7 @@ ftrace_common_return: ...@@ -120,7 +120,7 @@ ftrace_common_return:
ldr x9, [sp, #S_PC] ldr x9, [sp, #S_PC]
/* Restore the callsite's SP */ /* Restore the callsite's SP */
add sp, sp, #S_FRAME_SIZE + 16 add sp, sp, #PT_REGS_SIZE + 16
ret x9 ret x9
SYM_CODE_END(ftrace_common) SYM_CODE_END(ftrace_common)
...@@ -130,7 +130,7 @@ SYM_CODE_START(ftrace_graph_caller) ...@@ -130,7 +130,7 @@ SYM_CODE_START(ftrace_graph_caller)
ldr x0, [sp, #S_PC] ldr x0, [sp, #S_PC]
sub x0, x0, #AARCH64_INSN_SIZE // ip (callsite's BL insn) sub x0, x0, #AARCH64_INSN_SIZE // ip (callsite's BL insn)
add x1, sp, #S_LR // parent_ip (callsite's LR) add x1, sp, #S_LR // parent_ip (callsite's LR)
ldr x2, [sp, #S_FRAME_SIZE] // parent fp (callsite's FP) ldr x2, [sp, #PT_REGS_SIZE] // parent fp (callsite's FP)
bl prepare_ftrace_return bl prepare_ftrace_return
b ftrace_common_return b ftrace_common_return
SYM_CODE_END(ftrace_graph_caller) SYM_CODE_END(ftrace_graph_caller)
......
...@@ -75,7 +75,7 @@ alternative_else_nop_endif ...@@ -75,7 +75,7 @@ alternative_else_nop_endif
.endif .endif
#endif #endif
sub sp, sp, #S_FRAME_SIZE sub sp, sp, #PT_REGS_SIZE
#ifdef CONFIG_VMAP_STACK #ifdef CONFIG_VMAP_STACK
/* /*
* Test whether the SP has overflowed, without corrupting a GPR. * Test whether the SP has overflowed, without corrupting a GPR.
...@@ -96,7 +96,7 @@ alternative_else_nop_endif ...@@ -96,7 +96,7 @@ alternative_else_nop_endif
* userspace, and can clobber EL0 registers to free up GPRs. * userspace, and can clobber EL0 registers to free up GPRs.
*/ */
/* Stash the original SP (minus S_FRAME_SIZE) in tpidr_el0. */ /* Stash the original SP (minus PT_REGS_SIZE) in tpidr_el0. */
msr tpidr_el0, x0 msr tpidr_el0, x0
/* Recover the original x0 value and stash it in tpidrro_el0 */ /* Recover the original x0 value and stash it in tpidrro_el0 */
...@@ -253,7 +253,7 @@ alternative_else_nop_endif ...@@ -253,7 +253,7 @@ alternative_else_nop_endif
scs_load tsk, x20 scs_load tsk, x20
.else .else
add x21, sp, #S_FRAME_SIZE add x21, sp, #PT_REGS_SIZE
get_current_task tsk get_current_task tsk
.endif /* \el == 0 */ .endif /* \el == 0 */
mrs x22, elr_el1 mrs x22, elr_el1
...@@ -377,7 +377,7 @@ alternative_else_nop_endif ...@@ -377,7 +377,7 @@ alternative_else_nop_endif
ldp x26, x27, [sp, #16 * 13] ldp x26, x27, [sp, #16 * 13]
ldp x28, x29, [sp, #16 * 14] ldp x28, x29, [sp, #16 * 14]
ldr lr, [sp, #S_LR] ldr lr, [sp, #S_LR]
add sp, sp, #S_FRAME_SIZE // restore sp add sp, sp, #PT_REGS_SIZE // restore sp
.if \el == 0 .if \el == 0
alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0 alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
...@@ -580,12 +580,12 @@ __bad_stack: ...@@ -580,12 +580,12 @@ __bad_stack:
/* /*
* Store the original GPRs to the new stack. The orginal SP (minus * Store the original GPRs to the new stack. The orginal SP (minus
* S_FRAME_SIZE) was stashed in tpidr_el0 by kernel_ventry. * PT_REGS_SIZE) was stashed in tpidr_el0 by kernel_ventry.
*/ */
sub sp, sp, #S_FRAME_SIZE sub sp, sp, #PT_REGS_SIZE
kernel_entry 1 kernel_entry 1
mrs x0, tpidr_el0 mrs x0, tpidr_el0
add x0, x0, #S_FRAME_SIZE add x0, x0, #PT_REGS_SIZE
str x0, [sp, #S_SP] str x0, [sp, #S_SP]
/* Stash the regs for handle_bad_stack */ /* Stash the regs for handle_bad_stack */
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
stp x24, x25, [sp, #S_X24] stp x24, x25, [sp, #S_X24]
stp x26, x27, [sp, #S_X26] stp x26, x27, [sp, #S_X26]
stp x28, x29, [sp, #S_X28] stp x28, x29, [sp, #S_X28]
add x0, sp, #S_FRAME_SIZE add x0, sp, #PT_REGS_SIZE
stp lr, x0, [sp, #S_LR] stp lr, x0, [sp, #S_LR]
/* /*
* Construct a useful saved PSTATE * Construct a useful saved PSTATE
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
.endm .endm
SYM_CODE_START(kretprobe_trampoline) SYM_CODE_START(kretprobe_trampoline)
sub sp, sp, #S_FRAME_SIZE sub sp, sp, #PT_REGS_SIZE
save_all_base_regs save_all_base_regs
...@@ -76,7 +76,7 @@ SYM_CODE_START(kretprobe_trampoline) ...@@ -76,7 +76,7 @@ SYM_CODE_START(kretprobe_trampoline)
restore_all_base_regs restore_all_base_regs
add sp, sp, #S_FRAME_SIZE add sp, sp, #PT_REGS_SIZE
ret ret
SYM_CODE_END(kretprobe_trampoline) SYM_CODE_END(kretprobe_trampoline)
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