From ae3ad4d8b7004f17376ee0a8bfae931788194b8b Mon Sep 17 00:00:00 2001 From: Xander Date: Tue, 8 Aug 2023 23:13:00 +0200 Subject: Final refactoring for opts: frames --- kernel/memory/frame.sats | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) (limited to 'kernel/memory/frame.sats') diff --git a/kernel/memory/frame.sats b/kernel/memory/frame.sats index 0926e6c..6ace8f9 100644 --- a/kernel/memory/frame.sats +++ b/kernel/memory/frame.sats @@ -1,25 +1,20 @@ -(* #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, *) -(* 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 - void | ptr l) *) -(**) -(* abst@ype frame_allocator = frame_allocator_t *) -(**) -(* fn containing_address {l : addr} (address : ptr l) :<> frame_t *) -(* fn allocate_frame {l : agz}{k : agz} (bf : !boot_info_t @ k | b : ptr k) : frame_t *) -(* fn deallocate_frame (p : !allocptr) : void *) -(* (* fn frame_allocator_init(kernel_start: Ptr, kernel_end: Ptr, multiboot_start:Ptr, multiboot_end: Ptr, b : !bootptr) : void *) *) +#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, + kernel_start = frame_t, + kernel_end = frame_t, + multiboot_start = frame_t, + multiboot_end = frame_t +} + +fn allocate_frame () : frame_t +fn deallocate_frame () : void +fn init(kernel_start: Ptr, kernel_end: Ptr, multiboot_start:Ptr, multiboot_end: Ptr) : void -- cgit v1.2.3