Update code to work with zig master

This commit is contained in:
Sam Tebbs 2020-01-01 19:12:36 +00:00
parent 4b870d3a65
commit 91b2a61acf
26 changed files with 476 additions and 438 deletions

View file

@ -27,14 +27,14 @@ export var KERNEL_ADDR_OFFSET: u32 = if (builtin.is_test) 0xC0000000 else undefi
// Just call the panic function, as this need to be in the root source file
pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
@setCold(true);
panic_root.panic(error_return_trace, "{}", msg);
panic_root.panic(error_return_trace, "{}", .{msg});
}
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 |e| {
panic_root.panic(@errorReturnTrace(), "Failed to initialise serial: {}", e);
panic_root.panic(@errorReturnTrace(), "Failed to initialise serial: {}", .{e});
};
if (build_options.rt_test)
log.runtimeTests();
@ -42,17 +42,17 @@ export fn kmain(mb_info: *multiboot.multiboot_info_t, mb_magic: u32) void {
var buffer = mem_profile.vaddr_end[0..mem_profile.fixed_alloc_size];
var fixed_allocator = std.heap.FixedBufferAllocator.init(buffer);
log.logInfo("Init arch " ++ @tagName(builtin.arch) ++ "\n");
log.logInfo("Init arch " ++ @tagName(builtin.arch) ++ "\n", .{});
arch.init(mb_info, &mem_profile, &fixed_allocator.allocator);
log.logInfo("Arch init done\n");
log.logInfo("Arch init done\n", .{});
panic_root.init(&mem_profile, &fixed_allocator.allocator) catch |e| {
panic_root.panic(@errorReturnTrace(), "Failed to initialise panic: {}", e);
panic_root.panic(@errorReturnTrace(), "Failed to initialise panic: {}", .{e});
};
vga.init();
tty.init();
log.logInfo("Init done\n");
tty.print("Hello Pluto from kernel :)\n");
log.logInfo("Init done\n", .{});
tty.print("Hello Pluto from kernel :)\n", .{});
// The panic runtime tests must run last as they never return
if (options.rt_test) panic_root.runtimeTests();
}