UEFI 64-bit and kernel mapping
Posted: Fri Nov 10, 2017 3:21 am
Hi all, just want to ask for some advice regarding UEFI on x64 and mapping higher half kernel.
The process I'm currently designing for my kernel looks something like this:
- UEFI bootloader loads the kernel and all supporting modules
- The bootloader creates the paging table for the kernel and modules and map them to the correct location inside the page table
- Switch over to new page table
- Enter the kernel and continue
The thing that I can't figure out is the step to switch over to the new page table and enter the kernel. UEFI spec states that the boot services and runtime services will be identity mapped, and I presume all allocations made inside the bootloader will also be identity mapped, all other memory locations are undefined. Is there a way to get the memory location of the currently executing UEFI image to identity map it until the time is right to switch page tables, or is there some other way I'm missing of how to do this?
The process I'm currently designing for my kernel looks something like this:
- UEFI bootloader loads the kernel and all supporting modules
- The bootloader creates the paging table for the kernel and modules and map them to the correct location inside the page table
- Switch over to new page table
- Enter the kernel and continue
The thing that I can't figure out is the step to switch over to the new page table and enter the kernel. UEFI spec states that the boot services and runtime services will be identity mapped, and I presume all allocations made inside the bootloader will also be identity mapped, all other memory locations are undefined. Is there a way to get the memory location of the currently executing UEFI image to identity map it until the time is right to switch page tables, or is there some other way I'm missing of how to do this?