8 bytes reserved at the top of the stack in arm
ksourav
sourav.jb1988 at gmail.com
Fri Dec 28 12:59:16 EST 2018
Hi,
In arm linux, kernel stack is 8KB(two consecutive pages). struct
pt_regs lie at the top of the stack and thread_info lie at the bottom
of the stack.
In arch/arm/include/asm/processor.h
#define task_pt_regs(p) \
((struct pt_regs *)(THREAD_START_SP +
task_stack_page(p)) - 1)
In arch/arm/include/asm/threadinfo.h
#define THREAD_START_SP (THREAD_SIZE - 8)
Why are 8 bytes reserved at the top ?
Also, seeing similar thing in arch/arm/include/asm/ptrace.h
#define current_pt_regs(void) ({ (struct pt_regs *) \
((current_stack_pointer | (THREAD_SIZE - 1)) - 7)
- 1; \ })
(current_stack_pointer | (THREAD_SIZE - 1) It will get the top of
stack and the we are subtracting 7 from it ?
Why are these bytes reserved ?
Thanks & Regards
More information about the Kernelnewbies
mailing list