aboutsummaryrefslogtreecommitdiff
path: root/kernel/memory/paging.sats
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.sats
parentb06ab74179453e0f8592c77c40992707b3e8b765 (diff)
downloadats-os-e2d7deb82cd25b47cbccda0c48ab39e17c5c536d.tar.xz
ats-os-e2d7deb82cd25b47cbccda0c48ab39e17c5c536d.zip
Started implementing paging
Diffstat (limited to 'kernel/memory/paging.sats')
-rw-r--r--kernel/memory/paging.sats33
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/memory/paging.sats b/kernel/memory/paging.sats
new file mode 100644
index 0000000..784f567
--- /dev/null
+++ b/kernel/memory/paging.sats
@@ -0,0 +1,33 @@
+#define ENTRY_COUNT 512
+
+staload "./frame.sats"
+
+abstype paddr_type(l:addr) = ptr(l)
+typedef paddr(l:addr) = paddr_type(l)
+
+abstype vaddr_type(l:addr) = ptr(l)
+typedef vaddr(l:addr) = vaddr_type(l)
+
+abst@ype entry_type = uint64
+typedef entry_t = entry_type
+
+typedef page_t = @{
+ num = size_t
+}
+
+datatype entry_flag =
+ | PRESENT
+ | WRITABLE
+ | USER_ACCESSIBLE
+ | WRITE_THROUGH
+ | NO_CACHE
+ | ACCESSED
+ | DIRTY
+ | HUGE_PAGE
+ | GLOBAL
+ | NO_EXECUTE
+
+fn is_unused(entry_t) : bool
+fn set_unused(&entry_t) : void
+
+fn flag_contains(entry_t,entry_flag) : bool