2 unstable releases
0.2.0 | Mar 28, 2022 |
---|---|
0.1.0 | Sep 14, 2021 |
#831 in Unix APIs
10KB
198 lines
realjump
realjump
is a tiny #![no_std]
crate that loads and boots Real Mode code (MBR, GRUB2, etc.) from your x86-64 kernel.
It puts the system from Long Mode back to Real Mode and jumps to the code.
But why?
It's mostly useful for quickly getting back to Linux from your OS because the boot process can be very slow on server hardware, and you are too lazy to implement some kexec-like functionality in your kernel.
Usage
- Disable interrupts.
- Identity map the first 1MiB of memory as executable.
- Halt all other processors.
- Call
realjump::boot(your_mbr_slice, 0x7c00).unwrap()
. realjump
will take care of the rest. It will load its own GDT and take the system all the way back to Real Mode.
INT 13h
Certain BIOS services, like INT 13h, may no longer function when you return to Real Mode.
For GRUB2, you can work around this by loading the core.img
directly with realjump::boot_grub2
.