summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/HALKit/AMD64/Processor.h
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2025-02-20 11:58:55 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2025-02-20 11:58:55 +0100
commitaa8a096ad429640e752d69a89c572da35493d4c0 (patch)
tree4616c7cf8f8baedfa91e46eba9a6c76ab10de7a2 /dev/Kernel/HALKit/AMD64/Processor.h
parent807dbca22a151713ff7b7527cbf66b6c350ed938 (diff)
FS, DriveMgr, AHCI: Actively working on it.
PagingMgr: Define get_phys_address in C++ source directly. Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/HALKit/AMD64/Processor.h')
-rw-r--r--dev/Kernel/HALKit/AMD64/Processor.h21
1 files changed, 1 insertions, 20 deletions
diff --git a/dev/Kernel/HALKit/AMD64/Processor.h b/dev/Kernel/HALKit/AMD64/Processor.h
index 24e84b79..db91d138 100644
--- a/dev/Kernel/HALKit/AMD64/Processor.h
+++ b/dev/Kernel/HALKit/AMD64/Processor.h
@@ -206,26 +206,7 @@ namespace Kernel::HAL
return edx & (1 << 5);
}
- inline UInt64 hal_get_phys_address(void* virtual_address)
- {
- UInt64 addr = (UInt64)virtual_address;
- UInt64 cr3 = (UInt64)hal_read_cr3();
-
- // Extract indices for PML4, PDPT, PD, and PT
- UInt64 pml4_idx = (addr >> 39) & 0x1FF;
- UInt64 pdpt_idx = (addr >> 30) & 0x1FF;
- UInt64 pd_idx = (addr >> 21) & 0x1FF;
- UInt64 pt_idx = (addr >> 12) & 0x1FF;
-
- // Get PML4 Table
- UInt64* pml4 = (UInt64*)(cr3 & ~0xFFF);
- UInt64* pdpt = (UInt64*)(pml4[pml4_idx] & ~0xFFF);
- UInt64* pd = (UInt64*)(pdpt[pdpt_idx] & ~0xFFF);
- UInt64* pt = (UInt64*)(pd[pd_idx] & ~0xFFF);
-
- // Get Physical Address
- return (pt[pt_idx] & ~0xFFF) + (addr & 0xFFF);
- }
+ UIntPtr hal_get_phys_address(void* virtual_address);
/***********************************************************************************/
/// @brief Get Model specific register inside core.