_start_kernel

Function _start_kernel 

Source
#[unsafe(no_mangle)]
pub extern "C" fn _start_kernel(_boot_info: *const KernelBootInfo)
Expand description

The kernel entry point

§UEFI Interaction

The UEFI loader will jump here after ExitBootServices.

§ABI

The ABI is defined as sysv64 (Rust’s extern "C"), so the kernel is called with the boot_info pointer in RDI (System V AMD64 ABI, as on Linux/x86_64).

§Naked function & Stack

This is a naked function in order to set up the stack ourselves. Without the naked attribute (and the naked_asm instruction), Rust compiler would apply its own assumptions based on the C ABI and would attempt to unwind the stack on the call into kernel_entry. Since we’re clearing out the stack here, this would cause UB.