switch_to_kernel

Function switch_to_kernel 

Source
pub(crate) unsafe fn switch_to_kernel(
    pml4_phys: PhysicalAddress,
    kernel_entry_va: VirtualAddress,
    boot_info_ptr_va: VirtualAddress,
    tramp_stack_top_va: VirtualAddress,
) -> !
Expand description

Enter the kernel via a tiny trampoline.

  • new_cr3: phys addr of PML4 (4KiB aligned)
  • kernel_entry: higher-half VA (your extern "win64" fn(*const BootInfo) -> !)
  • boot_info: higher-half VA (or low VA if you pass identity-mapped pointer)
  • tramp_stack_top: VA of the top of the trampoline stack (identity-mapped in both maps)