diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-22 13:51:40 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-22 14:20:05 +0200 |
commit | 0642f8f2c64e873aa0c2abc7cde3fb767876548c (patch) | |
tree | f5b9fdc79b53e93d4db3839da87a8773953c9939 /Kernel/VM/Region.cpp | |
parent | d79d768010ef54e584501c655b543a3ea85925a8 (diff) | |
download | serenity-0642f8f2c64e873aa0c2abc7cde3fb767876548c.zip |
Kernel: Make committed physical page allocation return NonnullRefPtr
Since we're taking from the committed set of pages, there should never
be a reason for this call to fail.
Also add a Badge to disallow taking committed pages from anywhere but
the Region class.
Diffstat (limited to 'Kernel/VM/Region.cpp')
-rw-r--r-- | Kernel/VM/Region.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 3030027623..b885f7f9f4 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -426,7 +426,8 @@ PageFaultResponse Region::handle_fault(const PageFault& fault, ScopedSpinLock<Re auto& page_slot = physical_page_slot(page_index_in_region); if (page_slot->is_lazy_committed_page()) { auto page_index_in_vmobject = translate_to_vmobject_page(page_index_in_region); - page_slot = static_cast<AnonymousVMObject&>(*m_vmobject).allocate_committed_page(page_index_in_vmobject); + VERIFY(m_vmobject->is_anonymous()); + page_slot = static_cast<AnonymousVMObject&>(*m_vmobject).allocate_committed_page({}, page_index_in_vmobject); remap_vmobject_page(page_index_in_vmobject); return PageFaultResponse::Continue; } @@ -495,7 +496,8 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region, ScopedS current_thread->did_zero_fault(); if (page_slot->is_lazy_committed_page()) { - page_slot = static_cast<AnonymousVMObject&>(*m_vmobject).allocate_committed_page(page_index_in_vmobject); + VERIFY(m_vmobject->is_anonymous()); + page_slot = static_cast<AnonymousVMObject&>(*m_vmobject).allocate_committed_page({}, page_index_in_vmobject); dbgln_if(PAGE_FAULT_DEBUG, " >> ALLOCATED COMMITTED {}", page_slot->paddr()); } else { page_slot = MM.allocate_user_physical_page(MemoryManager::ShouldZeroFill::Yes); |