Call expect_value more

This commit is contained in:
apio 2022-12-16 19:44:33 +01:00
parent cedcfa9c63
commit a32590ff8a
Signed by: apio
GPG Key ID: B8A7D06E42258954
3 changed files with 9 additions and 6 deletions

View File

@ -105,10 +105,12 @@ namespace MemoryManager
// there's no point in continuing. // there's no point in continuing.
auto bitmap_pages = g_frame_bitmap.size_in_bytes() / ARCH_PAGE_SIZE; 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, map_frames_at(virtual_bitmap_base, (u64)g_frame_bitmap.location(), bitmap_pages,
MMU::ReadWrite | MMU::NoExecute) 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()); 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); auto rc = MMU::get_flags(address);
if (rc.has_error()) return false; if (rc.has_error()) return false;
if (rc.release_value() & MMU::ReadWrite) return true; if (rc.value() & MMU::ReadWrite) return true;
return false; return false;
} }

View File

@ -63,7 +63,7 @@ MemoryMapEntry MemoryMapIterator::largest_free()
} }
} }
return at(largest_index).release_value(); return at(largest_index).value();
} }
MemoryMapEntry MemoryMapIterator::highest() MemoryMapEntry MemoryMapIterator::highest()
@ -83,5 +83,5 @@ MemoryMapEntry MemoryMapIterator::highest()
} }
} }
return at(highest_index).release_value(); return at(highest_index).value();
} }

View File

@ -24,7 +24,8 @@ namespace Scheduler
g_idle.ticks_left = 1; g_idle.ticks_left = 1;
// Map some stack for the idle task // 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}; Stack idle_stack{idle_stack_vm, ARCH_PAGE_SIZE};
g_idle.set_sp(idle_stack.top()); g_idle.set_sp(idle_stack.top());