Skip to main content

Module paging

Module paging 

Source
Expand description

Virtual Memory Management (Paging) for Strat9-OS

Uses the x86_64 crate’s OffsetPageTable which is designed for the HHDM (Higher Half Direct Map) pattern : exactly what the UEFI bootloader provides.

Provides map/unmap/translate operations on the active page table.

Structs§

BuddyFrameAllocator
Wrapper around the buddy allocator implementing the x86_64 crate’s FrameAllocator trait.

Statics§

KERNEL_CR3 🔒
Physical address of the kernel’s level-4 page table (set at init, never changes).
KERNEL_PT_LOCK 🔒
Serializes mutations of the canonical kernel page tables.
PAGING_READY 🔒
Paging initialization flag.

Functions§

active_page_table
Read the current CR3 value (physical address of the active level-4 page table).
ensure_hhdm_range 🔒
ensure_identity_map
Ensure a physical address is identity-mapped in the HHDM region.
ensure_identity_map_range
Ensure a physical range is mapped in the HHDM region.
init
Initialize the paging subsystem.
is_hhdm_range_mapped_now
Returns whether the current page tables map the HHDM view of the whole range.
is_initialized
Returns whether initialized.
kernel_l4_phys
Return the physical address of the kernel’s level-4 page table.
map_all_ram
Map all RAM regions from the memory map into the HHDM.
map_page
Map a virtual page to a physical frame with the given flags.
map_page_kernel
Map a page into the kernel’s canonical page tables (not the active CR3).
retire_uefi_identity_code⚠
Revoke the loader’s temporary identity RX pages before starting allocators.
set_trampoline_execution
Change execution of just the existing 4 KiB identity trampoline page, preserving its cache selector. BSP enables it before SIPI and retires it after every AP has left it. APs invalidate their TLB at the boot barrier.
translate
Translate a virtual address to its mapped physical address.
translate_via_active_page_tables 🔒
uncached_hhdm_flags 🔒
unmap_page
Unmap a page from the active CR3, returning the physical frame.
unmap_page_kernel
Unmap a page from the kernel’s canonical page tables.