diff options
| -rw-r--r-- | arch/x86_64/kapi/memory.cpp | 12 | ||||
| -rw-r--r-- | kapi/include/kapi/memory/buffered_allocator.hpp (renamed from arch/x86_64/include/arch/memory/buffered_allocator.hpp) | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/arch/x86_64/kapi/memory.cpp b/arch/x86_64/kapi/memory.cpp index e366ee1..b71fa17 100644 --- a/arch/x86_64/kapi/memory.cpp +++ b/arch/x86_64/kapi/memory.cpp @@ -1,12 +1,12 @@ #include "kapi/memory.hpp" #include "kapi/boot.hpp" +#include "kapi/memory/buffered_allocator.hpp" #include "kapi/system.hpp" #include "arch/boot/boot.hpp" #include "arch/boot/ld.hpp" #include "arch/cpu/registers.hpp" -#include "arch/memory/buffered_allocator.hpp" #include "arch/memory/kernel_mapper.hpp" #include "arch/memory/mmu.hpp" #include "arch/memory/page_table.hpp" @@ -151,7 +151,7 @@ namespace kapi::memory } auto constinit region_based_allocator = std::optional<arch::memory::region_allocator>{}; - auto constinit buffered_allocator = std::optional<arch::memory::buffered_allocator<4>>{}; + auto constinit allocation_buffer = std::optional<buffered_allocator<4>>{}; auto constinit recursive_page_mapper = std::optional<arch::memory::recursive_page_mapper>{}; } // namespace @@ -170,12 +170,12 @@ namespace kapi::memory enable_cpu_protections(); region_based_allocator.emplace(collect_memory_information()); - buffered_allocator.emplace(&*region_based_allocator); - recursive_page_mapper.emplace(*buffered_allocator); + allocation_buffer.emplace(&*region_based_allocator); + recursive_page_mapper.emplace(*allocation_buffer); kstd::println("[x86_64:MEM] Preparing new paging hierarchy."); - auto new_pml4_frame = inject_faux_pml4(*buffered_allocator, *recursive_page_mapper); + auto new_pml4_frame = inject_faux_pml4(*allocation_buffer, *recursive_page_mapper); remap_kernel(*recursive_page_mapper); remap_vga_text_mode_buffer(*recursive_page_mapper); @@ -187,7 +187,7 @@ namespace kapi::memory cr3.frame(new_pml4_frame); arch::cpu::cr3::write(cr3); - set_frame_allocator(*buffered_allocator); + set_frame_allocator(*allocation_buffer); set_page_mapper(*recursive_page_mapper); } diff --git a/arch/x86_64/include/arch/memory/buffered_allocator.hpp b/kapi/include/kapi/memory/buffered_allocator.hpp index 87ebbf6..49137c6 100644 --- a/arch/x86_64/include/arch/memory/buffered_allocator.hpp +++ b/kapi/include/kapi/memory/buffered_allocator.hpp @@ -1,5 +1,5 @@ -#ifndef TEACHOS_X86_64_BUFFERED_ALLOCATOR_HPP -#define TEACHOS_X86_64_BUFFERED_ALLOCATOR_HPP +#ifndef TEACHOS_KAPI_BUFFERED_ALLOCATOR_HPP +#define TEACHOS_KAPI_BUFFERED_ALLOCATOR_HPP #include "kapi/memory.hpp" #include "kapi/system.hpp" @@ -10,11 +10,11 @@ #include <optional> #include <utility> -namespace arch::memory +namespace kapi::memory { template<std::size_t BufferSize> - struct buffered_allocator : kapi::memory::frame_allocator + struct buffered_allocator : frame_allocator { explicit buffered_allocator(frame_allocator * underlying) : m_underlying{underlying} @@ -23,7 +23,7 @@ namespace arch::memory auto from_underlying = m_underlying->allocate_many(BufferSize); if (!from_underlying) { - kapi::system::panic("[x86_64:MEM] Not enough frames available from underlying allocator."); + kapi::system::panic("[OS] Not enough frames available from underlying allocator."); } auto [first_frame, count] = *from_underlying; std::ranges::generate_n(m_pool.begin(), count, [first_frame]() mutable { return first_frame++; }); @@ -133,6 +133,6 @@ namespace arch::memory std::array<std::optional<kapi::memory::frame>, BufferSize> m_pool{}; }; -} // namespace arch::memory +} // namespace kapi::memory #endif
\ No newline at end of file |
