[−][src]Function stivale::load
pub unsafe fn load(address: usize) -> StivaleStructure
Load the stivale2 structure from an address
The structure pointer is passed in the EDI register
Safety
This function will cause undefined behavior when a non-stivale2 compliant bootloader boots the kernel
This can be avoided by creating a custom entry point that's not the ELF entry point, and setting that in the stivale2 header
Examples
ⓘThis example is not tested
let mut stivale_struct_ptr: u64 = 0; unsafe { asm!("mov $2, %rdi" : "=r"(stivale_struct_ptr)) }; let stivale_struct = unsafe { stivale::load(stivale_struct_ptr as usize) };
ⓘThis example is not tested
fn kernel_main(stivale_struct_ptr: usize) { let stivale_struct = unsafe { stivale::load(stivale_struct_ptr) }; }