Higher Half Kernel

From OSDev.wiki
Revision as of 20:51, 22 July 2016 by osdev>Sortie (Add See Also)
Jump to navigation Jump to search
Kernel Designs
Models
Other Concepts

It is traditional and generally good to have your kernel mapped in every user process. Linux, for instance (and many other Unices) reside at the virtual addresses 0xC0000000 - 0xFFFFFFFF of every address space, leaving the range 0x00000000 - 0xBFFFFFFF for user code, data, stacks, libraries, etc. Kernels that have such design are said to be "in the higher half" by opposition to kernels that use lowest virtual addresses for themselves, and leave higher addresses for the applications.

Advantages of a higher half kernel are:

  • It's easier to set up VM86 processes since the region below 1MB is userspace.
  • More generically, 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 ABI's nicer.
  • If your OS is 64-bits, then 32-bit applications will be able to use the full 32-bit address space.
  • 'mnemonic' invalid pointers such as 0xCAFEBABE, 0xDEADBEEF, 0xDEADC0DE, etc. can be used.

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.

See Also

Articles

Forums