docs: documented the heap

This commit is contained in:
antifallobst 2023-02-12 13:46:52 +01:00
parent 45118fddc8
commit cd8704eabc
1 changed files with 31 additions and 0 deletions

View File

@ -240,6 +240,37 @@ More information can be found on the limine project's [GitHub](https://github.co
## mm
### heap.h
#### `heap_segment_T` - struct
This is the header for each heap segment.
It holds its status information and a pointer to the next and previous segments.
It lies in memory, directly before the accessible buffer of the segment.
#### `heap_T` - struct
This struct describes a heap.
The area between **_start_** and **_end_** is filled with heap segments.
#### `heap_create(base)` - function (void)
Creates a heap starting at **_base_** (virtual address).
It will automatically map some page frames to that address.
#### `heap_memory_allocate(heap*, size)` - function (void)
Returns a pointer to a free usable memory location, that has at least the given **_size_**.
It will return `NULL` and log an error, if the heap is corrupted.
Because this function iterates over the complete heap to find a free segment, it is slow.
#### `heap_memory_free(heap*, address)` - function (void)
Frees a with `heap_memory_allocate` created heap segment, and makes it usable again.
Does nothing, if the address doesn't point to a valid heap segment.
#### `heap_dump_segments(heap*)` - function (void)
Logs a complete list, of all heap segments.
Useful, when debugging / testing the heap.
#### `heap_destruct(heap*)` - function (void)
Invalidates all segments of a heap, frees all used page frames and unmaps them.
### memory_map.h
#### `memory_map_get_total_memory_size(boot_info*)` - function (uint64_t)