|
PatchworkOS
966e257
A non-POSIX operating system.
|
A generic free stack page allocator. More...
A generic free stack page allocator.
The PMM stack provides a fast, O(1) allocator for single pages. It uses freed pages to store metadata about other free pages, forming a stack of page buffers.
Data Structures | |
| struct | page_buffer_t |
| Structure for a page buffer in the PMM stack. More... | |
| struct | pmm_stack_t |
| PMM stack structure for managing higher physical memory. More... | |
Macros | |
| #define | PMM_BUFFER_MAX ((PAGE_SIZE - sizeof(page_buffer_t)) / sizeof(void*)) |
The maximum number of pages that can be stored in a page_buffer_t. | |
Functions | |
| void | pmm_stack_init (pmm_stack_t *stack) |
| Initializes a PMM stack. | |
| void * | pmm_stack_alloc (pmm_stack_t *stack) |
| Allocates a single page from the stack. | |
| void | pmm_stack_free (pmm_stack_t *stack, void *address) |
| Frees a single page, returning it to the stack. | |
| #define PMM_BUFFER_MAX ((PAGE_SIZE - sizeof(page_buffer_t)) / sizeof(void*)) |
The maximum number of pages that can be stored in a page_buffer_t.
Definition at line 36 of file pmm_stack.h.
| void pmm_stack_init | ( | pmm_stack_t * | stack | ) |
Initializes a PMM stack.
| stack | The stack to initialize. |
Definition at line 5 of file pmm_stack.c.
| void * pmm_stack_alloc | ( | pmm_stack_t * | stack | ) |
Allocates a single page from the stack.
| stack | The stack to allocate from. |
NULL and errno is set. Definition at line 12 of file pmm_stack.c.
| void pmm_stack_free | ( | pmm_stack_t * | stack, |
| void * | address | ||
| ) |
Frees a single page, returning it to the stack.
| stack | The stack to free to. |
| address | The address of the page to free. |
Definition at line 36 of file pmm_stack.c.