diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/debugcon.zig | 2 | ||||
| -rw-r--r-- | src/main.zig | 22 |
2 files changed, 7 insertions, 17 deletions
diff --git a/src/debugcon.zig b/src/debugcon.zig index 2049d22..94045ab 100644 --- a/src/debugcon.zig +++ b/src/debugcon.zig @@ -2,7 +2,6 @@ pub inline fn inb(port: u16) u8 { return asm volatile ("inb %[port], %[result]" : [result] "={al}" (-> u8), : [port] "{dx}" (port), - : "dx", "al" ); } @@ -11,7 +10,6 @@ pub inline fn outb(port: u16, data: u8) void { : : [port] "{dx}" (port), [data] "{al}" (data), - : "dx", "al" ); } diff --git a/src/main.zig b/src/main.zig index 30c21a4..c506192 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,4 +1,3 @@ -const console = @import("console.zig"); const debug = @import("debugcon.zig"); const ALIGN = 1 << 0; @@ -21,28 +20,21 @@ export const multiboot align(4) linksection(".multiboot") = MultibootHeader{ export var stack: [16 * 1024]u8 align(16) linksection(".bss") = undefined; const stack_bytes_slice = stack[0..]; -export fn _start() callconv(.C) noreturn { - debug.write("test\n"); - debug.outb(0xe9, 'H'); - debug.outb(0xe9, 'i'); - debug.outb(0xe9, '!'); - debug.outb(0xe9, '\n'); - +export fn _start() callconv(.Naked) noreturn { asm volatile ( \\ mov %[stk], %rsp \\ mov %rsp, %rbp : : [stk] "{rcx}" (@intFromPtr(&stack) + @sizeOf(@TypeOf(stack))), ); - asm volatile ("call kmain"); - - while (true) {} + asm volatile ("jmp kmain"); } export fn kmain() void { - debug.outb(0xe9, '^'); - console.initialize(); - console.puts("Hello world!"); - debug.outb(0xe9, '$'); + debug.outb(0xe9, 'H'); + debug.outb(0xe9, 'i'); + debug.outb(0xe9, '!'); debug.outb(0xe9, '\n'); + + while (true) {} } |
