1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:58:12 +00:00

Kernel: Rename PageDirectory::find_by_pdb() => find_by_cr3()

I caught myself wondering what "pdb" stood for, so let's rename this
to something more obvious.
This commit is contained in:
Andreas Kling 2019-12-25 02:46:17 +01:00
parent 7a0088c4d2
commit c087abc48d
3 changed files with 8 additions and 8 deletions

View file

@ -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());

View file

@ -6,7 +6,7 @@
static const u32 userspace_range_base = 0x01000000;
static const u32 kernelspace_range_base = 0xc0000000;
static HashMap<u32, PageDirectory*>& pdb_map()
static HashMap<u32, PageDirectory*>& cr3_map()
{
ASSERT_INTERRUPTS_DISABLED();
static HashMap<u32, PageDirectory*>* map;
@ -15,10 +15,10 @@ static HashMap<u32, PageDirectory*>& pdb_map()
return *map;
}
RefPtr<PageDirectory> PageDirectory::find_by_pdb(u32 pdb)
RefPtr<PageDirectory> 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)

View file

@ -17,7 +17,7 @@ public:
return adopt(*new PageDirectory(process, parent_range_allocator));
}
static NonnullRefPtr<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); }
static RefPtr<PageDirectory> find_by_pdb(u32);
static RefPtr<PageDirectory> find_by_cr3(u32);
~PageDirectory();