diff options
author | Xander <xander@biltopia.org> | 2023-07-15 19:54:02 +0200 |
---|---|---|
committer | Xander <xander@biltopia.org> | 2023-07-15 19:54:02 +0200 |
commit | 589e17e4faf369857fd916cbe699bc72c193b9a3 (patch) | |
tree | 6004b0efeee0bb6f3cebba7cecb7856e4950dfb2 /kernel/bootinfo | |
parent | c7f1dd153ef439c94d04c99019038375468fc79a (diff) | |
download | ats-os-589e17e4faf369857fd916cbe699bc72c193b9a3.tar.xz ats-os-589e17e4faf369857fd916cbe699bc72c193b9a3.zip |
Print kernel start,stop and size
Diffstat (limited to 'kernel/bootinfo')
-rw-r--r-- | kernel/bootinfo/multiboot.dats | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/kernel/bootinfo/multiboot.dats b/kernel/bootinfo/multiboot.dats index 3213237..742c7ed 100644 --- a/kernel/bootinfo/multiboot.dats +++ b/kernel/bootinfo/multiboot.dats @@ -98,8 +98,11 @@ implement get_elf_header (p,n) = ( implement print_elf_headers(p) = let val length = get_elf_headers_n(p) - fun loop {n,i : nat | i < n} .<n-i>. (p : !bootptr, i : size_t i, n : size_t n) : void = let + fun loop {n,i : nat | i < n} .<n-i>. (p : !bootptr, i : size_t i, n : size_t n, min : size_t, max : size_t) : void = let val header = get_elf_header(p,i) + val a = $UN.cast{size_t}(header.addr) + val new_min = (if (a < min && header.size != 0) then a else min) : size_t + val new_max = (if (a + header.size > max && header.size != 0) then a + header.size else max) : size_t in print(" addr: "); print_hex(header.addr); @@ -107,13 +110,22 @@ implement print_elf_headers(p) = let print_hex(header.size); print(", flags: "); println_hex(header.flags); + if (i < n - 1) then - loop(p,succ(i),n) + loop(p,succ(i),n,new_min,new_max) + else ( + print("Kernel start: "); + print_hex(new_min); + print(" end: "); + print_hex(new_max); + print(" size: "); + println!(new_max - new_min) + ) end in if (length > 0) then ( println!("Elf section headers: "); - loop(p,i2sz(0),length)) + loop(p,i2sz(0),length,i2sz(0xFFFFFF),i2sz(0))) else println!("No elf section headers") end |