summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/HALKit/AMD64/Paging.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-29 10:51:53 +0200
committerGitHub <noreply@github.com>2025-05-29 10:51:53 +0200
commit5c0bb7ee7b1b0fee02cc179fb21f4c57a61d6c2d (patch)
treecb17577bcdc9714c97a84ce417a075117097f146 /dev/kernel/HALKit/AMD64/Paging.h
parentd608230b1350b064ceb01e6572519b108f6139b0 (diff)
parent3167f59dbb401d6a79b1524537e04218baf49ee3 (diff)
Merge pull request #32 from nekernel-org/dev
0.0.2e3
Diffstat (limited to 'dev/kernel/HALKit/AMD64/Paging.h')
-rw-r--r--dev/kernel/HALKit/AMD64/Paging.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/dev/kernel/HALKit/AMD64/Paging.h b/dev/kernel/HALKit/AMD64/Paging.h
index cfba232c..079acde4 100644
--- a/dev/kernel/HALKit/AMD64/Paging.h
+++ b/dev/kernel/HALKit/AMD64/Paging.h
@@ -6,13 +6,15 @@
#pragma once
+#ifdef __NE_AMD64__
+
/** ---------------------------------------------------
* THIS FILE CONTAINS CODE FOR X86_64 PAGING.
------------------------------------------------------- */
-#include <NewKit/Defines.h>
+#include <NeKit/Defines.h>
#ifndef kPageMax
#define kPageMax (0x200)
@@ -63,6 +65,27 @@ auto mm_free_bitmap(VoidPtr page_ptr) -> Bool;
} // namespace Kernel::HAL
namespace Kernel {
-typedef VoidPtr PTE;
-typedef VoidPtr PDE;
+struct PTE {
+ UInt64 Present : 1;
+ UInt64 Wr : 1;
+ UInt64 User : 1;
+ UInt64 Pwt : 1; // Page-level Write-Through
+ UInt64 Pcd : 1; // Page-level Cache Disable
+ UInt64 Accessed : 1;
+ UInt64 Dirty : 1;
+ UInt64 Pat : 1; // Page Attribute Table (or PS for PDE)
+ UInt64 Global : 1;
+ UInt64 Ignored1 : 3; // Available to software
+ UInt64 PhysicalAddress : 40; // Physical page frame address (bits 12–51)
+ UInt64 Ignored2 : 7; // More software bits / reserved
+ UInt64 ProtectionKey : 4; // Optional (if PKU enabled)
+ UInt64 Reserved : 1; // Usually reserved
+ UInt64 Nx : 1; // No Execute
+};
+
+struct PDE {
+ ATTRIBUTE(aligned(kib_cast(4))) PTE fPTE[512];
+};
} // namespace Kernel
+
+#endif // __NE_AMD64__ \ No newline at end of file