A simple heap memory manager. More...
Go to the source code of this file.
Functions | |
heap_t * | heap_create (pagetable_t *pt, void *vaddr, uint64_t maxpages) |
Create a new heap from which to allocate virtual memory. More... | |
void | heap_destroy (heap_t *heap) |
Destroy a heap, returning its memory to page table. More... | |
void * | heap_alloc (heap_t *heap, uint64_t size) |
Allocate memory from a heap. More... | |
void | heap_free (heap_t *heap, void *ptr) |
Free memory previously allocated with heap_alloc. More... | |
A simple heap memory manager.
Definition in file heap.h.
heap_t* heap_create | ( | pagetable_t * | pt, |
void * | vaddr, | ||
uint64_t | maxpages | ||
) |
Create a new heap from which to allocate virtual memory.
[in] | pt | The page table from which virtual memory is to be allocated. |
[in] | vaddr | The virtual address of the first byte to use for the heap. |
[in] | maxpages | The maximum number of pages that the heap will grow to fill. |
Definition at line 61 of file heap.c.
Referenced by cmd_test_heap().
void heap_destroy | ( | heap_t * | heap | ) |
Destroy a heap, returning its memory to page table.
[in] | heap | The heap to be destroyed. |
Definition at line 90 of file heap.c.
Referenced by cmd_test_heap().
void* heap_alloc | ( | heap_t * | heap, |
uint64_t | size | ||
) |
Allocate memory from a heap.
[in] | heap | The heap from which to allocate the memory. |
[in] | size | The size, in bytes, of the allocation. |
Definition at line 239 of file heap.c.
Referenced by cmd_test_heap().
void heap_free | ( | heap_t * | heap, |
void * | ptr | ||
) |
Free memory previously allocated with heap_alloc.
[in] | heap | The heap from which the memory was allocated. |
[in] | ptr | A pointer to the memory that was allocated. |
Definition at line 319 of file heap.c.
Referenced by cmd_test_heap().