31#define _HEAP_ALIGNMENT 64
36#define _HEAP_HEADER_MAGIC 0xDEADBEEF
41#define _HEAP_LARGE_ALLOC_THRESHOLD (PAGE_SIZE * 4)
46#define _HEAP_NUM_BINS (_HEAP_LARGE_ALLOC_THRESHOLD / _HEAP_ALIGNMENT)
_heap_flags_t
Flags for heap blocks.
void _heap_acquire(void)
Acquire the heap lock.
void _heap_add_to_free_list(_heap_header_t *block)
Adds a block to the appropriate free list.
_heap_header_t * _heap_block_new(uint64_t minSize)
Directly maps a new heap block of at least minSize bytes.
void _heap_unmap_memory(void *addr, uint64_t size)
Unmaps previously mapped memory.
void _heap_init(void)
Initialize the heap.
void _heap_free(_heap_header_t *block)
Frees a previously allocated heap block.
void _heap_block_split(_heap_header_t *block, uint64_t size)
Splits a heap block into two blocks, the first of size bytes and the second with the remaining bytes.
void * _heap_map_memory(uint64_t size)
Directly maps memory of the given size.
_heap_header_t * _heap_alloc(uint64_t size)
Allocates a block of memory of given size.
list_t _heapList
A list of all blocks sorted by address.
void _heap_remove_from_free_list(_heap_header_t *block)
Removes a block from its free list.
void _heap_release(void)
Release the heap lock.
uint64_t _heap_get_bin_index(uint64_t size)
Get the bin index for a given size.
@ _HEAP_ALLOCATED
Block is allocated.
@ _HEAP_MAPPED
Block is not on the heap, but mapped directly, used for large allocations.
@ _HEAP_ZEROED
Block is zeroed.
A entry in a doubly linked list.