Switch to a higher-half kernel design
Closed this issue · 0 comments
d4ilyrun commented
What
A higher-half kernel is a kernel whose code resides at the beginning of the RAM (e.g. physical address == 0x00100000), but which appears to be linked in the higher half of the address space (i.e. virtual address > 3GiB). This can be done through the use of linker script.
Why
Higher-half kernel have many benefits:
- Reserving the lower half of the address space for userland programs
- Easily linking user applications regardless of the kernel code's total current size
- Being compatible with hexadecimal mnemonic constants (e.g. 0xdeadbeef)
How
From what I gathered:
- Modify the linkerscript using the
AT
directive - Use a temporary static PD and PT to map the kernel before booting
- Run as usual until the C code sets up paging completely (overriding the temporary paging structure in the process)
- Benefit