Recursive paging trick on non-last PML4 entry
Posted: Wed Jun 06, 2018 10:04 am
I'm trying to figure out the recursive paging trick I read about from here and here.
Although I think I understand the idea behind this, when trying to apply this trick on my own system, I cannot seem to use the last PML4 entry because the OS seems to be using the last PML4 entry for the kernel.
The first question would be: Should I set the recursive entry in the PML4 table first, before mapping any addresses?
If I use the 510th entry, rather than the last (511th) entry in the PML4 table for my recursive mapping trick, that would mean, the recursion would happen at
Meaning, if I were to map a, let's say, an entry which loops the PML4 table 3 times (PML4 -> PDPT -> PD), I would need to map the virtual address 0xFFFFFF7FBFC... to a specific physical address?
Isn't this too "complicated" an address to use for recursive mapping? What is the idea behind sometimes using the 510th rather than the 511th entry in the PML4 table for this purpose?
Although I think I understand the idea behind this, when trying to apply this trick on my own system, I cannot seem to use the last PML4 entry because the OS seems to be using the last PML4 entry for the kernel.
The first question would be: Should I set the recursive entry in the PML4 table first, before mapping any addresses?
If I use the 510th entry, rather than the last (511th) entry in the PML4 table for my recursive mapping trick, that would mean, the recursion would happen at
Code: Select all
0xFFFFFF0...
0xFFFFFF7F8...
0xFFFFFF7FBFC...
0xFFFFFF7FBFDFE...
Isn't this too "complicated" an address to use for recursive mapping? What is the idea behind sometimes using the 510th rather than the 511th entry in the PML4 table for this purpose?