From 97aa541b349068bcfff00a0ea2994f1b9be8e4a4 Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Tue, 13 Aug 2019 23:28:24 +0200 Subject: [PATCH] keyboard works --- qemu.sh | 5 ++++- src/arch/x86/idt.zig | 3 --- src/arch/x86/isr.s | 2 +- src/console.zig | 7 +++++++ src/ps2.zig | 3 +-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/qemu.sh b/qemu.sh index 5291745..23b8d6a 100755 --- a/qemu.sh +++ b/qemu.sh @@ -11,12 +11,15 @@ start() { -enable-kvm \ -m 1337M \ -curses \ - -serial mon:stdio \ -append "Hello" \ -kernel ${KERNEL} # -device virtio-net,netdev=network0 -netdev tap,id=network0,ifname=tap0,script=no,downscript=no \ # build/kernel.iso "$@" + + # this allows this switch to monitor with ^a-c, but doesn't + # play nice with irqs apparently... + # -serial mon:stdio \ } monitor() { diff --git a/src/arch/x86/idt.zig b/src/arch/x86/idt.zig index f06a0b1..b89ae5c 100644 --- a/src/arch/x86/idt.zig +++ b/src/arch/x86/idt.zig @@ -48,9 +48,6 @@ pub fn setGate(n: u8, flags: u8, offset: extern fn () void) void { idt[n].flags = flags; idt[n].zero = 0; idt[n].selector = gdt.KERNEL_CODE; - println("offset: 0x{x}", @ptrToInt(offset)); - println("low : 0x{x}", idt[n].offset_low); - println("high : 0x{x}", idt[n].offset_high); } //// diff --git a/src/arch/x86/isr.s b/src/arch/x86/isr.s index 3d8d382..46ef4dd 100644 --- a/src/arch/x86/isr.s +++ b/src/arch/x86/isr.s @@ -1,5 +1,5 @@ // Kernel stack for interrupt handling. -KERNEL_STACK = 0x80000 +KERNEL_STACK = 0x800000 // GDT selectors. KERNEL_DS = 0x10 diff --git a/src/console.zig b/src/console.zig index 7ea8291..94a7827 100644 --- a/src/console.zig +++ b/src/console.zig @@ -22,6 +22,13 @@ pub fn keypress(char: u8) void { vga.writeString("> "); command_len = 0; }, + '\x08' => { + //backspace + return; + }, + '\x00' => { + return; + }, else => { if (command_len == 10) return; diff --git a/src/ps2.zig b/src/ps2.zig index 84aced6..dfdf58b 100644 --- a/src/ps2.zig +++ b/src/ps2.zig @@ -20,7 +20,7 @@ const KEYMAP_US = [_][2]u8{ "0)", "-_", "=+", - "\x00\x00", //backspace + "\x08\x08", //backspace "\x00\x00", //tab "qQ", "wW", @@ -85,7 +85,6 @@ fn key_isrelease(scancode: u8) bool { pub fn keyboard_handler() void { const scancode = ps2_scancode(); const isrelease = key_isrelease(scancode); - println("keyboard scancode 0b{b}", scancode); if (isrelease) { return; }