windows - Windows如何不对称地分割其虚拟内存空间?

标签 windows kernel x86-64 paging

根据AMD64架构程序员手册第2卷(系统编程),逻辑地址只有当第48-63位与第47位全部相同时才有效:

5.3.1 Canonical Address Form

The AMD64 architecture requires implementations supporting fewer than the full 64-bit virtual address to ensure that those addresses are in canonical form. An address is in canonical form if the address bits from the most-significant implemented bit up to bit 63 are all ones or all zeros. If the addresses of all bytes in a virtual-memory reference are not in canonical form, the processor generates a general-protection exception (#GP) or a stack fault (#SS) as appropriate.

enter image description here

所以看来唯一有效的地址范围是 0x0000_0000_0000_0000 ~ 0x0000_7FFF_FFFF_FFFF 和 0xFFFF_8000_0000_0000 ~ 0xFFFF_FFFF_FFFF_FFFF,即较低的 128 TiB 和较高的 128 TiB。然而,根据MSDN,Windows x64内核使用的地址似乎并非如此。

In 64-bit Windows, the theoretical amount of virtual address space is 2^64 bytes (16 exabytes), but only a small portion of the 16-exabyte range is actually used. The 8-terabyte range from 0x000'00000000 through 0x7FF'FFFFFFFF is used for user space, and portions of the 248-terabyte range from 0xFFFF0800'00000000 through 0xFFFFFFFF'FFFFFFFF are used for system space.

那么,无论硬件规范如何,Windows 如何将虚拟地址空间分割为较低的 8 TiB 和较高的 248 TiB?我想知道为什么它不会对检查地址是否规范的硬件造成任何问题。

**更新:** Microsoft 似乎在 Windows 8.1 中修复了此差异。请参阅https://www.facebook.com/codemachineinc/posts/567137303353192了解详情。

最佳答案

你是对的;当前具有 48 位虚拟地址支持的 x86-64 硬件要求高 16 位是低 48 位的符号扩展(即位 47 与位 [63:48] 匹配)。这意味着 0xFFFF0800'000000000xFFFFFFFF'FFFFFFFF 范围在当前 x86-64 硬件上大约有一半是非规范的。

Windows 只是描述它如何划分完整的 64 位虚拟地址空间,而不描述当前 x86-64 硬件上实际使用的部分。当然,它只能使用规范的 128 TiB,从 0xFFFF8000'00000000-1。 (请注意 8 的位置;它与全 1 的高 16 字节之间没有间隙,这与理论上的 Windows 范围不同。)

高端服务器可以使用 6TiB 甚至更多 RAM 构建。 (Xeon Platinum Scalable Processors 显然每个插槽最多 1.5TiB,最多 8 路,例如 8180M)。

英特尔提出了更大的物理和虚拟寻址的扩展,添加了另一级页表,https://software.intel.com/sites/default/files/managed/2b/80/5-level_paging_white_paper.pdf ,因此在我们拥有超过 128TiB 物理 RAM 的系统之前,操作系统希望不会因为没有足够的虚拟地址空间来映射所有 RAM 而陷入困境(就像在纯 32 位系统上 PAE 的糟糕时代一样)。

关于windows - Windows如何不对称地分割其虚拟内存空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51241764/

相关文章:

java - 如何获取windows系统文件夹的路径?

javascript - 烦人的 IE8 下拉问题在 XP 而不是 windows 7

linux - 如何查看编译后的linux内核?

macos - 为什么 %eax 在调用 printf 之前归零?

windows - WAMP 上的 MongoDB/PHP —— phpinfo 与 php -i

linux - 在来自两个不同进程的相同文件描述符上调用 ioctl

gdb - 如何从 uImage (arm) 中提取内核符号?

将 OpenMP 代码编译为 C 代码

c - 在 Mac OS X Lion 上获取 C 中的堆栈指针

python - 以有限的优先级启动子进程