diff options
author | Xander <xander@biltopia.org> | 2023-07-21 21:36:54 +0200 |
---|---|---|
committer | Xander <xander@biltopia.org> | 2023-07-21 21:36:54 +0200 |
commit | 1d25d9783127c181f79732eb5c20c680444af414 (patch) | |
tree | 5550f40b25af3e2722b5aaf6194f6df37ca9e092 /kernel/main.dats | |
parent | 9226c8bb581c363a552998663704c483f35f6aae (diff) | |
download | ats-os-1d25d9783127c181f79732eb5c20c680444af414.tar.xz ats-os-1d25d9783127c181f79732eb5c20c680444af414.zip |
Mainly refactoring
Diffstat (limited to 'kernel/main.dats')
-rw-r--r-- | kernel/main.dats | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/kernel/main.dats b/kernel/main.dats index 94955ee..c57f53d 100644 --- a/kernel/main.dats +++ b/kernel/main.dats @@ -14,8 +14,19 @@ staload UN = "prelude/SATS/unsafe.sats" } %} +//NOTE: how to make sure ats checks 2 contstraints in one if statement? +fn kernel_size(kernel_start : Ptr, kernel_end : Ptr) : size_t = let + extern castfn Ptr12size (a : Ptr1): size_t +in + if (kernel_end > the_null_ptr) then + if (kernel_start > the_null_ptr) then + Ptr12size(kernel_end) - Ptr12size(kernel_start) + else + i2sz(0) + else + i2sz(0) +end -extern castfn char_arr2string {n:nat} (arr : &(@[char][n])) : string n extern fun breakpoint() :void = "mac#" @@ -25,10 +36,13 @@ implement main(p) = let // Initialize boot info struct val bootptr = boot_info_init(p) + val (kernel_start,kernel_end) = get_kernel_ranges(bootptr) in print_memory_mappings(bootptr); + print_elf_headers(bootptr); + println!("Kernel Size: ", kernel_size(kernel_start,kernel_end)); // Initialize interrupt table idt_init(); |