Skip to main content

map_page_kernel

Function map_page_kernel 

Source
pub fn map_page_kernel(
    page: Page<Size4KiB>,
    frame: PhysFrame<Size4KiB>,
    flags: PageTableFlags,
) -> Result<(), &'static str>
Expand description

Map a page into the kernel’s canonical page tables (not the active CR3).

This ensures that the mapping is visible from all address spaces, because every user address space clones the kernel half (PML4[256..512]) from the kernel’s L4 table at creation time.

Used by vmalloc so that heap allocations are kernel-global. Intermediate page tables are allocated from the buddy allocator as needed.