1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

Kernel: Remove some Region construction helpers

It's now up to the caller to provide a VMObject when constructing a new
Region object. This will make it easier to handle things going wrong,
like allocation failures, etc.
This commit is contained in:
Andreas Kling 2020-03-01 11:02:22 +01:00
parent fddc3c957b
commit 88b334135b
4 changed files with 5 additions and 30 deletions

View file

@ -314,11 +314,12 @@ OwnPtr<Region> MemoryManager::allocate_kernel_region(size_t size, const StringVi
ASSERT(!(size % PAGE_SIZE));
auto range = kernel_page_directory().range_allocator().allocate_anywhere(size);
ASSERT(range.is_valid());
auto vmobject = AnonymousVMObject::create_with_size(size);
OwnPtr<Region> region;
if (user_accessible)
region = Region::create_user_accessible(range, name, access, cacheable);
region = Region::create_user_accessible(range, vmobject, 0, name, access, cacheable);
else
region = Region::create_kernel_only(range, name, access, cacheable);
region = Region::create_kernel_only(range, vmobject, 0, name, access, cacheable);
region->map(kernel_page_directory());
if (should_commit)
region->commit();