为什么Linux二进制文件的虚拟内存地址从0x8048000开始? [英] Why do virtual memory addresses for linux binaries start at 0x8048000?

查看:385
本文介绍了为什么Linux二进制文件的虚拟内存地址从0x8048000开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu x86系统上反汇编ELF二进制文件我不禁注意到code(.text)部分从虚拟地址0x8048000开始,所有较低的内存地址似乎都未使用.

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.

这似乎很浪费,并且所有Google出现的都是

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?

推荐答案

来自链接器和加载器图书:

在386系统上,文本基址为0x08048000,它允许在文本下方有相当大的堆栈,而仍保持在地址0x08000000上方,从而允许大多数程序使用单个二级页表. (回想一下,在386上,每个第二级表都映射0x00400000地址.)

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.)

这篇关于为什么Linux二进制文件的虚拟内存地址从0x8048000开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆