Page 1 of 1

Self-referencing PML4 - what are the advantages

Posted: Mon Jun 28, 2010 6:48 pm
by gerryg400
Having spent some time figuring out how this little trick works and implementing it, I'm now wondering whether I really need it.

In long mode it's possible to contiguously map the entire of physical memory somewhere in the upper half, let's say at 0xffff'8000'0000'0000 and then to have a function/macro that can convert any physical address to a kernel accessable linear address by simply adding 0xffff'8000'0000'0000. Wouldn't that then give me permanent access to the page-tables etc. of any process by simply walking down from that process's cr3 using my simple phys_to_kern function ?

Am I missing something here ?

Re: Self-referencing PML4 - what are the advantages

Posted: Tue Jun 29, 2010 2:38 am
by Owen
Yes.

For a start, theres more physical address space than there is virtual.

Re: Self-referencing PML4 - what are the advantages

Posted: Tue Jun 29, 2010 2:56 am
by gerryg400
True, but for the next few years, no-one's gonna have enough RAM for that to matter are they? There's 128TB-2GB of 'spare' virtual mem in the higher half....