aboutsummaryrefslogtreecommitdiff
path: root/kernel/memory/paging.dats
diff options
context:
space:
mode:
authorXander <xander@biltopia.org>2023-08-17 21:09:27 +0200
committerXander <xander@biltopia.org>2023-08-17 21:09:27 +0200
commite2d7deb82cd25b47cbccda0c48ab39e17c5c536d (patch)
tree30e9d6d316dc3912d077eed469268f710696e916 /kernel/memory/paging.dats
parentb06ab74179453e0f8592c77c40992707b3e8b765 (diff)
downloadats-os-e2d7deb82cd25b47cbccda0c48ab39e17c5c536d.tar.xz
ats-os-e2d7deb82cd25b47cbccda0c48ab39e17c5c536d.zip
Started implementing paging
Diffstat (limited to 'kernel/memory/paging.dats')
-rw-r--r--kernel/memory/paging.dats30
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/memory/paging.dats b/kernel/memory/paging.dats
new file mode 100644
index 0000000..9b55624
--- /dev/null
+++ b/kernel/memory/paging.dats
@@ -0,0 +1,30 @@
+#define ATS_DYNLOADFLAG 0
+
+#include "kernel/prelude/kernel_prelude.hats"
+
+staload UN = "prelude/SATS/unsafe.sats"
+
+staload "./paging.sats"
+staload "./frame.sats"
+
+assume entry_type = uint64
+
+val zero = u2uint64(0u)
+
+implement is_unused(entry) = entry = zero
+implement set_unused(entry) = entry := zero
+
+implement flag_contains(entry,flag) =
+ (entry land $UN.cast{uint64}(1 << (case+ flag of
+ | PRESENT() => 0
+ | WRITABLE() => 1
+ | USER_ACCESSIBLE() => 2
+ | WRITE_THROUGH() => 3
+ | NO_CACHE() => 4
+ | ACCESSED() => 5
+ | DIRTY() => 6
+ | HUGE_PAGE() => 7
+ | GLOBAL() => 8
+ | NO_EXECUTE() => 63
+ ))) != zero
+