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 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'kernel/bootinfo/multiboot.dats') 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) = ( *) -- cgit v1.2.3