64-Bit Higher Half Kernel
Posted: Sat Feb 27, 2021 7:16 am
Finally I got to full switch to 64-Bit mode, fixed linking issues and other stuff. Now I am stuck at the higher half kernel because most higher half kernel tutorials are for 32-Bit CPUs which I am not interested in. For 64-Bit CPUs I only found several forum posts and a wikipedia page.
My understanding of higher half kernel - it is a kernel that is remapped to a virtual memory region that leaves just enough space to fit the kernel before the end of RAM(I want it to be 1 GB(left till the end of RAM), in 32-Bit mode there is really a 32-Bit address space and all of it could be used so it is easy to choose and mostly people say to put it at 3GB.
But problem arises in 64-Bit mode where only 48-Bits could be used for addresses(I won't bother with PML5 which is only in the Ice Lake+ anyway and in any case it is still not 64-Bits), so the kernel should be located at (2^48 - 1) - 1GB, but on all forum posts and wikipedia article they talk about loading to FFFF8000'00000000 which is not an address on x86-64 with PML4 as it is larger then 48-Bit and does not exist even in the virtual address space.
So where should I load the kernel in 64-Bit mode and why do they talk about an unexistant address that can't be used?
Wikipedia page I am talking about - https://en.wikipedia.org/wiki/X86-64#Vi ... ce_details
My understanding of higher half kernel - it is a kernel that is remapped to a virtual memory region that leaves just enough space to fit the kernel before the end of RAM(I want it to be 1 GB(left till the end of RAM), in 32-Bit mode there is really a 32-Bit address space and all of it could be used so it is easy to choose and mostly people say to put it at 3GB.
But problem arises in 64-Bit mode where only 48-Bits could be used for addresses(I won't bother with PML5 which is only in the Ice Lake+ anyway and in any case it is still not 64-Bits), so the kernel should be located at (2^48 - 1) - 1GB, but on all forum posts and wikipedia article they talk about loading to FFFF8000'00000000 which is not an address on x86-64 with PML4 as it is larger then 48-Bit and does not exist even in the virtual address space.
So where should I load the kernel in 64-Bit mode and why do they talk about an unexistant address that can't be used?
Wikipedia page I am talking about - https://en.wikipedia.org/wiki/X86-64#Vi ... ce_details