PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
pmm.h File Reference
#include <boot/boot_info.h>
#include <sys/proc.h>
Include dependency graph for pmm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  page_t
 Page metadata structure. More...
 
struct  page_stack_t
 Stored in free pages to form a stack of free pages. More...
 

Macros

#define FREE_PAGE_MAX   (PAGE_SIZE / sizeof(pfn_t) - 1)
 Maximum number of free pages that can be stored in a free page.
 

Functions

void pmm_init (void)
 Read the boot info memory map and initialize the PMM.
 
pfn_t pmm_alloc (void)
 Allocate a single page of physical memory.
 
uint64_t pmm_alloc_pages (pfn_t *pfns, size_t count)
 Allocate multiple pages 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_free (pfn_t pfn)
 Free a single page of physical memory.
 
void pmm_free_pages (pfn_t *pfns, size_t count)
 Free multiple pages of physical memory.
 
void pmm_free_region (pfn_t pfn, size_t count)
 Free a contiguous region of physical memory.
 
uint64_t pmm_ref_inc (pfn_t pfn, size_t count)
 Increment the reference count of a physical region.
 
static void pmm_ref_dec (pfn_t pfn, size_t count)
 Decrement the reference count of a physical region.
 
size_t pmm_total_pages (void)
 Get the total number of physical pages.
 
size_t pmm_avail_pages (void)
 Get the number of available physical pages.
 
size_t pmm_used_pages (void)
 Get the number of used physical pages.