Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在从头开始编写一个最小的操作系统。我启用了分页和长模式,但是当我想设置堆栈时,我有几个问题。
堆栈指针是否包含在使用 PUSH、POP 指令时由 MMU 自动转换为物理地址的虚拟地址?
堆栈的位置是否在 ELF 文件中提及?
启用分页后,堆栈指针必须是虚拟地址。
标准的 x86-64 psABI 没有指定堆栈指针的初始值,因此它不会出现在 ELF 文件中。默认情况下,最常见的程序加载器 (Linux) 会随机化堆栈地址。