From 5bc5e4de0d4dcfc52c192315ca5c59a066d678d8 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 1 Jun 2024 23:59:03 +0200 Subject: MHR-23: Fix ACPI and APIC probe. Signed-off-by: Amlal El Mahrouss --- Kernel/HALKit/AMD64/Processor.hpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'Kernel/HALKit/AMD64/Processor.hpp') diff --git a/Kernel/HALKit/AMD64/Processor.hpp b/Kernel/HALKit/AMD64/Processor.hpp index 608a502f..4916d845 100644 --- a/Kernel/HALKit/AMD64/Processor.hpp +++ b/Kernel/HALKit/AMD64/Processor.hpp @@ -74,24 +74,27 @@ namespace NewOS::HAL if (!pde->Pte[pml4_index].Present) { pde->Pte[pml4_index].Present = true; - kcout << "PM: It is present now.\r"; + kcout << "PM is present now.\r"; + + pde->Pte[pml4_index].PhysicalAddress = phys_addr; + pde->Pte[pml4_index].Rw = flags & eFlagsRw; + pde->Pte[pml4_index].User = flags & eFlagsUser; + pde->Pte[pml4_index].ExecDisable = flags & eFlagsExecDisable; + + return 0; } else { - kcout << "PM: It is already present.\r"; - kcout << "Address? " << hex_number(pde->Pte[pml4_index].PhysicalAddress) << endl; - kcout << "User? " << (pde->Pte[pml4_index].User ? "yes" : "no") << "\r"; - kcout << "RW? " << (pde->Pte[pml4_index].Rw ? "yes" : "no") << "\r"; + kcout << "PM is already present.\r"; - return 1; - } + kcout << "PhysicalAddress: " << hex_number(pde->Pte[pml4_index].PhysicalAddress) << endl; + kcout << "User: " << (pde->Pte[pml4_index].User ? "yes" : "no") << "\r"; + kcout << "RW: " << (pde->Pte[pml4_index].Rw ? "yes" : "no") << "\r"; - pde->Pte[pml4_index].PhysicalAddress = phys_addr; - pde->Pte[pml4_index].Rw = flags & eFlagsRw; - pde->Pte[pml4_index].User = flags & eFlagsUser; - pde->Pte[pml4_index].ExecDisable = flags & eFlagsExecDisable; + return 1; + } - return 0; + return 0; } /// @brief Map address to PDE. @@ -102,9 +105,6 @@ namespace NewOS::HAL inline void ke_unmap_address(PDE* pde, UIntPtr phys_addr, UIntPtr virt_addr, UInt32 flags) { UInt16 pml4_index = (virt_addr >> 39) & 0x1FF; - UInt16 pdpt_index = (virt_addr >> 30) & 0x1FF; - UInt16 pd_index = (virt_addr >> 21) & 0x1FF; - UInt16 pt_index = (virt_addr >> 12) & 0x1FF; if (pde->Pte[pml4_index].Present) { -- cgit v1.2.3