diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp index 44ad79cc90..1b1dfe3ed4 100644 --- a/Kernel/VM/AnonymousVMObject.cpp +++ b/Kernel/VM/AnonymousVMObject.cpp @@ -37,6 +37,13 @@ NonnullRefPtr AnonymousVMObject::create_for_physical_range(Ph return adopt(*new AnonymousVMObject(paddr, size)); } +NonnullRefPtr AnonymousVMObject::create_with_physical_page(PhysicalPage& page) +{ + auto vmobject = create_with_size(PAGE_SIZE); + vmobject->m_physical_pages[0] = page; + return vmobject; +} + AnonymousVMObject::AnonymousVMObject(size_t size) : VMObject(size) { diff --git a/Kernel/VM/AnonymousVMObject.h b/Kernel/VM/AnonymousVMObject.h index 4f74b6be17..5af312f4de 100644 --- a/Kernel/VM/AnonymousVMObject.h +++ b/Kernel/VM/AnonymousVMObject.h @@ -35,6 +35,7 @@ public: static NonnullRefPtr create_with_size(size_t); static NonnullRefPtr create_for_physical_range(PhysicalAddress, size_t); + static NonnullRefPtr create_with_physical_page(PhysicalPage&); virtual NonnullRefPtr clone() override; protected: