From 1f5a36f07424d87a36011e0731f11d3a402dd3aa Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 31 May 2023 00:36:46 +0300 Subject: [PATCH] Kernel: PageTable destructor works now we are successfully booting higher half kernel now :) --- kernel/arch/x86_64/PageTable.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/kernel/arch/x86_64/PageTable.cpp b/kernel/arch/x86_64/PageTable.cpp index 8c925cb094..0b3a216985 100644 --- a/kernel/arch/x86_64/PageTable.cpp +++ b/kernel/arch/x86_64/PageTable.cpp @@ -135,24 +135,22 @@ namespace Kernel PageTable::~PageTable() { - ASSERT_NOT_REACHED(); - uint64_t* pml4 = (uint64_t*)P2V(m_highest_paging_struct); for (uint32_t pml4e = 0; pml4e < 512; pml4e++) { if (!(pml4[pml4e] & Flags::Present)) continue; - uint64_t* pdpt = (uint64_t*)(pml4[pml4e] & PAGE_ADDR_MASK); + uint64_t* pdpt = (uint64_t*)P2V(pml4[pml4e] & PAGE_ADDR_MASK); for (uint32_t pdpte = 0; pdpte < 512; pdpte++) { if (!(pdpt[pdpte] & Flags::Present)) continue; - uint64_t* pd = (uint64_t*)(pdpt[pdpte] & PAGE_ADDR_MASK); + uint64_t* pd = (uint64_t*)P2V(pdpt[pdpte] & PAGE_ADDR_MASK); for (uint32_t pde = 0; pde < 512; pde++) { if (!(pd[pde] & Flags::Present)) continue; - kfree((void*)(pd[pde] & PAGE_ADDR_MASK)); + kfree((void*)P2V(pd[pde] & PAGE_ADDR_MASK)); } kfree(pd); }