gpt4 book ai didi

linux - 为什么 Linux 二进制文件的虚拟内存地址从 0x8048000 开始?

转载 作者:IT老高 更新时间:2023-10-28 12:40:58 26 4
gpt4 key购买 nike

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

这似乎相当浪费,所有谷歌出现的都是folklore involving STACK_TOP或防止空指针取消引用。后一种情况看起来可以通过使用单个页面而不是留下 128MB 的间隙来修复。

所以我的问题是——对于为什么布局被固定为这些值,或者它只是一个任意选择,是否有明确的答案?

最佳答案

来自 Linkers and loaders书:

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 - 为什么 Linux 二进制文件的虚拟内存地址从 0x8048000 开始?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2966426/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com