From 24805678884bcfcc3f14e88757955ab574d647cb Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Sun, 24 Nov 2024 13:18:31 +0000 Subject: add doxygen comments to remapping --- arch/x86_64/include/arch/memory/heap/allocator.hpp | 16 +++++++++++++++- arch/x86_64/include/arch/memory/main.hpp | 4 +++- arch/x86_64/src/memory/heap/allocator.cpp | 6 +++--- 3 files changed, 21 insertions(+), 5 deletions(-) (limited to 'arch/x86_64') diff --git a/arch/x86_64/include/arch/memory/heap/allocator.hpp b/arch/x86_64/include/arch/memory/heap/allocator.hpp index c486a4c..6f7535e 100644 --- a/arch/x86_64/include/arch/memory/heap/allocator.hpp +++ b/arch/x86_64/include/arch/memory/heap/allocator.hpp @@ -8,6 +8,9 @@ namespace teachos::arch::memory::heap std::size_t constexpr HEAP_START = 0x4000'0000; std::size_t constexpr HEAP_SIZE = 100 * 1024; + /** + * @brief Simple heap allocator + */ struct bump_allocator { bump_allocator(std::size_t heap_start, std::size_t heap_end) @@ -17,9 +20,20 @@ namespace teachos::arch::memory::heap { } + /** + * @brief Allocates the specified amount of memory in the heap + * + * @param size Amount of memory to allocate + * @return Address of the allocated memory + */ auto allocate(std::size_t size) -> void *; - auto deallocate(uint8_t * pointer, std::size_t size) -> void; + /** + * @brief Deallocates heap memory at the specified location + * + * @param pointer Pointer to the location which should be deallocated + */ + auto deallocate(uint8_t * pointer) -> void; private: std::size_t heap_start; diff --git a/arch/x86_64/include/arch/memory/main.hpp b/arch/x86_64/include/arch/memory/main.hpp index e166285..bbf160b 100644 --- a/arch/x86_64/include/arch/memory/main.hpp +++ b/arch/x86_64/include/arch/memory/main.hpp @@ -4,8 +4,10 @@ namespace teachos::arch::memory { /** - * @brief + * @brief Initializes memory management * + * @note Enables the necessary register flags and remaps the kernel, + * elf_sections, vga_text and the heap. */ auto initialize_memory_management() -> void; } // namespace teachos::arch::memory diff --git a/arch/x86_64/src/memory/heap/allocator.cpp b/arch/x86_64/src/memory/heap/allocator.cpp index c9ddd78..bb61be4 100644 --- a/arch/x86_64/src/memory/heap/allocator.cpp +++ b/arch/x86_64/src/memory/heap/allocator.cpp @@ -17,10 +17,10 @@ namespace teachos::arch::memory::heap return reinterpret_cast(alloc_start); } - auto bump_allocator::deallocate(uint8_t * pointer, std::size_t size) -> void + auto bump_allocator::deallocate(uint8_t * pointer) -> void { - // Memory leak - if (pointer || size) + // Not implemented; leaking memory + if (pointer) { } } -- cgit v1.2.3