1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 06:14:58 +00:00

Kernel: Remove ContiguousVMObject, let AnonymousVMObject do the job

We don't need an entirely separate VMObject subclass to influence the
location of the physical pages.

Instead, we simply allocate enough physically contiguous memory first,
and then pass it to the AnonymousVMObject constructor that takes a span
of physical pages.
This commit is contained in:
Andreas Kling 2021-07-25 18:37:11 +02:00
parent 9a701eafc4
commit 6a537ceef1
10 changed files with 18 additions and 89 deletions

View file

@ -17,7 +17,6 @@
#include <Kernel/Sections.h>
#include <Kernel/StdLib.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/ContiguousVMObject.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/PageDirectory.h>
#include <Kernel/VM/PhysicalRegion.h>
@ -705,7 +704,7 @@ OwnPtr<Region> MemoryManager::allocate_contiguous_kernel_region(size_t size, Str
auto range = kernel_page_directory().range_allocator().allocate_anywhere(size);
if (!range.has_value())
return {};
auto vmobject = ContiguousVMObject::try_create_with_size(size);
auto vmobject = AnonymousVMObject::try_create_physically_contiguous_with_size(size);
if (!vmobject) {
kernel_page_directory().range_allocator().deallocate(range.value());
return {};