diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2025-02-20 12:14:30 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2025-02-20 12:14:30 +0000 |
| commit | 27874721a35fe7ccde843c7ab88ab72e74fe6b42 (patch) | |
| tree | c2156c2ec52e181643ab90ae9ac501c9d83eb96c /arch/x86_64/include | |
| parent | cd502936227e48a36d9e933d26aac2ee29d3bc29 (diff) | |
| download | teachos-27874721a35fe7ccde843c7ab88ab72e74fe6b42.tar.xz teachos-27874721a35fe7ccde843c7ab88ab72e74fe6b42.zip | |
Make allocation type configurable
Diffstat (limited to 'arch/x86_64/include')
| -rw-r--r-- | arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp b/arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp index f391936..a4ece57 100644 --- a/arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp +++ b/arch/x86_64/include/arch/memory/heap/global_heap_allocator.hpp @@ -5,6 +5,13 @@ namespace teachos::arch::memory::heap { + enum class heap_allocator_type : uint8_t + { + NONE, + BUMP, + LINKED_LIST + }; + struct global_heap_allocator { static auto allocate(std::size_t size) -> void *; @@ -12,7 +19,11 @@ namespace teachos::arch::memory::heap static auto deallocate(void * pointer, std::size_t size) -> void; private: - static auto get_underlying_allocator() -> linked_list_allocator &; + static heap_allocator_type allocator_type; + + static auto register_heap_allocator_type(heap_allocator_type new_type) -> void; + + static auto create_or_get() -> linked_list_allocator &; }; } // namespace teachos::arch::memory::heap |
