aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/drivers/keyboard.c5
-rw-r--r--kernel/inc/keyboard.h1
-rw-r--r--kernel/main.c1
-rw-r--r--libc/inc/stack.h1
-rw-r--r--libc/stack.c6
5 files changed, 14 insertions, 0 deletions
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c
index 7e295c2..744ca99 100644
--- a/kernel/drivers/keyboard.c
+++ b/kernel/drivers/keyboard.c
@@ -76,6 +76,11 @@ u32 keyboard_ready()
return !stack_empty(queue);
}
+void keyboard_reset()
+{
+ stack_clear(queue);
+}
+
void keyboard_install(void)
{
//keyboard_rate(); TODO: Fix keyboard rate?
diff --git a/kernel/inc/keyboard.h b/kernel/inc/keyboard.h
index 32168f4..af74316 100644
--- a/kernel/inc/keyboard.h
+++ b/kernel/inc/keyboard.h
@@ -4,5 +4,6 @@
#define KEYBOARD_H
void keyboard_install(void);
+void keyboard_reset();
#endif
diff --git a/kernel/main.c b/kernel/main.c
index 563cae7..7466f5d 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -40,6 +40,7 @@ void kernel_main(struct vid_info *vid_info)
// Enable drivers
sti();
+ keyboard_reset();
syscall_init();
proc_init();
diff --git a/libc/inc/stack.h b/libc/inc/stack.h
index 8fec25f..16725f8 100644
--- a/libc/inc/stack.h
+++ b/libc/inc/stack.h
@@ -23,5 +23,6 @@ u32 stack_push_bot(struct stack *stack, void *data);
u32 stack_push(struct stack *stack, void *data);
void *stack_pop(struct stack *stack);
void *stack_peek(struct stack *stack);
+void stack_clear(struct stack *stack);
#endif
diff --git a/libc/stack.c b/libc/stack.c
index dac18a2..c47dd59 100644
--- a/libc/stack.c
+++ b/libc/stack.c
@@ -117,3 +117,9 @@ void *stack_peek(struct stack *stack)
return stack->tail;
}
+
+void stack_clear(struct stack *stack)
+{
+ while (stack_pop(stack))
+ ;
+}