From a32590ff8aa5e55f93919655a647917ea22095fa Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 16 Dec 2022 19:44:33 +0100 Subject: [PATCH] Call expect_value more --- kernel/src/memory/MemoryManager.cpp | 8 +++++--- kernel/src/memory/MemoryMap.cpp | 4 ++-- kernel/src/thread/Scheduler.cpp | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/kernel/src/memory/MemoryManager.cpp b/kernel/src/memory/MemoryManager.cpp index 8106a353..75db28db 100644 --- a/kernel/src/memory/MemoryManager.cpp +++ b/kernel/src/memory/MemoryManager.cpp @@ -105,10 +105,12 @@ namespace MemoryManager // there's no point in continuing. auto bitmap_pages = g_frame_bitmap.size_in_bytes() / ARCH_PAGE_SIZE; - auto virtual_bitmap_base = KernelVM::alloc_several_pages(bitmap_pages).release_value(); + auto virtual_bitmap_base = + KernelVM::alloc_several_pages(bitmap_pages) + .expect_value("Unable to allocate virtual memory for the physical frame bitmap, cannot continue"); map_frames_at(virtual_bitmap_base, (u64)g_frame_bitmap.location(), bitmap_pages, MMU::ReadWrite | MMU::NoExecute) - .release_value(); + .expect_value("Unable to map the physical frame bitmap to virtual memory, cannot continue"); g_frame_bitmap.initialize((void*)virtual_bitmap_base, g_frame_bitmap.size_in_bytes()); } @@ -292,7 +294,7 @@ namespace MemoryManager { auto rc = MMU::get_flags(address); if (rc.has_error()) return false; - if (rc.release_value() & MMU::ReadWrite) return true; + if (rc.value() & MMU::ReadWrite) return true; return false; } diff --git a/kernel/src/memory/MemoryMap.cpp b/kernel/src/memory/MemoryMap.cpp index f4917633..cf83a67a 100644 --- a/kernel/src/memory/MemoryMap.cpp +++ b/kernel/src/memory/MemoryMap.cpp @@ -63,7 +63,7 @@ MemoryMapEntry MemoryMapIterator::largest_free() } } - return at(largest_index).release_value(); + return at(largest_index).value(); } MemoryMapEntry MemoryMapIterator::highest() @@ -83,5 +83,5 @@ MemoryMapEntry MemoryMapIterator::highest() } } - return at(highest_index).release_value(); + return at(highest_index).value(); } \ No newline at end of file diff --git a/kernel/src/thread/Scheduler.cpp b/kernel/src/thread/Scheduler.cpp index e6267ea2..36f2692e 100644 --- a/kernel/src/thread/Scheduler.cpp +++ b/kernel/src/thread/Scheduler.cpp @@ -24,7 +24,8 @@ namespace Scheduler g_idle.ticks_left = 1; // Map some stack for the idle task - u64 idle_stack_vm = MemoryManager::alloc_for_kernel(1, MMU::NoExecute | MMU::ReadWrite).release_value(); + u64 idle_stack_vm = MemoryManager::alloc_for_kernel(1, MMU::NoExecute | MMU::ReadWrite) + .expect_value("Error while setting up the idle task, cannot continue"); Stack idle_stack{idle_stack_vm, ARCH_PAGE_SIZE}; g_idle.set_sp(idle_stack.top());