summaryrefslogtreecommitdiff
path: root/include/kernel/mm.h
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2025-12-09 00:57:38 +0800
committerRichard Qin <richard.qin.x@gmail.com>2025-12-09 00:57:38 +0800
commitc36e1b5e5e069ce1735dcc2a94aa45ba72ea2441 (patch)
tree34be19b553615cfe36a556452e3b7ebad5276216 /include/kernel/mm.h
parent8cf8be522133548ee25fdcb0258ddf3950a68bcf (diff)
downloadlume-c36e1b5e5e069ce1735dcc2a94aa45ba72ea2441.tar.gz
lume-c36e1b5e5e069ce1735dcc2a94aa45ba72ea2441.tar.xz
feat: Initial PMM implementation
Introduce the foundational Physical Memory Manager (PMM) and restructure the project for modularity. Implemented basic PMM and related memory management headers (mm/pmm.h, mm/vm.h). Updated Makefile and build process to support new modular structure.
Diffstat (limited to 'include/kernel/mm.h')
-rw-r--r--include/kernel/mm.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/kernel/mm.h b/include/kernel/mm.h
new file mode 100644
index 0000000..0f7c73d
--- /dev/null
+++ b/include/kernel/mm.h
@@ -0,0 +1,21 @@
+#pragma once
+#include "common/types.h"
+
+namespace VM
+{
+ typedef uint64_t* pagetable_t;
+ typedef uint64_t pte_t;
+ typedef uint64_t uint64;
+
+ #define PTE_V (1L << 0)
+ #define PTE_R (1L << 1)
+ #define PTE_W (1L << 2)
+ #define PTE_X (1L << 3)
+ #define PTE_U (1L << 4)
+
+ #define SATP_SV39 (8L << 60)
+ #define MAKE_SATP(pagetable) (SATP_SV39 | (((uint64)pagetable) >> 12))
+
+ void kvminit();
+ void kvminithart();
+} \ No newline at end of file