I would like to understand it a bit deeper, please let me know if I wrong in some of my assumptions. Let's say virtual address have 3 PMN table: PML3, PML2, PML1. The pointer to the first table is CR3 (physical address), each entry of the table point to beginning of PML2 table or null. Just to double check, pointers here are physical (to the physical address of each PML2 table, Am I right? Similarly the PML3, each PML2's entry point to beginning of a PML1 table. Is this points are to physical address? (Some-why I think that I heard somewhere that only first table point to physical address, and all the other to virtual address, but it's not make sense to me) Am I confused it with something else? All the points of all PMH table point to physical addresses?
1 Answers
Yes, in most ISAs with nested page-tables walked by hardware, all levels use physical addresses as pointers, to avoid a catch 22 of needing to virt->phys another virtual address.
For example on x86, How does x86 paging work?, and Why in 64bit the virtual address are 4 bits short (48bit long) compared with the physical address (52 bit long)? has a diagram of the multi-level PDEs / PTEs.
I think some ISAs might have done other things, like special fixed TLB entries and you could put page-table pointers in that range of virtual addresses? (e.g. MIPS uses software TLB handling so page-walks have to be done by software, and thus loads are going through the usual path of virt->phys translation. The TLB-miss handler has to make sure not to cause another TLB miss by only using addresses in the fixed-translation region, I think. Or something like that.)

- 328,167
- 45
- 605
- 847
-
Thank you for you answer! From "higher levels use physical addresses as pointers" should I understand that lower levels (except the lowest one) don't use physical addresses? – ChaosPredictor Jul 13 '20 at 08:14
-
1@ChaosPredictor: I should have said all levels. The lowest level PTEs contain a physical page number, i.e. a physical pointer to a page, just like the higher levels. I meant "higher levels as well", but clearest to say "all levels". – Peter Cordes Jul 13 '20 at 09:58