From cef3f6bdddfe768e7a1a84edcec76c11c1634941 Mon Sep 17 00:00:00 2001 From: Xander Date: Sun, 6 Aug 2023 17:44:45 +0200 Subject: Implemented panic --- kernel/bootinfo/multiboot.dats | 24 +++++++++++++----------- kernel/bootinfo/multiboot.sats | 14 +++++++------- 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'kernel/bootinfo') diff --git a/kernel/bootinfo/multiboot.dats b/kernel/bootinfo/multiboot.dats index 9fe9103..cf72ba7 100644 --- a/kernel/bootinfo/multiboot.dats +++ b/kernel/bootinfo/multiboot.dats @@ -28,9 +28,9 @@ in implement init (p : Ptr1) = let val total_size = g1ofg0($UN.ptr0_get(p)) - fun loop {n,i : nat | i < n} .. (boot_info : &boot_info_t? >> boot_info_t, p : ptr, i: uint i, n: uint n): void = let + fun loop (boot_info : &boot_info_t? >> boot_info_t, p : ptr): void = let extern castfn unsafe_init(x : &boot_info_t? >> boot_info_t) :<> void - val type = $UN.ptr0_get(p) + val type= $UN.ptr0_get(p) val size = $UN.ptr0_get(ptr_succ(p)) val next = (if (size % 8u != 0) then size + 8u - (size % 8u) else size) : uint in @@ -45,8 +45,8 @@ in ) | _ => (); - if (i < n - 1u) then - loop(boot_info,ptr_add(p, next),succ(i),n) + if (type != 0u) then + loop(boot_info,ptr_add(p, next)) else unsafe_init(boot_info) end @@ -54,23 +54,25 @@ in implement initialize$fwork(v) = ( if (total_size > 0u) then ( v.total_size := total_size; - loop(v, ptr_add(p,2),0u,total_size); + $effmask_ntm(loop(v, ptr_add(p,2))); let prval () = opt_some v in true end) else let prval () = opt_none v in false end ) - in end + in + initialize(bootinfo_ref) + end implement get_memory_mappings_n() = let - implement exec$fwork(v,_) = _get_memory_mappings_n(v) + implement exec$fwork(v) = _get_memory_mappings_n(v) in - exec(bootinfo_ref,i2sz(0)) + exec(bootinfo_ref) end implement get_memory_mapping(n) = let - implement exec$fwork(v,_) = _get_memory_mapping(v,n) + implement exec$fwork(v) = _get_memory_mapping(v,n) in - exec(bootinfo_ref,invalid_area) + exec(bootinfo_ref) end implement print_memory_mappings() = let @@ -123,7 +125,7 @@ end //---------------------------------------------- (* //---------------------ELF---------------------- *) -(**) + (* implement get_elf_headers_n(p) = ui2sz p.2->elf_tag.num *) (**) (* implement get_elf_header (p,n) = ( *) diff --git a/kernel/bootinfo/multiboot.sats b/kernel/bootinfo/multiboot.sats index 6be1e73..9a41f29 100644 --- a/kernel/bootinfo/multiboot.sats +++ b/kernel/bootinfo/multiboot.sats @@ -54,14 +54,14 @@ macdef invalid_area = @{ fun init(p : Ptr1) :void -fn get_memory_mappings_n () : [n:nat] size_t n +fn get_memory_mappings_n () : size_t fn get_memory_mapping (n : size_t) : memory_area_t fn print_memory_mappings () : void // Print all available memory area's -(* fn get_elf_headers_n () : [n:nat] size_t n *) -(* fn get_elf_header (n : size_t) : elf64_shdr_t *) -(* fn print_elf_headers () : void *) -(**) -(* fn get_kernel_ranges () : (Ptr,Ptr) // (kernel start, kernel end) *) -(* fn get_multiboot_ranges () : (Ptr0,Ptr0) // (bootinfo start, bootinfo end) *) +fn get_elf_headers_n () : [n:nat] size_t n +fn get_elf_header (n : size_t) : elf64_shdr_t +fn print_elf_headers () : void + +fn get_kernel_ranges () : (Ptr,Ptr) // (kernel start, kernel end) +fn get_multiboot_ranges () : (Ptr0,Ptr0) // (bootinfo start, bootinfo end) -- cgit v1.2.3