aboutsummaryrefslogtreecommitdiff
path: root/kernel/memory/frame.sats
diff options
context:
space:
mode:
authorXander <xander@biltopia.org>2023-07-21 18:02:54 +0200
committerXander <xander@biltopia.org>2023-07-21 18:02:54 +0200
commit9226c8bb581c363a552998663704c483f35f6aae (patch)
tree857a7c8119b5df93d3340f8acd317b06fd254d84 /kernel/memory/frame.sats
parent589e17e4faf369857fd916cbe699bc72c193b9a3 (diff)
downloadats-os-9226c8bb581c363a552998663704c483f35f6aae.tar.xz
ats-os-9226c8bb581c363a552998663704c483f35f6aae.zip
Working on frame allocation
Diffstat (limited to 'kernel/memory/frame.sats')
-rw-r--r--kernel/memory/frame.sats25
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/memory/frame.sats b/kernel/memory/frame.sats
new file mode 100644
index 0000000..441b85a
--- /dev/null
+++ b/kernel/memory/frame.sats
@@ -0,0 +1,25 @@
+#define PAGE_SIZE 4096
+
+staload "kernel/bootinfo/multiboot.sats"
+
+typedef frame_t = @{
+ num = size_t
+}
+
+typedef frame_allocator_t = @{
+ next_free_frame = frame_t,
+ current_area = memory_area_t,
+ num_areas = size_t,
+ kernel_start = frame_t,
+ kernel_end = frame_t,
+ multiboot_start = frame_t,
+ multiboot_end = frame_t
+}
+
+vtypedef allocptr = [l : agz] (frame_allocator_t@l , frame_allocator_t@l -<lin,prf> void | ptr l)
+
+fn containing_address {l : addr} (address : ptr l) : frame_t
+
+fn allocate_frame {l : agz}{k : agz} (pf : !frame_allocator_t @ l >> frame_allocator_t @ l, bf : !boot_info_t @ k | p : ptr l, b : ptr k) : frame_t
+
+fn deallocate_frame (p : !allocptr) : void