From a76834b8497c22a11167d17023550f204b657925 Mon Sep 17 00:00:00 2001 From: Lorenzo Torres Date: Fri, 17 Apr 2026 08:47:28 +0200 Subject: [PATCH] changed debug messages on boot --- src/kernel.zig | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/kernel.zig b/src/kernel.zig index b60a9ef..4a489a2 100644 --- a/src/kernel.zig +++ b/src/kernel.zig @@ -14,12 +14,11 @@ pub export fn kmain(hartid: u64, fdt_phys: usize, console_phys: usize, alloc_sta const console = Console.initAt(@intCast(mem.physToMmioVirt(console_phys))); debug.init(console); - debug.print("entered higher-half kernel.\n", .{}); + debug.print("booting hydra...\n", .{}); const fdt = Fdt.parse(@ptrFromInt(mem.physToDirectMap(fdt_phys))) catch { @panic("Unable to parse higher-half FDT.\n"); }; - debug.print("fdt remapped at 0x{x}.\n", .{mem.physToDirectMap(fdt_phys)}); const root = fdt.root().?; const memory = fdt.memory().?; @@ -27,19 +26,18 @@ pub export fn kmain(hartid: u64, fdt_phys: usize, console_phys: usize, alloc_sta const reg = reg_iter.next().?; const detected_memory_end = reg.address + reg.size; const memory_end = if (memory_end_hint != 0) @min(detected_memory_end, memory_end_hint) else detected_memory_end; - debug.print("detected RAM end at 0x{x}.\n", .{memory_end}); + debug.print("detected 0x{x} bytes of memory.\n", .{reg.size}); var buddy: mem.BuddyAllocator = .{}; const alloc_start = mem.physToDirectMap(alloc_start_phys); buddy.init(@as([*]u8, @ptrFromInt(alloc_start))[0..memory_end - alloc_start_phys]); - debug.print("direct map allocator initialized.\n", .{}); const allocator = buddy.allocator(); const mmu_type = fdt.mmuType(); if (mmu_type != .bare) { var table = isa.PageTable.init(allocator) catch { - @panic("Unable to allocate higher-half page table.\n"); + @panic("unable to allocate higher-half page table.\n"); }; const kernel_flags: isa.PageTable.EntryFlags = .{ @@ -59,7 +57,7 @@ pub export fn kmain(hartid: u64, fdt_phys: usize, console_phys: usize, alloc_sta mmu_type, mem.PHYS_MAP_BASE, ) catch { - @panic("Unable to map higher-half kernel image.\n"); + @panic("unable to map higher-half kernel image.\n"); }; table.mapRange( @@ -71,7 +69,7 @@ pub export fn kmain(hartid: u64, fdt_phys: usize, console_phys: usize, alloc_sta mmu_type, mem.PHYS_MAP_BASE, ) catch { - @panic("Unable to map direct map window.\n"); + @panic("unable to map direct map window.\n"); }; const console_page = std.mem.alignBackward(u64, @intCast(console_phys), mem.PAGE_SIZE); @@ -83,11 +81,10 @@ pub export fn kmain(hartid: u64, fdt_phys: usize, console_phys: usize, alloc_sta mmu_type, mem.PHYS_MAP_BASE, ) catch { - @panic("Unable to map console MMIO.\n"); + @panic("unable to map console MMIO.\n"); }; table.load(mmu_type, mem.PHYS_MAP_BASE); - debug.print("reloaded higher-half kernel page table.\n", .{}); } while (true) {