aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/mouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/mouse.c')
-rw-r--r--kernel/drivers/mouse.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/drivers/mouse.c b/kernel/drivers/mouse.c
index 64204c3..a5f5d0c 100644
--- a/kernel/drivers/mouse.c
+++ b/kernel/drivers/mouse.c
@@ -1,5 +1,6 @@
// MIT License, Copyright (c) 2020 Marvin Borner
+#include <boot.h>
#include <cpu.h>
#include <event.h>
#include <interrupts.h>
@@ -29,6 +30,8 @@ void mouse_handler()
case 2:
mouse_byte[2] = inb(0x60);
+ free(event);
+ event = malloc(sizeof(*event));
event->magic = MOUSE_MAGIC;
event->diff_x = mouse_byte[1];
event->diff_y = mouse_byte[2];
@@ -76,8 +79,6 @@ char mouse_read()
void mouse_install()
{
- event = malloc(sizeof(*event));
-
u8 status;
// Enable auxiliary mouse device