|
miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
|
#include <miniOS/types.h>

Go to the source code of this file.
Functions | |
| void | heap_init (void) |
| Maps the first heap page at HEAP_START via vmm_map_page() and writes the initial free-block boundary tag covering the entire heap region. Must be called exactly once during boot before any call to kmalloc(). Called by kernel_main() after vmm setup. | |
| void * | kmalloc (size_t size) |
| Uses a first-fit boundary-tag strategy. Acquires heap_lock (spinlock_irqsave) before scanning. Maps additional pages via vmm_map_page() if the current heap extent is exhausted (up to HEAP_MAX). | |
| void | kfree (void *ptr) |
| Marks the block free in its boundary tag and coalesces adjacent free blocks (forward and backward). Acquires heap_lock before modifying heap state. | |
| size_t | heap_free_bytes (void) |
| Walks the boundary-tag chain and sums the sizes of all free blocks. O(n) in the number of heap blocks. Intended for diagnostic/debug output only. | |