Recursive mapping questions

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Pavlo
Posts: 5
Joined: Thu Apr 21, 2016 9:55 am

Re: Recursive mapping questions

Post by Pavlo »

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.
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.
User avatar
Rusky
Member
Member
Posts: 792
Joined: Wed Jan 06, 2010 7:07 pm

Re: Recursive mapping questions

Post by Rusky »

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.
Pavlo
Posts: 5
Joined: Thu Apr 21, 2016 9:55 am

Re: Recursive mapping questions

Post by Pavlo »

Rusky wrote:The position of the PML4 depends entirely on where you map it ...
It finally clicked in my mind. The last piece of the puzzle fell into place. Thank you very much for your explanations.
Post Reply