diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index e7fd16ef46..f6861136a5 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -307,7 +307,7 @@ Region* MemoryManager::region_from_vaddr(VirtualAddress vaddr) { if (auto* region = kernel_region_from_vaddr(vaddr)) return region; - auto page_directory = PageDirectory::find_by_pdb(cpu_cr3()); + auto page_directory = PageDirectory::find_by_cr3(cpu_cr3()); if (!page_directory) return nullptr; ASSERT(page_directory->process()); diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp index 9cc949857a..e25c6e9119 100644 --- a/Kernel/VM/PageDirectory.cpp +++ b/Kernel/VM/PageDirectory.cpp @@ -6,7 +6,7 @@ static const u32 userspace_range_base = 0x01000000; static const u32 kernelspace_range_base = 0xc0000000; -static HashMap& pdb_map() +static HashMap& cr3_map() { ASSERT_INTERRUPTS_DISABLED(); static HashMap* map; @@ -15,10 +15,10 @@ static HashMap& pdb_map() return *map; } -RefPtr PageDirectory::find_by_pdb(u32 pdb) +RefPtr PageDirectory::find_by_cr3(u32 cr3) { InterruptDisabler disabler; - return pdb_map().get(pdb).value_or({}); + return cr3_map().get(cr3).value_or({}); } PageDirectory::PageDirectory(PhysicalAddress paddr) @@ -26,7 +26,7 @@ PageDirectory::PageDirectory(PhysicalAddress paddr) { m_directory_page = PhysicalPage::create(paddr, true, false); InterruptDisabler disabler; - pdb_map().set(m_directory_page->paddr().get(), this); + cr3_map().set(cr3(), this); } PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_range_allocator) @@ -35,7 +35,7 @@ PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_rang { MM.populate_page_directory(*this); InterruptDisabler disabler; - pdb_map().set(m_directory_page->paddr().get(), this); + cr3_map().set(cr3(), this); } PageDirectory::~PageDirectory() @@ -44,7 +44,7 @@ PageDirectory::~PageDirectory() dbgprintf("MM: ~PageDirectory K%x\n", this); #endif InterruptDisabler disabler; - pdb_map().remove(m_directory_page->paddr().get()); + cr3_map().remove(cr3()); } void PageDirectory::flush(VirtualAddress vaddr) diff --git a/Kernel/VM/PageDirectory.h b/Kernel/VM/PageDirectory.h index 3ffb438bbe..98ac63dcab 100644 --- a/Kernel/VM/PageDirectory.h +++ b/Kernel/VM/PageDirectory.h @@ -17,7 +17,7 @@ public: return adopt(*new PageDirectory(process, parent_range_allocator)); } static NonnullRefPtr create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); } - static RefPtr find_by_pdb(u32); + static RefPtr find_by_cr3(u32); ~PageDirectory();