线性地址空间位于何处? [英] Where is the Linear Address Space located?

查看:78
本文介绍了线性地址空间位于何处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读英特尔手册,我看到提到了处理器的线性地址空间".

I'm reading the intel manual, and I see mentions of "Linear Address Space of the processor".

我对线性地址空间实际上在哪里或什么感到困惑.处理器中的线性地址空间在哪里?

I'm confused as to where or what the linear address space actually is. Where in the processor is the linear address space?

据我所知,物理地址空间是实际的 RAM.逻辑地址是一个段选择器".+offset",它必须被翻译成一个物理地址.如果我理解,如果不使用分页,则线性地址空间实际上与执行中的物理地址相同.我读到每个进程都可以有自己的线性地址.因此,如果使用分页,同时在 RAM 中的多个进程可以通过分页拥有自己的线性地址空间.

The Physical Address Space is the actual RAM as I understand. A logical address is a "segment selector" + "offset", and it must be translated to a physical address. If I understand, if paging is not used, the linear address space is effectively the same as a physical address in execution. And I read that every process can have it's own linear address. So if paging is used multiple processes that are in RAM simultaneously can each have their own linear address space with paging.

但我仍然不知道线性地址实际上是什么,或者它在哪里.线性地址空间,是可执行文件中的地址吗?

But I still don't know what the linear address actually IS, or where it is. Is the linear address space, the addresses in an executable file?

推荐答案

线性地址是将 seg:off 作为寻址模式的一部分最终转换为物理地址的一个步骤.你不能直接使用它们.

Linear addresses are one step in the translation from seg:off as part of an addressing mode to eventually a physical address. You can't use them directly.

Windows 在启用分页的情况下运行,因此线性地址空间 = 当前进程的虚拟地址空间.地址解码进行 seg:off =>线性,则虚拟 =>身体的.(更多详情)

Windows runs with paging enabled, so linear address space = the virtual address space of the current process. Address decoding goes seg:off => linear, then virtual => physical. (More details)

这就是为什么分段不能让 32 位代码在单个进程中访问超过 4GiB 的地址空间.(如果您记住页表必须更大或更深才能将更多虚拟位转换为物理位,这也很有意义)

This is why segmentation can't let 32-bit code access more than 4GiB of address space in a single process. (Which also makes sense if you keep in mind that page tables would have to be larger or deeper to translate more virtual bits to physical)

Windows(与其他主流 x86 操作系统一样)使用平面内存模型,因此段基数唯一非零的情况是使用用于线程本地存储的段覆盖,例如 mov rax, [gs: 0].偏移量部分为 0,但对于共享相同线性虚拟地址空间的同一进程中的每个线程,GS 基数将不同.

Windows (like very other mainstream x86 OS) uses a flat memory model so the only time the segment base is non-zero is with a segment override for thread-local storage, like mov rax, [gs: 0]. The offset part is 0, but the GS base will be different for every thread in the same process that shares the same linear virtual address space.

如果您不是在谈论普通的 Windows 可执行文件,例如一个在虚拟 8086 环境中运行的 DOS 程序,那么它的 seg:off 地址将转换为线性地址,并在模拟或虚拟化的客户机内直接用作客户机物理地址.

If you're not talking about normal Windows executables, e.g. a DOS program running in a virtual-8086 environment, then its seg:off addresses will translate to linear and get used directly as guest-physical addresses, inside the emulated or virtualized guest machine.

你还可以做一些不寻常的事情,比如运行 16 位保护模式进程,在这种情况下,线性地址空间比寻址模式的 16 位偏移部分更宽(我认为是 32 位).在这种情况下,如果您想寻址超过 64k 的总地址空间,则很可能使用非零段基址.

You can also do unusual stuff like run 16-bit protected mode processes, in which case linear address space is wider (32-bit I think) than the 16-bit offset part of an addressing mode. In this case non-zero segment bases might well be used if you wanted to address more than 64k of total address space.

这篇关于线性地址空间位于何处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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