From d94b024b73aeca06de417e0fd3c502495312a8b2 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 7 Dec 2019 13:40:28 +0100 Subject: Added userspace libc and began userspace based shell --- src/kernel/input/ps2/keyboard.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/kernel/input/ps2/keyboard.c') diff --git a/src/kernel/input/ps2/keyboard.c b/src/kernel/input/ps2/keyboard.c index 7294349..9e133ef 100644 --- a/src/kernel/input/ps2/keyboard.c +++ b/src/kernel/input/ps2/keyboard.c @@ -1,6 +1,11 @@ #include #include #include +#include +#include +#include +#include +#include int shift_pressed; int control_pressed; @@ -101,7 +106,7 @@ void keyboard_handler(struct regs *r) return; } - vesa_keyboard_char(current_keymap[scan_code]); + keyboard_buffer[strlen(keyboard_buffer)] = current_keymap[scan_code]; } else { // RELEASE if (current_keymap[scan_code] == -107) // TODO: IDK WHY -107?! control_pressed = 0; @@ -120,9 +125,17 @@ void keyboard_rate() outb(0x60, 0x0); // Rate{00000} Delay{00} 0 } +void keyboard_clear_buffer() +{ + memset(keyboard_buffer, 0, 4096); +} + // Installs the keyboard handler into IRQ1 void keyboard_install() { + keyboard_buffer = (char *) paging_alloc_pages(1); // 4KiB + paging_set_user((uint32_t) keyboard_buffer, 1); + keyboard_rate(); irq_install_handler(1, keyboard_handler); shift_pressed = 0; -- cgit v1.2.3