realjump

Crates.iorealjump
lib.rsrealjump
version0.2.0
sourcesrc
created_at2021-09-14 05:52:25.062297
updated_at2022-03-28 22:46:26.207336
descriptionTiny crate that loads and boots Real Mode code from an x86-64 kernel
homepage
repositoryhttps://github.com/mars-research/realjump
max_upload_size
id451059
size16,522
Zhaofeng Li (zhaofengli)

documentation

README

realjump

Build

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

  1. Disable interrupts.
  2. Identity map the first 1MiB of memory as executable.
  3. Halt all other processors.
  4. Call realjump::boot(your_mbr_slice, 0x7c00).unwrap().
  5. 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.

Commit count: 11

cargo fmt