aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
authorFabian Imhof <fabian.imhof@ost.ch>2024-12-01 11:08:00 +0000
committerFabian Imhof <fabian.imhof@ost.ch>2024-12-01 11:08:00 +0000
commiteba6c94eed15b90ea8a09e4bc16ae1c0f1645dea (patch)
tree4d2902ad7d7449d31c0e964affde0a1667cb80c5 /arch/x86_64/include
parent318fbff1717b291c81db8f9c4d5a84019fe2b4b9 (diff)
downloadteachos-eba6c94eed15b90ea8a09e4bc16ae1c0f1645dea.tar.xz
teachos-eba6c94eed15b90ea8a09e4bc16ae1c0f1645dea.zip
implement first half of linked list dallocation
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/arch/memory/heap/bump_allocator.hpp2
-rw-r--r--arch/x86_64/include/arch/memory/heap/linked_list_allocator.hpp12
-rw-r--r--arch/x86_64/include/arch/memory/heap/memory_block.hpp (renamed from arch/x86_64/include/arch/memory/heap/memory_hole.hpp)12
3 files changed, 13 insertions, 13 deletions
diff --git a/arch/x86_64/include/arch/memory/heap/bump_allocator.hpp b/arch/x86_64/include/arch/memory/heap/bump_allocator.hpp
index 595eeea..545b72f 100644
--- a/arch/x86_64/include/arch/memory/heap/bump_allocator.hpp
+++ b/arch/x86_64/include/arch/memory/heap/bump_allocator.hpp
@@ -42,7 +42,7 @@ namespace teachos::arch::memory::heap
* @param pointer Pointer to the location which should be deallocated.
* @param size Size of the underlying memory area we want to deallocate.
*/
- auto deallocate(uint8_t * pointer, std::size_t size) -> void;
+ auto deallocate(void * pointer, std::size_t size) -> void;
private:
std::size_t heap_start; ///< Start of the allocatable heap area
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 5f9a72b..99d0013 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
@@ -1,7 +1,7 @@
#ifndef TEACHOS_ARCH_X86_64_MEMORY_HEAP_LINKED_LIST_ALLOCATOR_HPP
#define TEACHOS_ARCH_X86_64_MEMORY_HEAP_LINKED_LIST_ALLOCATOR_HPP
-#include "arch/memory/heap/memory_hole.hpp"
+#include "arch/memory/heap/memory_block.hpp"
#include <cstdint>
@@ -37,7 +37,7 @@ namespace teachos::arch::memory::heap
* @param pointer Pointer to the location which should be deallocated.
* @param size Size of the underlying memory area we want to deallocate.
*/
- auto deallocate(uint8_t * pointer, std::size_t size) -> void;
+ auto deallocate(void * pointer, std::size_t size) -> void;
private:
/**
@@ -45,22 +45,22 @@ namespace teachos::arch::memory::heap
*
* @return Smallest allocatable block of heap memory.
*/
- auto constexpr min_allocatable_size() -> std::size_t { return sizeof(memory_hole); }
+ auto constexpr min_allocatable_size() -> std::size_t { return sizeof(memory_block); }
/**
* @brief Splits the given hole into two, where the latter block keeps beeing free and the first part will be used
* for the allocation.
*
- * @param current_hole Hole we want to split.
+ * @param current_block Hole we want to split.
* @param size Size we want to allocate at the start of the hole.
*
* @return Address of the hole we just split.
*/
- auto split_hole(memory_hole *& current_hole, std::size_t size) -> void *;
+ auto split_free_memory_block(memory_block *& current_block, std::size_t size) -> void *;
std::size_t heap_start; ///< Start of the allocatable heap area
std::size_t heap_end; ///< End of the allocatable heap area
- memory_hole * first; ///< First free entry in our memory
+ memory_block * first; ///< First free entry in our memory
};
} // namespace teachos::arch::memory::heap
diff --git a/arch/x86_64/include/arch/memory/heap/memory_hole.hpp b/arch/x86_64/include/arch/memory/heap/memory_block.hpp
index e017599..c48d0cd 100644
--- a/arch/x86_64/include/arch/memory/heap/memory_hole.hpp
+++ b/arch/x86_64/include/arch/memory/heap/memory_block.hpp
@@ -1,5 +1,5 @@
-#ifndef TEACHOS_ARCH_X86_64_MEMORY_HEAP_MEMORY_HOLE_HPP
-#define TEACHOS_ARCH_X86_64_MEMORY_HEAP_MEMORY_HOLE_HPP
+#ifndef TEACHOS_ARCH_X86_64_MEMORY_HEAP_MEMORY_BLOCK_HPP
+#define TEACHOS_ARCH_X86_64_MEMORY_HEAP_MEMORY_BLOCK_HPP
#include <cstdint>
@@ -9,7 +9,7 @@ namespace teachos::arch::memory::heap
* @brief Block containing free memory, pointing to the next free hole (nullptr) if there is none.
* Forms a single linked list.
*/
- struct memory_hole
+ struct memory_block
{
/**
* @brief Constructor,
@@ -17,12 +17,12 @@ namespace teachos::arch::memory::heap
* @param size Amount of free memory of this specific hole.
* @param next Optional pointer to the next free memory.
*/
- memory_hole(std::size_t size, memory_hole * next);
+ memory_block(std::size_t size, memory_block * next);
std::size_t size; ///< Amount of free memory this hole contains, has to always be atleast 16 bytes to hold the size
///< variable and the pointer to the next hole.
- memory_hole * next; ///< Optional pointer to the next free memory, holds nullptr if there is none.
+ memory_block * next; ///< Optional pointer to the next free memory, holds nullptr if there is none.
};
} // namespace teachos::arch::memory::heap
-#endif // TEACHOS_ARCH_X86_64_MEMORY_HEAP_MEMORY_HOLE_HPP
+#endif // TEACHOS_ARCH_X86_64_MEMORY_HEAP_MEMORY_BLOCK_HPP