diff options
| -rw-r--r-- | arch/x86_64/kapi/memory.cpp | 4 | ||||
| -rw-r--r-- | kapi/include/kapi/memory.hpp | 3 | ||||
| -rw-r--r-- | kapi/include/kapi/memory/buffered_allocator.hpp | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86_64/kapi/memory.cpp b/arch/x86_64/kapi/memory.cpp index 5cbe65c..6bbfad3 100644 --- a/arch/x86_64/kapi/memory.cpp +++ b/arch/x86_64/kapi/memory.cpp @@ -239,6 +239,10 @@ namespace kapi::memory [](auto const & region) { return region.base + region.size_in_B; })); init_pmm(frame::containing(physical_address{highest_byte}).number() + 1, handoff_to_kernel_pmm); + + kstd::println("[x86_64:MEM] Releasing bootstrap memory allocators."); + allocation_buffer.reset(); + region_based_allocator.reset(); } } // namespace kapi::memory diff --git a/kapi/include/kapi/memory.hpp b/kapi/include/kapi/memory.hpp index 9ef2cd7..e31fa34 100644 --- a/kapi/include/kapi/memory.hpp +++ b/kapi/include/kapi/memory.hpp @@ -31,6 +31,9 @@ namespace kapi::memory //! This function initializes the kernel-wide physical memory manager. The function will invoke the handoff handler to //! transfer the platform-specific frame allocation state to the physical memory manager. //! + //! @note Once this function returns, the global allocator has been replaced by the platform-agnostic, kernel-defined + //! allocator. Any state of the platform specific allocator may be released. + //! //! @param frame_count The number of frames present in the system. //! @param handoff_handler A function to be invoked to transfer the platform-specific frame allocation state. The //! allocator to hand off to is passed to the handler. diff --git a/kapi/include/kapi/memory/buffered_allocator.hpp b/kapi/include/kapi/memory/buffered_allocator.hpp index 286c841..f9dc781 100644 --- a/kapi/include/kapi/memory/buffered_allocator.hpp +++ b/kapi/include/kapi/memory/buffered_allocator.hpp @@ -37,7 +37,7 @@ namespace kapi::memory std::ranges::for_each(m_pool, [this](auto const & maybe_frame) { if (maybe_frame) { - m_underlying->release_many({*maybe_frame, 1}); + m_underlying->release(*maybe_frame); } }); } |
