Kernel: Improve MMU

We don't have to invalidate page in AllocatePage() if we don't make
any changes. We also should not assert on deallocating non-present
pages, just return early :)
This commit is contained in:
Bananymous
2023-01-26 02:35:11 +02:00
parent 589f338357
commit 35d2e27292
2 changed files with 15 additions and 8 deletions

View File

@@ -112,10 +112,12 @@ void MMU::UnAllocatePage(uintptr_t address)
uint32_t pte = (address & 0x001FF000) >> 12;
uint64_t* page_directory = (uint64_t*)(m_highest_paging_struct[pdpte] & PAGE_MASK);
ASSERT(page_directory[pde] & PRESENT);
if (!(page_directory[pde] & PRESENT))
return;
uint64_t* page_table = (uint64_t*)(page_directory[pde] & PAGE_MASK);
ASSERT(page_table[pte] & PRESENT);
if (!(page_table[pte] & PRESENT))
return;
page_table[pte] = 0;