diff options
author | Marvin Borner | 2019-12-07 13:40:28 +0100 |
---|---|---|
committer | Marvin Borner | 2019-12-07 13:40:28 +0100 |
commit | d94b024b73aeca06de417e0fd3c502495312a8b2 (patch) | |
tree | bff5cc1b757eeed7f58878cc13551c63464c5a31 /src/kernel/input/ps2 | |
parent | 322167ceab19588473f9074e761390fdeb701790 (diff) |
Added userspace libc and began userspace based shell
Diffstat (limited to 'src/kernel/input/ps2')
-rw-r--r-- | src/kernel/input/ps2/keyboard.c | 15 | ||||
-rw-r--r-- | src/kernel/input/ps2/mouse.c | 2 |
2 files changed, 15 insertions, 2 deletions
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 <kernel/interrupts/interrupts.h> #include <kernel/io/io.h> #include <kernel/graphics/vesa.h> +#include <kernel/input/input.h> +#include <kernel/lib/stdlib/liballoc.h> +#include <kernel/lib/string.h> +#include <kernel/paging/paging.h> +#include <kernel/lib/lib.h> 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; diff --git a/src/kernel/input/ps2/mouse.c b/src/kernel/input/ps2/mouse.c index cb7406f..75d80a1 100644 --- a/src/kernel/input/ps2/mouse.c +++ b/src/kernel/input/ps2/mouse.c @@ -150,4 +150,4 @@ void mouse_install() // Setup the mouse handler irq_install_handler(12, mouse_handler); info("Installed mouse handler"); -} +}
\ No newline at end of file |