Operating system 是否在页面错误期间更正除页面表以外的表?

Operating system 是否在页面错误期间更正除页面表以外的表?,operating-system,paging,virtual-memory,Operating System,Paging,Virtual Memory,我是操作系统的新手,对页面错误很好奇。 我正在读操作系统Concetp(第10版),上面写着: 处理页面错误遵循以下顺序 1. Trap to the operating system 2. Save the user registers and process state 3. Determine that the interrupt was a page fault 4. Check that the page reference was legal and determine the lo

我是操作系统的新手,对页面错误很好奇。 我正在读操作系统Concetp(第10版),上面写着:

处理页面错误遵循以下顺序

1. Trap to the operating system
2. Save the user registers and process state
3. Determine that the interrupt was a page fault
4. Check that the page reference was legal and determine the location of the page on the disk
5. Issue a read from the disk to a free frame:
  a. Wait in a queue for this device until the read request is serviced
  b. Wait for the device seek and/or latency time
  c. Begin the transfer of the page to a free frame
6. While waiting, allocate the CPU to some other user
7. Receive an interrupt from the disk I/O subsystem (I/O completed)
8. Save the registers and process state for the other user
9. Determine that the interrupt was from the disk
10. Correct the page table and other tables to show that the page is now in memory
11. Wait for the CPU to be allocated to this process again
12. Restore the user registers, process state, and new page table, and then resume the interrupted instruction
我无法想象第10步中除了页面表之外的其他表。
你能给我举一些例子吗?

现代CPU需要几个页面表。对于x86-64,CPU中的MMU(内存管理单元)采用存储在CR3寄存器中的地址(操作系统引导时存储在那里)。此地址是第一个表(PML4)的地址。PML4表包含第二个表的地址,依此类推。虚拟地址分为5部分。前4部分是各表中的偏移量,最后一部分(12位)是主存中页的偏移量。今天,64位虚拟地址中只有48位被使用

当您使用虚拟寻址时,CPU将使用MMU转换虚拟地址,然后再将地址放入地址总线。它基本上会一次遍历每个表,占用虚拟地址的一部分,直到到达内存中的最后一个表为止


当出现页面错误时,CPU会触发某条中断线。(页面错误的)中断号由操作系统在引导时链接到IDT中的某个处理程序。RAM中IDT的地址存储在LIDT寄存器中。处理程序将执行示例中提到的步骤。它将更正所有页表并返回。

我想你的书太宽了。我会参考osdev.org了解更多信息。我在自己编写的最小操作系统中实现了分页。您也可以阅读《英特尔开发人员手册》。它非常具体,并且讨论了所有版本的CPU。