diff options
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(); |