diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-12-02 10:17:36 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-12-02 10:17:36 +0000 |
| commit | a5e5eabd32872f81a7190589aa648dc0e1963888 (patch) | |
| tree | 63d91dc24a3caacbcfd736ec190579e33823a89f /arch/x86_64/include | |
| parent | f880939eb5f1b5e70b15d6614cc440c09a0d9fd1 (diff) | |
| download | teachos-a5e5eabd32872f81a7190589aa648dc0e1963888.tar.xz teachos-a5e5eabd32872f81a7190589aa648dc0e1963888.zip | |
Fix algorithm issues with linked list allocator
Diffstat (limited to 'arch/x86_64/include')
| -rw-r--r-- | arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp b/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp index 71e495a..e8ecc30 100644 --- a/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp +++ b/arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp @@ -49,12 +49,16 @@ namespace teachos::arch::memory::heap * @brief Splits the given free memory block into two, where the latter block keeps being free and the first part * will be used for the allocation. * - * @param current_block Free memory block we want to split. + * @param previous_block Free memory block before the block to allocate in our heap memory. Was to small to allocate + * the required size into. + * @param current_block Free memory block we want to split into a size part for the allocation and the rest for + * future allocations. * @param size Size we want to allocate at the start of the free memory block. * * @return Previous start address of the memory block we just split. */ - auto split_free_memory_block(memory_block *& current_block, std::size_t size) -> void *; + auto split_free_memory_block(memory_block * previous_block, memory_block * current_block, + std::size_t size) -> void *; /** * @brief Combines multiple free memory blocks into one if they are adjacent. @@ -76,7 +80,7 @@ namespace teachos::arch::memory::heap * @param pointer Block to deallocate. * @param size Size of the block we want to deallocate. */ - auto coalesce_free_memory_block(memory_block *& previous_block, memory_block *& current_block, void * pointer, + auto coalesce_free_memory_block(memory_block * previous_block, memory_block * current_block, void * pointer, std::size_t size) -> void; /** |
