morpheus_bootloader/boot/
handoff.rsuse super::{KernelImage, LinuxBootParams};
#[cfg(target_arch = "x86_64")]
use super::arch::x86_64::handoff::BootPath;
pub enum HandoffError {
ExitBootServicesFailed,
InvalidKernel,
}
pub unsafe fn boot_kernel(
kernel: &KernelImage,
boot_params: *mut LinuxBootParams,
system_table: *mut (),
image_handle: *mut (),
kernel_loaded_addr: *mut u8,
) -> ! {
#[cfg(target_arch = "x86_64")]
{
let handover_offset = if kernel.supports_efi_handover_64() {
Some(kernel.handover_offset())
} else {
None
};
let startup_64 = kernel_loaded_addr as u64;
let protected_mode_entry = kernel.code32_start();
let in_long_mode = true;
let boot_path = BootPath::choose(
handover_offset,
startup_64,
protected_mode_entry,
in_long_mode,
);
boot_path.execute(boot_params as u64, image_handle, system_table)
}
#[cfg(not(target_arch = "x86_64"))]
{
panic!("Unsupported architecture for kernel boot");
}
}