Add logging

This commit is contained in:
Sam Tebbs 2019-06-22 10:00:57 +01:00 committed by SamTebbs33
parent 1b8244adfa
commit 7e5b7b2331
6 changed files with 45 additions and 3 deletions

View file

@ -5,6 +5,7 @@ const arch = if (builtin.is_test) @import("../../test/kernel/arch_mock.zig") els
const multiboot = @import("multiboot.zig");
const tty = @import("tty.zig");
const vga = @import("vga.zig");
const log = @import("log.zig");
const serial = @import("serial.zig");
// Need to import this as we need the panic to be in the root source file, or zig will just use the
@ -21,11 +22,14 @@ pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn
pub export fn kmain(mb_info: *multiboot.multiboot_info_t, mb_magic: u32) void {
if (mb_magic == multiboot.MULTIBOOT_BOOTLOADER_MAGIC) {
// Booted with compatible bootloader
serial.init(serial.DEFAULT_BAUDRATE, serial.Port.COM1) catch unreachable;
log.logInfo("Init arch " ++ @tagName(builtin.arch) ++ "\n");
arch.init();
vga.init();
tty.init();
serial.init(serial.DEFAULT_BAUDRATE, serial.Port.COM1) catch unreachable;
log.logInfo("Finished init\n");
tty.print("Hello Pluto from kernel :)\n");
// Enable interrupts