49#define FREE_PAGE_MAX (PAGE_SIZE / sizeof(pfn_t) - 1)
55typedef struct page_stack
size_t pfn_t
Page Frame Number type.
void pmm_free_pages(pfn_t *pfns, size_t count)
Free multiple pages of physical memory.
uint64_t pmm_alloc_pages(pfn_t *pfns, size_t count)
Allocate multiple pages of physical memory.
#define FREE_PAGE_MAX
Maximum number of free pages that can be stored in a free page.
size_t pmm_total_pages(void)
Get the total number of physical pages.
static void pmm_ref_dec(pfn_t pfn, size_t count)
Decrement the reference count of a physical region.
void pmm_free(pfn_t pfn)
Free a single page of physical memory.
uint64_t pmm_ref_inc(pfn_t pfn, size_t count)
Increment the reference count of a physical region.
pfn_t pmm_alloc(void)
Allocate a single page of physical memory.
size_t pmm_used_pages(void)
Get the number of used physical pages.
size_t pmm_avail_pages(void)
Get the number of available physical pages.
void pmm_free_region(pfn_t pfn, size_t count)
Free a contiguous region of physical memory.
pfn_t pmm_alloc_bitmap(size_t count, pfn_t maxPfn, pfn_t alignPfn)
Allocate a contiguous region of physical memory using the bitmap.
void pmm_init(void)
Read the boot info memory map and initialize the PMM.
#define PAGE_SIZE
The size of a memory page in bytes.
Stored in free pages to form a stack of free pages.