|
PatchworkOS
966e257
A non-POSIX operating system.
|
A generic bitmap page allocator. More...
A generic bitmap page allocator.
The PMM bitmap provides a flexible allocator for more specific allocations, for example it can handle contiguous pages, specific alignments and allocating below some specified address. This flexibility comes at the cost of performance, so the bitmap should only be used when necessary.
Data Structures | |
| struct | pmm_bitmap_t |
| Represents a bitmap allocator's state. More... | |
Functions | |
| void | pmm_bitmap_init (pmm_bitmap_t *bitmap, void *buffer, uint64_t size, uintptr_t maxAddr) |
| Initializes a PMM bitmap. | |
| void * | pmm_bitmap_alloc (pmm_bitmap_t *bitmap, uint64_t count, uintptr_t maxAddr, uint64_t alignment) |
| Allocates a contiguous region of pages from the bitmap. | |
| void | pmm_bitmap_free (pmm_bitmap_t *bitmap, void *address, uint64_t count) |
| Frees a region of pages, returning them to the bitmap. | |
| void pmm_bitmap_init | ( | pmm_bitmap_t * | bitmap, |
| void * | buffer, | ||
| uint64_t | size, | ||
| uintptr_t | maxAddr | ||
| ) |
Initializes a PMM bitmap.
| bitmap | The bitmap to initialize. |
| buffer | The buffer to use for the bitmap data. |
| size | The number of pages to manage. |
| maxAddr | The maximum address to manage. |
Definition at line 7 of file pmm_bitmap.c.
| void * pmm_bitmap_alloc | ( | pmm_bitmap_t * | bitmap, |
| uint64_t | count, | ||
| uintptr_t | maxAddr, | ||
| uint64_t | alignment | ||
| ) |
Allocates a contiguous region of pages from the bitmap.
| bitmap | The bitmap to allocate from. |
| count | The number of pages to allocate. |
| maxAddr | The maximum address for the allocation. |
| alignment | The required alignment for the allocation. |
NULL and errno is set. Definition at line 16 of file pmm_bitmap.c.
| void pmm_bitmap_free | ( | pmm_bitmap_t * | bitmap, |
| void * | address, | ||
| uint64_t | count | ||
| ) |
Frees a region of pages, returning them to the bitmap.
| bitmap | The bitmap to free to. |
| address | The address of the region to free. |
| count | The number of pages to free. |
Definition at line 32 of file pmm_bitmap.c.