2019-05-22 21:12:46 +02:00
|
|
|
// Zig version: 0.4.0
|
|
|
|
|
2019-04-17 18:40:26 +02:00
|
|
|
const builtin = @import("builtin");
|
2019-05-28 22:12:41 +02:00
|
|
|
const arch = if (builtin.is_test) @import("../../test/kernel/arch_mock.zig") else @import("arch.zig").internals;
|
2019-05-18 17:26:44 +02:00
|
|
|
const multiboot = @import("multiboot.zig");
|
2019-05-22 21:12:46 +02:00
|
|
|
const tty = @import("tty.zig");
|
|
|
|
const vga = @import("vga.zig");
|
2019-04-17 18:40:26 +02:00
|
|
|
|
|
|
|
pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
|
|
|
|
@setCold(true);
|
2019-05-22 21:12:46 +02:00
|
|
|
tty.print("\nKERNEL PANIC: {}\n", msg);
|
2019-04-17 18:40:26 +02:00
|
|
|
while (true) {}
|
|
|
|
}
|
|
|
|
|
2019-05-18 17:26:44 +02:00
|
|
|
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
|
|
|
|
arch.init();
|
2019-05-22 21:12:46 +02:00
|
|
|
vga.init();
|
|
|
|
tty.init();
|
|
|
|
tty.print("\nHello Pluto from kernel :)\n");
|
2019-05-18 17:26:44 +02:00
|
|
|
}
|
2019-04-17 18:40:26 +02:00
|
|
|
}
|