为什么linux中.text 虚拟内存段不是从0起始的?

新手上路,请多包涵

另外,为什么.text段对于32bit/64bit体系分别起始于0x08048000/0x00400000, 关于这个确定数值的取值有什么决定因素?

阅读 24.1k
2 个回答

据我所知,这个数字没什么特殊含义,这个数值就是大佬们拍脑袋定的。
文档里说:虚拟内存不从0开始是为了可以预留一个足够大的read only堆,每个程序都可以在这里建立单独的2级页表。一个2级页表是0x00400000

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题