Thank you for your answer. I understand how this arithmetic works. But I haven't found description of why this calculation starts from the end of the virtual address space. Is this position of PML4 documented somewhere? PML4 would be potentially mapped at the beginning of the virtual address spece (or at any other computable place). But in reality it is mapped at the end of virtual memory.Rusky wrote:That is also not documented explicitly. You can figure it out because each level's entry maps a fixed size (e.g. a PT entry maps 4k, a PML4 entry maps 1/512th the address space) to a fixed location based on its position in the table and the table's position in its parent and so on.
Recursive mapping questions
Re: Recursive mapping questions
Re: Recursive mapping questions
The position of the PML4 depends entirely on where you map it. If you map the PML4 to its own last entry, then it will be in the last 4k of the address space because it will be recursively mapped to the end of (itself viewed as) a PDPT, the end of a PD, and finally the end of a PT. If you map it to its first entry, it will be in the first page of the address space, and the same for any of the 512 positions available for it, evenly spaced throughout the address space.
Re: Recursive mapping questions
It finally clicked in my mind. The last piece of the puzzle fell into place. Thank you very much for your explanations.Rusky wrote:The position of the PML4 depends entirely on where you map it ...