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

Kernel: Get rid of MemoryManager::allocate_page_table()

We can just use the physical page allocator directly, there's no need
for a dedicated function for page tables.
This commit is contained in:
Andreas Kling 2019-09-15 20:34:03 +02:00
parent dccab569d2
commit a40afc4562
2 changed files with 1 additions and 13 deletions

View file

@ -151,16 +151,6 @@ void MemoryManager::initialize_paging()
#endif #endif
} }
RefPtr<PhysicalPage> MemoryManager::allocate_page_table(PageDirectory& page_directory, unsigned index)
{
ASSERT(!page_directory.m_physical_pages.contains(index));
auto physical_page = allocate_supervisor_physical_page();
if (!physical_page)
return nullptr;
page_directory.m_physical_pages.set(index, physical_page);
return physical_page;
}
PageTableEntry& MemoryManager::ensure_pte(PageDirectory& page_directory, VirtualAddress vaddr) PageTableEntry& MemoryManager::ensure_pte(PageDirectory& page_directory, VirtualAddress vaddr)
{ {
ASSERT_INTERRUPTS_DISABLED(); ASSERT_INTERRUPTS_DISABLED();
@ -186,7 +176,7 @@ PageTableEntry& MemoryManager::ensure_pte(PageDirectory& page_directory, Virtual
pde.set_writable(true); pde.set_writable(true);
} else { } else {
//ASSERT(&page_directory != m_kernel_page_directory.ptr()); //ASSERT(&page_directory != m_kernel_page_directory.ptr());
auto page_table = allocate_page_table(page_directory, page_directory_index); auto page_table = allocate_supervisor_physical_page();
#ifdef MM_DEBUG #ifdef MM_DEBUG
dbgprintf("MM: PD K%x (%s) at P%x allocated page table #%u (for V%p) at P%x\n", dbgprintf("MM: PD K%x (%s) at P%x allocated page table #%u (for V%p) at P%x\n",
&page_directory, &page_directory,

View file

@ -104,8 +104,6 @@ private:
void flush_entire_tlb(); void flush_entire_tlb();
void flush_tlb(VirtualAddress); void flush_tlb(VirtualAddress);
RefPtr<PhysicalPage> allocate_page_table(PageDirectory&, unsigned index);
void map_protected(VirtualAddress, size_t length); void map_protected(VirtualAddress, size_t length);
void create_identity_mapping(PageDirectory&, VirtualAddress, size_t length); void create_identity_mapping(PageDirectory&, VirtualAddress, size_t length);