summaryrefslogtreecommitdiffhomepage
path: root/Kernel/HALKit/AMD64/Processor.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-01 23:59:03 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-01 23:59:03 +0200
commit5bc5e4de0d4dcfc52c192315ca5c59a066d678d8 (patch)
tree0de48d9d3645b0cd6857b84629d0adbcd353a521 /Kernel/HALKit/AMD64/Processor.hpp
parentfc0d38259fd6670966b916b1f28a11f3cb2a4c45 (diff)
MHR-23: Fix ACPI and APIC probe.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit/AMD64/Processor.hpp')
-rw-r--r--Kernel/HALKit/AMD64/Processor.hpp30
1 files changed, 15 insertions, 15 deletions
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)
{