1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 23:38:11 +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)) if (auto* region = kernel_region_from_vaddr(vaddr))
return region; return region;
auto page_directory = PageDirectory::find_by_pdb(cpu_cr3()); auto page_directory = PageDirectory::find_by_cr3(cpu_cr3());
if (!page_directory) if (!page_directory)
return nullptr; return nullptr;
ASSERT(page_directory->process()); ASSERT(page_directory->process());

View file

@ -6,7 +6,7 @@
static const u32 userspace_range_base = 0x01000000; static const u32 userspace_range_base = 0x01000000;
static const u32 kernelspace_range_base = 0xc0000000; static const u32 kernelspace_range_base = 0xc0000000;
static HashMap<u32, PageDirectory*>& pdb_map() static HashMap<u32, PageDirectory*>& cr3_map()
{ {
ASSERT_INTERRUPTS_DISABLED(); ASSERT_INTERRUPTS_DISABLED();
static HashMap<u32, PageDirectory*>* map; static HashMap<u32, PageDirectory*>* map;
@ -15,10 +15,10 @@ static HashMap<u32, PageDirectory*>& pdb_map()
return *map; return *map;
} }
RefPtr<PageDirectory> PageDirectory::find_by_pdb(u32 pdb) RefPtr<PageDirectory> PageDirectory::find_by_cr3(u32 cr3)
{ {
InterruptDisabler disabler; InterruptDisabler disabler;
return pdb_map().get(pdb).value_or({}); return cr3_map().get(cr3).value_or({});
} }
PageDirectory::PageDirectory(PhysicalAddress paddr) PageDirectory::PageDirectory(PhysicalAddress paddr)
@ -26,7 +26,7 @@ PageDirectory::PageDirectory(PhysicalAddress paddr)
{ {
m_directory_page = PhysicalPage::create(paddr, true, false); m_directory_page = PhysicalPage::create(paddr, true, false);
InterruptDisabler disabler; 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) 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); MM.populate_page_directory(*this);
InterruptDisabler disabler; InterruptDisabler disabler;
pdb_map().set(m_directory_page->paddr().get(), this); cr3_map().set(cr3(), this);
} }
PageDirectory::~PageDirectory() PageDirectory::~PageDirectory()
@ -44,7 +44,7 @@ PageDirectory::~PageDirectory()
dbgprintf("MM: ~PageDirectory K%x\n", this); dbgprintf("MM: ~PageDirectory K%x\n", this);
#endif #endif
InterruptDisabler disabler; InterruptDisabler disabler;
pdb_map().remove(m_directory_page->paddr().get()); cr3_map().remove(cr3());
} }
void PageDirectory::flush(VirtualAddress vaddr) void PageDirectory::flush(VirtualAddress vaddr)

View file

@ -17,7 +17,7 @@ public:
return adopt(*new PageDirectory(process, parent_range_allocator)); return adopt(*new PageDirectory(process, parent_range_allocator));
} }
static NonnullRefPtr<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); } 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(); ~PageDirectory();