Why do virtual memory addresses for linux binaries start at 0x8048000?

大憨熊 提交于 2019-11-26 10:35:31

问题


Disassembling an ELF binary on a Ubuntu x86 system I couldn\'t help but notice that the code(.text) section starts from the virtual address 0x8048000 and all lower memory addresses seem to be unused.

This seems to be rather wasteful and all Google turns up is either folklore involving STACK_TOP or protection against null-pointer dereferences. The latter case looks like it can be fixed by using a single page instead of leaving a 128MB gap.

So my question is this - is there a definitive answer to why the layout has been fixed to these values or is it just an arbitrary choice?


回答1:


From the Linkers and loaders book:

On 386 systems, the text base address is 0x08048000, which permits a reasonably large stack below the text while still staying above address 0x08000000, permitting most programs to use a single second-level page table. (Recall that on the 386, each second-level table maps 0x00400000 addresses.)



来源:https://stackoverflow.com/questions/2966426/why-do-virtual-memory-addresses-for-linux-binaries-start-at-0x8048000

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!