GitOS
Operating system exercise
|
Functions | |
void | heap_mark_blocks_taken (heap *heap, int start_block, int total_blocks) |
Marks blocks taken. | |
int | heap_create (heap *heap, heap_table *table, void *ptr, void *end) |
Creates heap in specified chunk of memory. | |
void * | heap_malloc (heap *heap, uint32_t size) |
Allocates memory in heap. | |
void | heap_free (heap *heap, void *ptr) |
Frees specified pointer in heap. | |
int heap_create | ( | heap * | heap, |
heap_table * | table, | ||
void * | ptr, | ||
void * | end | ||
) |
Creates heap in specified chunk of memory.
heap | Heap to manage |
table | Heap table to manage |
ptr | Starting address |
end | Ending address |
References EINVARG, heap_table::entries, HEAP_BLOCK_TABLE_ENTRY_FREE, memset(), heap::start_address, heap::table, and heap_table::total.
void heap_free | ( | heap * | heap, |
void * | ptr | ||
) |
Frees specified pointer in heap.
heap | Heap to manage |
ptr | Pointer to free |
void * heap_malloc | ( | heap * | heap, |
uint32_t | size | ||
) |
Allocates memory in heap.
heap | Heap to manage |
size | Requested allocation size |
References HEAP_BLOCK_SIZE, and size.
void heap_mark_blocks_taken | ( | heap * | heap, |
int | start_block, | ||
int | total_blocks | ||
) |
Marks blocks taken.
heap | Heap to manage |
start_block | Starting block to mark taken |
total_blocks | Total amount of blocks to mark taken |
References heap_table::entries, HEAP_BLOCK_HAS_NEXT, HEAP_BLOCK_TABLE_ENTRY_TAKEN, and heap::table.