8 bytes reserved at the top of the stack in arm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux