summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-01-20 13:07:17 +0100
committerAndreas Kling <kling@serenityos.org>2020-01-20 13:13:03 +0100
commita0b716cfc5786ec646803b689fad6d3703ddb67a (patch)
tree848bdf18841a1cfd93c7dd813b882163a4ca2ce9 /Kernel
parent4ebff10bde58c6780a8b0b11bbe60d3e2982b675 (diff)
downloadserenity-a0b716cfc5786ec646803b689fad6d3703ddb67a.zip
Add AnonymousVMObject::create_with_physical_page()
This can be used to create a VMObject for a single PhysicalPage.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/VM/AnonymousVMObject.cpp7
-rw-r--r--Kernel/VM/AnonymousVMObject.h1
2 files changed, 8 insertions, 0 deletions
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> AnonymousVMObject::create_for_physical_range(Ph
return adopt(*new AnonymousVMObject(paddr, size));
}
+NonnullRefPtr<AnonymousVMObject> 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<AnonymousVMObject> create_with_size(size_t);
static NonnullRefPtr<AnonymousVMObject> create_for_physical_range(PhysicalAddress, size_t);
+ static NonnullRefPtr<AnonymousVMObject> create_with_physical_page(PhysicalPage&);
virtual NonnullRefPtr<VMObject> clone() override;
protected: