From cdd27ae3db7cc36a67edb813291212720a1f9b11 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 22 Jan 2023 03:03:01 +0200 Subject: [PATCH] Kernel: rename MMU::m_page_directory_pointer_table -> m_highest_paging_stuct This might not always be pdpt. In x86_64 it is pml4/pml5 --- kernel/arch/i386/MMU.cpp | 16 ++++++++-------- kernel/include/kernel/MMU.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/kernel/arch/i386/MMU.cpp b/kernel/arch/i386/MMU.cpp index 80f86ebf..e4bb46ec 100644 --- a/kernel/arch/i386/MMU.cpp +++ b/kernel/arch/i386/MMU.cpp @@ -39,19 +39,19 @@ static uint64_t* allocate_page_aligned_page() MMU::MMU() { - m_page_descriptor_pointer_table = (uint64_t*)kmalloc(sizeof(uint64_t) * 4, 32); - ASSERT(m_page_descriptor_pointer_table); - ASSERT(((uintptr_t)m_page_descriptor_pointer_table % 32) == 0); + m_highest_paging_struct = (uint64_t*)kmalloc(sizeof(uint64_t) * 4, 32); + ASSERT(m_highest_paging_struct); + ASSERT(((uintptr_t)m_highest_paging_struct % 32) == 0); // allocate all page directories for (int i = 0; i < 4; i++) { uint64_t* page_directory = allocate_page_aligned_page(); - m_page_descriptor_pointer_table[i] = (uint64_t)page_directory | PRESENT; + m_highest_paging_struct[i] = (uint64_t)page_directory | PRESENT; } // create and identity map first 4 MiB - uint64_t* page_directory1 = (uint64_t*)(m_page_descriptor_pointer_table[0] & PAGE_MASK); + uint64_t* page_directory1 = (uint64_t*)(m_highest_paging_struct[0] & PAGE_MASK); for (uint64_t i = 0; i < 2; i++) { uint64_t* page_table = allocate_page_aligned_page(); @@ -67,7 +67,7 @@ MMU::MMU() page_table1[0] = 0; // reload this new pdpt - asm volatile("movl %0, %%cr3" :: "r"(m_page_descriptor_pointer_table)); + asm volatile("movl %0, %%cr3" :: "r"(m_highest_paging_struct)); } void MMU::AllocatePage(uintptr_t address) @@ -80,7 +80,7 @@ void MMU::AllocatePage(uintptr_t address) uint32_t pde = (address & 0x3FE00000) >> 21; uint32_t pte = (address & 0x001FF000) >> 12; - uint64_t* page_directory = (uint64_t*)(m_page_descriptor_pointer_table[pdpte] & PAGE_MASK); + uint64_t* page_directory = (uint64_t*)(m_highest_paging_struct[pdpte] & PAGE_MASK); if (!(page_directory[pde] & PRESENT)) { uint64_t* page_table = allocate_page_aligned_page(); @@ -111,7 +111,7 @@ void MMU::UnAllocatePage(uintptr_t address) uint32_t pde = (address & 0x3FE00000) >> 21; uint32_t pte = (address & 0x001FF000) >> 12; - uint64_t* page_directory = (uint64_t*)(m_page_descriptor_pointer_table[pdpte] & PAGE_MASK); + uint64_t* page_directory = (uint64_t*)(m_highest_paging_struct[pdpte] & PAGE_MASK); ASSERT(page_directory[pde] & PRESENT); uint64_t* page_table = (uint64_t*)(page_directory[pde] & PAGE_MASK); diff --git a/kernel/include/kernel/MMU.h b/kernel/include/kernel/MMU.h index 9dccc8c5..14984dd7 100644 --- a/kernel/include/kernel/MMU.h +++ b/kernel/include/kernel/MMU.h @@ -19,5 +19,5 @@ private: MMU(); private: - uint64_t* m_page_descriptor_pointer_table; + uint64_t* m_highest_paging_struct; };