Crate page_allocator

source ·
Expand description

Provides an allocator for virtual memory pages. The minimum unit of allocation is a single page.

This also supports early allocation of pages (up to 32 separate chunks) before heap allocation is available, and does so behind the scenes using the same single interface.

Once heap allocation is available, it uses a dynamically-allocated list of page chunks to track allocations.

The core allocation function is allocate_pages_deferred(), but there are several convenience functions that offer simpler interfaces for general usage.

Notes

This allocator only makes one attempt to merge deallocated pages into existing free chunks for de-fragmentation. It does not iteratively merge adjacent chunks in order to maximally combine separate chunks into the biggest single chunk. Instead, free chunks are lazily merged only when running out of address space or when needed to fulfill a specific request.

Structs

  • Represents a range of allocated VirtualAddresses, specified in Pages.
  • A series of pending actions related to page allocator bookkeeping, which may result in heap allocation.

Enums

Functions

  • Allocates the given number of pages with no constraints on the starting virtual address.
  • Allocates the given number of pages starting at (inclusive of) the page containing the given VirtualAddress.
  • Allocates pages with no constraints on the starting virtual address, with a size given by the number of bytes.
  • Allocates pages starting at the given VirtualAddress with a size given in number of bytes.
  • Similar to allocated_pages_deferred(), but accepts a size value for the allocated pages in number of bytes instead of number of pages.
  • Allocates pages with a size given in number of bytes with the constraint that they must be within the given inclusive range of pages.
  • The core page allocation routine that allocates the given number of virtual pages, optionally at the requested starting VirtualAddress.
  • Allocates the given number of pages with the constraint that they must be within the given inclusive range of pages.
  • Initialize the page allocator.