aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/memory/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/src/memory/main.cpp')
-rw-r--r--arch/x86_64/src/memory/main.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/x86_64/src/memory/main.cpp b/arch/x86_64/src/memory/main.cpp
index 5e671ac..2746a71 100644
--- a/arch/x86_64/src/memory/main.cpp
+++ b/arch/x86_64/src/memory/main.cpp
@@ -18,22 +18,23 @@ namespace teachos::arch::memory
static std::optional<allocator::area_frame_allocator> frame_allocator;
auto create_frame_allocator(multiboot::memory_information const & memory_information)
- -> allocator::area_frame_allocator
+ -> allocator::area_frame_allocator &
{
frame_allocator.emplace(memory_information);
return frame_allocator.value();
}
- auto get_frame_allocator() -> allocator::area_frame_allocator
+ auto get_frame_allocator() -> allocator::area_frame_allocator &
{
- exception_handling::assert(frame_allocator.has_value(), "[Memory main] Frame allocator has not been created yet");
+ exception_handling::assert(frame_allocator.has_value(),
+ "[Initialization] Frame allocator has not been created yet");
return frame_allocator.value();
}
} // namespace
auto remap_heap(std::size_t heap_start, std::size_t heap_size, paging::entry::bitset additional_flags = {}) -> void
{
- auto allocator = get_frame_allocator();
+ decltype(auto) allocator = get_frame_allocator();
decltype(auto) active_table = paging::active_page_table::create_or_get();
auto const start_page = paging::virtual_page::containing_address(heap_start);
auto const end_page = ++(paging::virtual_page::containing_address(heap_start + heap_size - 1));
@@ -59,7 +60,7 @@ namespace teachos::arch::memory
has_been_called = true;
auto const memory_information = multiboot::read_multiboot2();
- auto allocator = create_frame_allocator(memory_information);
+ decltype(auto) allocator = create_frame_allocator(memory_information);
kernel::cpu::set_cr0_bit(kernel::cpu::cr0_flags::WRITE_PROTECT);
kernel::cpu::set_efer_bit(kernel::cpu::efer_flags::NXE);