From ef156dd6430855434b54275b22cd43ee3cedcfdc Mon Sep 17 00:00:00 2001 From: Fabian Imhof Date: Sun, 11 May 2025 09:29:56 +0000 Subject: make frame_allocator and active_page_table statically available --- .../include/arch/memory/allocator/area_frame_allocator.hpp | 4 ++-- arch/x86_64/include/arch/memory/main.hpp | 14 ++++++++++++++ arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp | 3 +-- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'arch/x86_64/include') diff --git a/arch/x86_64/include/arch/memory/allocator/area_frame_allocator.hpp b/arch/x86_64/include/arch/memory/allocator/area_frame_allocator.hpp index 2244613..6cb5f56 100644 --- a/arch/x86_64/include/arch/memory/allocator/area_frame_allocator.hpp +++ b/arch/x86_64/include/arch/memory/allocator/area_frame_allocator.hpp @@ -15,9 +15,9 @@ namespace teachos::arch::memory::allocator struct area_frame_allocator { /** - * @brief Constructor + * @brief Constructor. * - * @param mem_info Structure containg all relevant information to map and allocate memory + * @param mem_info Structure containg all relevant information to map and allocate memory. */ area_frame_allocator(multiboot::memory_information const & mem_info); diff --git a/arch/x86_64/include/arch/memory/main.hpp b/arch/x86_64/include/arch/memory/main.hpp index 164abbc..d51815f 100644 --- a/arch/x86_64/include/arch/memory/main.hpp +++ b/arch/x86_64/include/arch/memory/main.hpp @@ -1,8 +1,22 @@ #ifndef TEACHOS_ARCH_X86_64_MEMORY_MAIN_HPP #define TEACHOS_ARCH_X86_64_MEMORY_MAIN_HPP +#include "arch/memory/paging/page_entry.hpp" + +#include + namespace teachos::arch::memory { + + /** + * @brief Maps a heap section to a page. + * + * @param heap_start Start-address of the heap. + * @param heap_size Size of the heap. + * @param additional_flags Additional flags to apply to the page entry. + */ + auto remap_heap(std::size_t heap_start, std::size_t heap_size, paging::entry::bitset additional_flags) -> void; + /** * @brief Initializes memory management. * diff --git a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp index 7321548..756eeb1 100644 --- a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp +++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp @@ -38,7 +38,7 @@ namespace teachos::arch::memory::paging * inactive page table, that is not used by the CPU to ensure we are not changign memory that we are using. Because * remapping active kernel memory in the kernel wouldn't work. */ - auto remap_kernel() -> active_page_table & + auto remap_kernel() -> void { // Set Page Global Enable bit auto cr4 = kernel::cpu::read_control_register(kernel::cpu::control_register::CR4); @@ -57,7 +57,6 @@ namespace teachos::arch::memory::paging auto const old_level_4_page = virtual_page::containing_address(old_table.page_table_level_4_frame.start_address()); active_table.unmap_page(allocator, old_level_4_page); - return active_table; } private: -- cgit v1.2.3