Expand description
Bootloader-to-kernel handoff ABI.
This module defines the data structures passed from the bootloader (Limine) to the kernel at entry point. The kernel reads these structures to discover memory layout, ACPI tables, framebuffer configuration, and kernel modules.
§Boot flow
BIOS/UEFI → Limine bootloader → kernel_main(KernelArgs)The bootloader populates KernelArgs on the initial stack or in a
reserved memory region, then jumps to the kernel entry point with a
pointer to this structure in a register (typically RDI on x86_64).
§ABI stability
The KernelArgs layout is frozen per ABI version. Changing the layout
requires bumping STRAT9_BOOT_ABI_VERSION and updating both
bootloader and kernel simultaneously.
§Example (kernel side)
ⓘ
// In kernel_main():
unsafe fn kernel_main(args: *const KernelArgs) -> ! {
let args = &*args;
// Validate magic number
assert_eq!(args.magic, STRAT9_BOOT_MAGIC);
// Validate ABI version
assert_eq!(args.abi_version, STRAT9_BOOT_ABI_VERSION);
// Use memory map to initialize buddy allocator
let mmap = core::slice::from_raw_parts(
args.memory_map_base as *const MemoryRegion,
args.memory_map_size as usize / core::mem::size_of::<MemoryRegion>(),
);
// Use ACPI RSDP to find ACPI tables
let rsdp = args.acpi_rsdp_base;
// Use framebuffer for early console
let fb_addr = args.framebuffer_addr;
let fb_w = args.framebuffer_width;
let fb_h = args.framebuffer_height;
}Structs§
- Kernel
Args - Bootloader-to-kernel handoff structure.
- Memory
Kind - Memory region type identifier.
- Memory
Region - Memory region descriptor for the bootloader memory map.
Constants§
- STRA
T9_ BOOT_ ABI_ VERSION - ABI version for the boot handoff structure.
- STRA
T9_ BOOT_ MAGIC - Magic number validating the boot handoff (
"ST9B"in ASCII).