aboutsummaryrefslogtreecommitdiff
path: root/kernel/main.dats
diff options
context:
space:
mode:
authorXander <xander@biltopia.org>2023-08-08 23:13:00 +0200
committerXander <xander@biltopia.org>2023-08-08 23:13:00 +0200
commitae3ad4d8b7004f17376ee0a8bfae931788194b8b (patch)
treeef607954d6d551ee4c045b65aca480307e337b9e /kernel/main.dats
parent245f24890cd78304cf0fd397dda8e72b0a7fbe6b (diff)
downloadats-os-ae3ad4d8b7004f17376ee0a8bfae931788194b8b.tar.xz
ats-os-ae3ad4d8b7004f17376ee0a8bfae931788194b8b.zip
Final refactoring for opts: frames
Diffstat (limited to 'kernel/main.dats')
-rw-r--r--kernel/main.dats29
1 files changed, 14 insertions, 15 deletions
diff --git a/kernel/main.dats b/kernel/main.dats
index 96cfdda..bbac122 100644
--- a/kernel/main.dats
+++ b/kernel/main.dats
@@ -2,7 +2,7 @@
staload "kernel/interrupts/idt.sats"
staload BOOT = "kernel/bootinfo/multiboot.sats"
-staload "kernel/memory/frame.sats"
+staload FRAME = "kernel/memory/frame.sats"
staload "lib/SATS/writer.sats"
%{^
@@ -25,11 +25,11 @@ in
i2sz(0)
end
-(* fn test(allocptr : !allocptr, bootptr : !bootptr) : void = let *)
-(* fun loop(i : int) : void = if (i < 160) then( let val _ = allocate_frame(allocptr.0, bootptr.0 | allocptr.2, bootptr.2) in end; loop(succ(i))) *)
-(* in *)
-(* loop(0) *)
-(* end *)
+fn test() : void = let
+ fun loop(i : int) : void = if (i < 160) then( let val _ = $FRAME.allocate_frame() in end; loop(succ(i)))
+in
+ loop(0)
+end
extern fun breakpoint() :void = "mac#"
@@ -39,21 +39,20 @@ extern fun entry(p : Ptr1) : void = "ext#"
implement entry(p) = let
val () = $BOOT.init(p);
val (kernel_start,kernel_end) = $BOOT.get_kernel_ranges()
- (* val (multiboot_start,multiboot_end) = get_multiboot_ranges(bootptr) *)
- (* val allocptr = frame_allocator_init(kernel_start,kernel_end,multiboot_start,multiboot_end,bootptr) *)
+ val (multiboot_start,multiboot_end) = $BOOT.get_multiboot_ranges()
+ val () = $FRAME.init(kernel_start,kernel_end,multiboot_start,multiboot_end);
in
- // Initialize boot info struct
$BOOT.print_memory_mappings();
$BOOT.print_elf_headers();
println!("Kernel Size: ", kernel_size(kernel_start,kernel_end));
- (* test(allocptr,bootptr); *)
- (* let *)
- (* val frame = allocate_frame(allocptr.0, bootptr.0 | allocptr.2, bootptr.2) *)
- (* in *)
- (* println!(frame.num) *)
- (* end; *)
+ test();
+ let
+ val frame = $FRAME.allocate_frame()
+ in
+ println!(frame.num)
+ end;
// Initialize interrupt table
idt_init();