kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* 8 bytes reserved at the top of the stack in arm
@ 2018-12-28 17:59 ksourav
  0 siblings, 0 replies; only message in thread
From: ksourav @ 2018-12-28 17:59 UTC (permalink / raw)
  To: kernelnewbies

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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-28 18:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-28 17:59 8 bytes reserved at the top of the stack in arm ksourav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).