aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/memory')
-rw-r--r--arch/x86_64/src/memory/heap/linked_list_allocator.cpp16
-rw-r--r--arch/x86_64/src/memory/heap/memory_hole.cpp11
2 files changed, 27 insertions, 0 deletions
diff --git a/arch/x86_64/src/memory/heap/linked_list_allocator.cpp b/arch/x86_64/src/memory/heap/linked_list_allocator.cpp
new file mode 100644
index 0000000..b0f011b
--- /dev/null
+++ b/arch/x86_64/src/memory/heap/linked_list_allocator.cpp
@@ -0,0 +1,16 @@
+#include "arch/memory/heap/linked_list_allocator.hpp"
+
+#include "arch/exception_handling/assert.hpp"
+
+namespace teachos::arch::memory::heap
+{
+ linked_list_allocator::linked_list_allocator(std::size_t heap_start, std::size_t heap_end)
+ : heap_start(heap_start)
+ , heap_end(heap_end)
+ , first(heap_end - heap_start, nullptr)
+ {
+ exception_handling::assert(heap_end - heap_start < min_allocatable_size(),
+ "[Memory Hole List] Total heap size can not be smaller than minimum of 16 bytes to hold "
+ "atleast one memory hole entry");
+ }
+} // namespace teachos::arch::memory::heap
diff --git a/arch/x86_64/src/memory/heap/memory_hole.cpp b/arch/x86_64/src/memory/heap/memory_hole.cpp
new file mode 100644
index 0000000..7590610
--- /dev/null
+++ b/arch/x86_64/src/memory/heap/memory_hole.cpp
@@ -0,0 +1,11 @@
+#include "arch/memory/heap/memory_hole.hpp"
+
+namespace teachos::arch::memory::heap
+{
+ memory_hole::memory_hole(std::size_t size, memory_hole * next)
+ : size(size)
+ , next(next)
+ {
+ // Nothing to do
+ }
+} // namespace teachos::arch::memory::heap