powerpc: add a define for the user interrupt frame size
The user interrupt frame is a different size from the kernel frame, so give it its own name. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20221127124942.1665522-11-npiggin@gmail.com
This commit is contained in:
parent
e856e33692
commit
1223e5a20f
@ -122,8 +122,7 @@ struct pt_regs
|
||||
|
||||
#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
|
||||
#define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */
|
||||
#define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \
|
||||
STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE)
|
||||
#define STACK_USER_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD)
|
||||
#define STACK_INT_FRAME_REGS STACK_FRAME_OVERHEAD
|
||||
#define STACK_INT_FRAME_MARKER (STACK_FRAME_OVERHEAD - 16)
|
||||
|
||||
@ -143,7 +142,7 @@ struct pt_regs
|
||||
#define KERNEL_REDZONE_SIZE 0
|
||||
#define STACK_FRAME_OVERHEAD 16 /* size of minimum 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_USER_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD)
|
||||
#define STACK_INT_FRAME_REGS STACK_FRAME_OVERHEAD
|
||||
#define STACK_INT_FRAME_MARKER (STACK_FRAME_OVERHEAD - 8)
|
||||
#define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD
|
||||
@ -153,6 +152,7 @@ struct pt_regs
|
||||
|
||||
#endif /* __powerpc64__ */
|
||||
|
||||
#define STACK_INT_FRAME_SIZE (KERNEL_REDZONE_SIZE + STACK_USER_INT_FRAME_SIZE)
|
||||
#define STACK_INT_FRAME_MARKER_LONGS (STACK_INT_FRAME_MARKER/sizeof(long))
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
@ -1756,15 +1756,15 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
|
||||
klp_init_thread_info(p);
|
||||
|
||||
/* Create initial stack frame. */
|
||||
sp -= (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD);
|
||||
sp -= STACK_USER_INT_FRAME_SIZE;
|
||||
((unsigned long *)sp)[0] = 0;
|
||||
|
||||
/* Copy registers */
|
||||
childregs = (struct pt_regs *)(sp + STACK_FRAME_OVERHEAD);
|
||||
childregs = (struct pt_regs *)(sp + STACK_INT_FRAME_REGS);
|
||||
if (unlikely(args->fn)) {
|
||||
/* kernel thread */
|
||||
memset(childregs, 0, sizeof(struct pt_regs));
|
||||
childregs->gpr[1] = sp + (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD);
|
||||
childregs->gpr[1] = sp + STACK_USER_INT_FRAME_SIZE;
|
||||
/* function */
|
||||
if (args->fn)
|
||||
childregs->gpr[14] = ppc_function_entry((void *)args->fn);
|
||||
|
@ -77,7 +77,7 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum
|
||||
/*
|
||||
* For user tasks, this is the SP value loaded on
|
||||
* kernel entry, see "PACAKSAVE(r13)" in _switch() and
|
||||
* system_call_common()/EXCEPTION_PROLOG_COMMON().
|
||||
* system_call_common().
|
||||
*
|
||||
* Likewise for non-swapper kernel threads,
|
||||
* this also happens to be the top of the stack
|
||||
@ -88,7 +88,7 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum
|
||||
* an unreliable stack trace until it's been
|
||||
* _switch()'ed to for the first time.
|
||||
*/
|
||||
stack_end -= STACK_FRAME_OVERHEAD + sizeof(struct pt_regs);
|
||||
stack_end -= STACK_USER_INT_FRAME_SIZE;
|
||||
} else {
|
||||
/*
|
||||
* idle tasks have a custom stack layout,
|
||||
|
Loading…
x
Reference in New Issue
Block a user