Kernel Newbies archive on lore.kernel.org
 help / Atom feed
* 8 bytes reserved at the top of the stack in arm
@ 2018-12-28 17:59 ksourav
  0 siblings, 0 replies; 1+ messages 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] 1+ messages in thread

only message in thread, back to index

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

Kernel Newbies archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kernelnewbies/0 kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ https://lore.kernel.org/kernelnewbies \
		kernelnewbies@kernelnewbies.org kernelnewbies@archiver.kernel.org
	public-inbox-index kernelnewbies


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernelnewbies.kernelnewbies


AGPL code for this site: git clone https://public-inbox.org/ public-inbox