Expand description
Boot-protocol entry point (DTB/PVH) Boot protocol entry point.
This module handles the kernel entry from the bootloader or PVH stub.
The bootloader passes a pointer to a strat9_abi::boot::KernelArgs structure.
PVH boot passes null : a minimal KernelArgs is built internally.
ยงBoot flow
boot64.S (_start)
=> save KernelArgs pointer, setup 8 KB bootstrap stack, clear BSS
=> call kmain(args_ptr)
=> enable SSE/OSXSAVE (CPU features)
=> early serial output
=> read KernelArgs from pointer (bootloader) or build_minimal_args (PVH)
=> call crate::kernel_main(args)
=> (buddy allocator init)
=> allocate 256 KB kernel stack
=> switch_stack(new_stack, continue_init)Constantsยง
- KERNEL_
STACK_ SIZE - Size of the real kernel stack allocated after buddy allocator init.
Staticsยง
- KERNEL_
ELF_ ๐BASE - Saved kernel ELF base address and size for symbol resolution during panic.
- KERNEL_
ELF_ ๐SIZE
Functionsยง
- build_
minimal_ ๐args - Build minimal KernelArgs for PVH boot (no DTB).
- early_
print ๐ โ - Very early serial output using raw COM1 port I/O. Safe to call before any kernel subsystem is initialized.
- early_
print_ ๐ โhex - Write a u64 as hex to COM1 (no alloc, no fmt traits).
- enable_
cpu_ ๐ โfeatures - Enable SSE (OSFXSR, OSXMMEXCPT) and FPU (NE) in CR0/CR4.
- hlt_
loop ๐ - Halt the CPU forever.
- kernel_
elf_ bytes - Get the kernel ELF bytes as a slice. Returns None if not yet initialized.
- kmainโ
- Kernel entry point called by the bootloader or PVH boot.