How is the initial value of the stack pointer determined?

The program loader initializes/loads the text , data+bss areas. These are allocated in the process' virtual address space near the beginning. The heap would then grow (after data+bss) towards larger addresses. The stack grows from something large towards lower addresses.

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

If I ask for the virtual address limit per process ( ulimit -v ) I get

virtual memory          (kbytes, -v) unlimited

Now, this unlimited certainly refers to the technical limits put by a finite number of bits available for addressing (on 64 bit Linux I recall 48 bits?!)

So, is it that simple that unless a different ulimit applies the stack pointer is roughly initialized to (start of vmem + 2^48 bits)?

链接地址: http://www.djcxy.com/p/14088.html

上一篇: 无限的“吗?

下一篇: 如何确定堆栈指针的初始值?