aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers')
-rw-r--r--kernel/drivers/interrupts.c4
-rw-r--r--kernel/drivers/keyboard.c6
-rw-r--r--kernel/drivers/mouse.c6
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)