mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
Kernel: Make Kernel::VMObject allocation functions return KResultOr
This makes for nicer handling of errors compared to checking whether a RefPtr is null. Additionally, this will give way to return different types of errors in the future.
This commit is contained in:
parent
61c0e3ca92
commit
4bfd6e41b9
26 changed files with 194 additions and 122 deletions
|
@ -277,11 +277,13 @@ UNMAP_AFTER_INIT bool APIC::init_bsp()
|
|||
|
||||
UNMAP_AFTER_INIT static NonnullOwnPtr<Memory::Region> create_identity_mapped_region(PhysicalAddress paddr, size_t size)
|
||||
{
|
||||
auto vmobject = Memory::AnonymousVMObject::try_create_for_physical_range(paddr, size);
|
||||
VERIFY(vmobject);
|
||||
auto maybe_vmobject = Memory::AnonymousVMObject::try_create_for_physical_range(paddr, size);
|
||||
// FIXME: Would be nice to be able to return a KResultOr from here.
|
||||
VERIFY(!maybe_vmobject.is_error());
|
||||
|
||||
auto region = MM.allocate_kernel_region_with_vmobject(
|
||||
Memory::VirtualRange { VirtualAddress { static_cast<FlatPtr>(paddr.get()) }, size },
|
||||
vmobject.release_nonnull(),
|
||||
maybe_vmobject.release_value(),
|
||||
{},
|
||||
Memory::Region::Access::ReadWriteExecute);
|
||||
VERIFY(region);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue