changed debug messages on boot
This commit is contained in:
parent
62fefbc836
commit
a76834b849
1 changed files with 6 additions and 9 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue