Reputation: 2884
I'm writing a minimal OS from scratch. I enabled paging and long mode but when I want to set up the stack I have a few questions.
Does the stack pointer contain a virtual address automatically translated to physical address by the MMU when using PUSH, POP instructions?
Is the position of the stack mentionned in and ELF file?
Upvotes: 1
Views: 652
Reputation: 33704
The stack pointer must be a virtual address once paging is enabled.
The standard x86-64 psABI does not specify the initial value for the stack pointer, so it does not show up in ELF files. The most common program loader (Linux) randomizes the stack address by default.
Upvotes: 2