kernel - x86-64 架构中的分页

标签 kernel x86-64 paging mmu page-tables

在操作系统的 32 位实现中,页表具有固定的结构(两个级别 - 页目录和页表)。但在 x86_64 系统中,通常会实现多级页表(Linux 中为 4 级)。系统如何知道正在使用多少级别?为此需要什么命令?我们如何让CPU知道全局页目录和其他结构?

最佳答案

简短回答:

  • 在撰写本文时,x86-64 页表始终为 4 级。 future 可能会实现5级和6级以覆盖完整的64位地址空间。
  • 操作系统通过执行带有各种参数的 CPUID 指令来查询硬件功能。
  • 操作系统通过写入控制寄存器CR3来设置全局页目录指针。

权威文本:参见 Intel® 64 and IA-32 Architectures Software Developer Manuals ,第 3A 卷“系统编程指南,第 1 部分”,第 4.5 节“IA-32e 寻呼”。

<强> Wikipedia text (略有编辑):

The 64-bit addressing mode ("long mode") is a superset of Physical Address Extensions (PAE). Rather than the three-level page table system used by systems in PAE mode, systems running in long mode use four levels of page table: PAE's Page-Directory Pointer Table is extended from 4 entries to 512, and an additional Page-Map Level 4 (PML4) Table is added, containing 512 entries in 48-bit implementations. In implementations providing larger virtual addresses, this latter table would either grow to accommodate sufficient entries to describe the entire address range, up to a theoretical maximum of 33,554,432 entries for a 64-bit implementation, or be over ranked by a new mapping level, such as a PML5.

关于kernel - x86-64 架构中的分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30006365/

相关文章:

android - liblinphone android x86_64 ffmpeg 无法加载

assembly - 设置 RBP 有不同的方法吗?为什么 Windows x64 不将 RBP 指向返回地址正下方的已保存 RBP?

c - 锁定的页面是否由 pthreads 继承?

c - 为什么这个函数序言中没有 "sub rsp"指令,为什么函数参数存储在负 rbp 偏移处?

java - hibernate中实现结果分页(获取总行数)

c# - 我可以使用 DataTable.Select() 方法进行简单的分页吗?

c - 错误地传递参数? C题

java - 没有内核的 Libsvm

c - 错误: initializer element is not constant - linux driver

android - 如何为android添加语言支持