summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-06-18 17:56:12 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-06-18 17:56:12 +0200
commitc50ae11abc23c0ea5d79fd7044273685c73990d1 (patch)
treee324ffed2ffda2c22c4555b9e28a28ecebdc6b23 /dev/kernel/HALKit/AMD64
parenta5cae885d3f714897ae175cc8643fbbd5573dc22 (diff)
feat: level based virtual memory mapping for NeKernel's paging system.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/HALKit/AMD64')
-rw-r--r--dev/kernel/HALKit/AMD64/HalPagingMgr.cc5
-rw-r--r--dev/kernel/HALKit/AMD64/Processor.h3
2 files changed, 6 insertions, 2 deletions
diff --git a/dev/kernel/HALKit/AMD64/HalPagingMgr.cc b/dev/kernel/HALKit/AMD64/HalPagingMgr.cc
index 048cb7c2..ced4f268 100644
--- a/dev/kernel/HALKit/AMD64/HalPagingMgr.cc
+++ b/dev/kernel/HALKit/AMD64/HalPagingMgr.cc
@@ -117,9 +117,12 @@ EXTERN_C Int32 mm_memory_fence(VoidPtr virtual_address) {
/// @param flags the flags to put on the page.
/// @return Status code of page manipulation process.
/***********************************************************************************/
-EXTERN_C Int32 mm_map_page(VoidPtr virtual_address, VoidPtr physical_address, UInt32 flags) {
+EXTERN_C Int32 mm_map_page(VoidPtr virtual_address, VoidPtr physical_address, UInt32 flags,
+ UInt32 level) {
if (physical_address == 0) return kErrorInvalidData;
+ NE_UNUSED(level); /// @todo support PML4, and PDPT levels.
+
const UInt64 kVMAddr = (UInt64) virtual_address;
constexpr UInt64 kMask9 = 0x1FF;
constexpr UInt64 kPageMask = 0xFFF;
diff --git a/dev/kernel/HALKit/AMD64/Processor.h b/dev/kernel/HALKit/AMD64/Processor.h
index 80dc7a1d..b6465941 100644
--- a/dev/kernel/HALKit/AMD64/Processor.h
+++ b/dev/kernel/HALKit/AMD64/Processor.h
@@ -245,7 +245,8 @@ class LAPICDmaWrapper final {
/// @param phys_addr point to physical address.
/// @param flags the flags to put on the page.
/// @return Status code of page manip.
-EXTERN_C Int32 mm_map_page(VoidPtr virtual_address, VoidPtr physical_address, UInt32 flags);
+EXTERN_C Int32 mm_map_page(VoidPtr virtual_address, VoidPtr physical_address, UInt32 flags,
+ UInt32 level = 2);
EXTERN_C UInt8 rt_in8(UInt16 port);
EXTERN_C UInt16 rt_in16(UInt16 port);