Function multiboot2::load_with_offset
source · [−]pub unsafe fn load_with_offset(
address: usize,
offset: usize
) -> Result<BootInformation, MbiLoadError>
Expand description
Load the multiboot boot information struct from an address at an offset.
Example
ⓘ
use multiboot2::load_with_offset;
let ptr = 0xDEADBEEF as *const u32;
let boot_info = unsafe { load_with_offset(ptr as usize, 0xCAFEBABE).unwrap() };
println!("{:?}", boot_info);
Safety
address
must be valid for reading. Otherwise this function might terminate the program. This can be the case in environments with standard environment (segfault) but also in UEFI-applications, where the referenced memory is not (identity) mapped (UEFI does only identity mapping).- The memory at
address
must not be modified after callingload
or the program may observe unsychronized mutation.