Higher Half Kernel: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
addstub |
mNo edit summary |
||
(9 intermediate revisions by 6 users not shown) | |||
Line 2:
{{Template:Kernel designs}}
It is traditional and generally good to have your kernel mapped in every user process. Linux and many other Unices, for instance, reside at virtual addresses ''0xC0000000
In addition, there is
Advantages of a higher half kernel are:
Line 11 ⟶ 10:
* More generally, user applications are not dependent on how much memory is kernel space (your application can be linked to 0x400000 regardless of whether kernel is at ''0xC0000000'', ''0x80000000'' or ''0xE0000000'' ...), which makes the ABI nicer.
* If your OS is 64-bit, then 32-bit applications will be able to use the full 32-bit address space.
* '
== Bootloader support ==
To make things easier, some bootloaders natively support higher half kernels, by directly loading and mapping a kernel to the higher half in virtual memory.
* [[BOOTBOOT]] only supports higher half kernels by design. It has example Hello World kernels written in [[C]], [[Pascal]], [[Rust]] and [[Go]]
* The [[Limine]] protocol also only support higher half kernels by design. See [[Limine Bare Bones]] for a tutorial on how to write a simple 64-bit higher half kernel using Limine.
== Initialization ==
To setup a higher half kernel, you have to map your kernel to the appropriate virtual address.
How to do this basically depends on '''when''' you'd like your kernel to believe it's in the higher end, and '''when''' you set up paging. Without a boot loader help, you'll need a small trampoline code which runs in lower half, sets up higher half paging and jumps.
== See Also ==
Line 21 ⟶ 28:
* [[Higher Half x86 Bare Bones]]
===
* [[Topic:11160|I wrote a simple HigherHalf kernel]]
|