Paging Questions (amd64)
Posted: Thu Nov 13, 2008 12:47 pm
Hi all, excuse me for my (probably) bad english.
We (me and a friend of mine) are coding a 64-bit OS and for now we have implemented a bootloader (which setups basic identity paging, too), screen output functions, descriptors tables, software and hardware interrupts, some basic C library's functions and a physical memory manager.
The latest one uses a bitmap in order to keep track of the [un]used blocks (4096 bytes each).
Now I'm about to write the virtual memory manager, through paging. But I still have some doubts.
Considering that an amd64-compliant processor can address up to 256 TB of memory, I can't allocate space for all the paging structures in order to potentially map all of them, because it will take too much space, so I have to allocate and map them dinamically.
I already know the PML4 latest entry's trick, that allows me to access all the PML1 entries in the latest 512gb of virtual memory.
But obviously I can't setup all the paging structures from PML4 to PML2 in order to cover all the 256TB, so I need a way to access them too, once paging is activated.
Am I missing something? I will be very thankful if someone showes how he handles paging, and how physical and virtual memory management works together.
We (me and a friend of mine) are coding a 64-bit OS and for now we have implemented a bootloader (which setups basic identity paging, too), screen output functions, descriptors tables, software and hardware interrupts, some basic C library's functions and a physical memory manager.
The latest one uses a bitmap in order to keep track of the [un]used blocks (4096 bytes each).
Now I'm about to write the virtual memory manager, through paging. But I still have some doubts.
Considering that an amd64-compliant processor can address up to 256 TB of memory, I can't allocate space for all the paging structures in order to potentially map all of them, because it will take too much space, so I have to allocate and map them dinamically.
I already know the PML4 latest entry's trick, that allows me to access all the PML1 entries in the latest 512gb of virtual memory.
But obviously I can't setup all the paging structures from PML4 to PML2 in order to cover all the 256TB, so I need a way to access them too, once paging is activated.
Am I missing something? I will be very thankful if someone showes how he handles paging, and how physical and virtual memory management works together.