|
PatchworkOS
19e446b
A non-POSIX operating system.
|
#include "heap.h"#include <string.h>#include <sys/bitmap.h>#include <sys/fs.h>#include <sys/math.h>#include <sys/proc.h>#include <stdlib.h>#include <threads.h>Go to the source code of this file.
Functions | |
| void * | _heap_map_memory (uint64_t size) |
| Directly maps memory of the given size. | |
| void | _heap_unmap_memory (void *addr, uint64_t size) |
| Unmaps previously mapped memory. | |
| static | BITMAP_CREATE_ZERO (freeBitmap, _HEAP_NUM_BINS) |
| void | _heap_init (void) |
| Initialize the heap. | |
| uint64_t | _heap_get_bin_index (uint64_t size) |
| Get the bin index for a given size. | |
| _heap_header_t * | _heap_block_new (uint64_t minSize) |
Directly maps a new heap block of at least minSize bytes. | |
| void | _heap_block_split (_heap_header_t *block, uint64_t newSize) |
Splits a heap block into two blocks, the first of size bytes and the second with the remaining bytes. | |
| void | _heap_add_to_free_list (_heap_header_t *block) |
| Adds a block to the appropriate free list. | |
| void | _heap_remove_from_free_list (_heap_header_t *block) |
| Removes a block from its free list. | |
| _heap_header_t * | _heap_alloc (uint64_t size) |
| Allocates a block of memory of given size. | |
| void | _heap_free (_heap_header_t *block) |
| Frees a previously allocated heap block. | |
Variables | |
| mtx_t | _heapLock |
| static fd_t | zeroDev = ERR |
| static list_t | freeLists [_HEAP_NUM_BINS] = {0} |
| list_t | _heapList = LIST_CREATE(_heapList) |
| A list of all blocks sorted by address. | |
|
static |
|
static |