diff options
author | Marvin Borner | 2021-03-14 16:06:57 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-14 16:06:57 +0100 |
commit | 6dec7db5158447b66f31a3f786ce2916cab83cec (patch) | |
tree | 2dbc3e52d90dab4aae8021773f09b6b72a74b8cb /kernel/drivers | |
parent | 2f8328f2a41b77eea297ee7fc28818331d4e6c54 (diff) |
Maaany fixes :)
I don't have the motivation to write better commit messages...
Diffstat (limited to 'kernel/drivers')
-rw-r--r-- | kernel/drivers/interrupts.c | 4 | ||||
-rw-r--r-- | kernel/drivers/keyboard.c | 6 | ||||
-rw-r--r-- | kernel/drivers/mouse.c | 6 |
3 files changed, 10 insertions, 6 deletions
diff --git a/kernel/drivers/interrupts.c b/kernel/drivers/interrupts.c index fe2321a..2e1444f 100644 --- a/kernel/drivers/interrupts.c +++ b/kernel/drivers/interrupts.c @@ -5,6 +5,7 @@ #include <def.h> #include <interrupts.h> #include <mem.h> +#include <mm.h> #include <print.h> #include <proc.h> #include <serial.h> @@ -236,6 +237,9 @@ static void isr_install(void) // Set default routines for (u32 i = 0; i < 256; i++) isr_routines[i] = isr_panic; + + // Set page fault handler + isr_install_handler(14, page_fault_handler); } /** diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c index 3ae3c0e..dbee8e1 100644 --- a/kernel/drivers/keyboard.c +++ b/kernel/drivers/keyboard.c @@ -66,10 +66,10 @@ static s32 keyboard_read(void *buf, u32 offset, u32 count, struct device *dev) if (stack_empty(queue)) return -1; - struct event *e = stack_pop(queue); - memcpy(buf, (u8 *)e + offset, count); + struct event_keyboard *e = stack_pop(queue); + memcpy(buf, (u8 *)e + offset, MIN(count, sizeof(*e))); free(e); - return count; + return MIN(count, sizeof(*e)); } static u8 keyboard_ready(void) diff --git a/kernel/drivers/mouse.c b/kernel/drivers/mouse.c index 40094d1..5c481da 100644 --- a/kernel/drivers/mouse.c +++ b/kernel/drivers/mouse.c @@ -94,10 +94,10 @@ static s32 mouse_read(void *buf, u32 offset, u32 count, struct device *dev) if (stack_empty(queue)) return -1; - struct event *e = stack_pop(queue); - memcpy(buf, (u8 *)e + offset, count); + struct event_mouse *e = stack_pop(queue); + memcpy(buf, (u8 *)e + offset, MIN(count, sizeof(*e))); free(e); - return count; + return MIN(count, sizeof(*e)); } void mouse_install(void) |