Function page_allocator::init

source ·
pub fn init(
    end_vaddr_of_low_designated_region: VirtualAddress
) -> Result<(), &'static str>
Expand description

Initialize the page allocator.

Arguments

  • end_vaddr_of_low_designated_region: the VirtualAddress that marks the end of the lower designated region, which should be the ending address of the initial kernel image (a lower-half identity address).

The page allocator considers two regions as “designated” regions. It will only allocate pages within these designated regions if the specifically-requested address falls within them.

  1. The lower designated region is for identity-mapped bootloader content and base kernel image sections, which is used during OS initialization.
  2. The higher designated region is for the same content, mapped to the higher half of the address space. It also excludes the address ranges for the P4 entries that Theseus uses for recursive page table mapping.
    • See [RECURSIVE_P4_INDEX] and [UPCOMING_PAGE_TABLE_RECURSIVE_P4_INDEX].

General allocation requests for pages at any virtual address will not use addresses within designated regions unless the entire address space is already in use, which is an extraordinarily unlikely (i.e., basically impossible) situation.