How is the initial value of the stack pointer determined?

The bootloader initializes / loads the text , data+bss . They are allocated in the virtual address space of the process at the beginning. Then the heap will grow (after the data + bss) towards larger addresses. The stack grows from something larger to lower addresses.

I wonder how the initial value of the stack pointer is determined.

If I ask for a virtual address limit for each process ( ulimit -v ), I get

 virtual memory (kbytes, -v) unlimited 

Now this unlimited , of course, refers to the technical restrictions set by the finite number of bits available for addressing (on 64-bit Linux, I remember 48 bits ?!)

So, is it simple that if another ulimit is applied, the stack pointer is approximately initialized (beginning vmem + 2 ^ 48 bits)?

+4
source share

All Articles