diff --git a/k/Makefile b/k/Makefile index f56fdfa..0eee6ca 100644 --- a/k/Makefile +++ b/k/Makefile @@ -34,7 +34,8 @@ OBJS = \ gdt.o \ events/idt.o \ events/isr.o \ - events/pic/pic.o + events/pic/pic.o \ + events/pic/keyboard.o DEPS = $(OBJS:.o=.d) diff --git a/k/events/idt.c b/k/events/idt.c index c13418a..735cc24 100644 --- a/k/events/idt.c +++ b/k/events/idt.c @@ -1,6 +1,7 @@ #include "idt.h" #include "stdio.h" #include "pic/pic.h" +#include "pic/keyboard.h" #include "io.h" static struct idt idt = { 0 }; @@ -45,6 +46,14 @@ static struct idt_entry_descriptor idt_entries_descriptors[IDT_NB_ENTRIES] = { void interrupt_handler(struct isr_param *isr_param) { printf("Oh no %d!\r\n", isr_param->int_vector); + + switch (isr_param->int_vector) + { + case KEYBOARD_INT_VECTOR: + keyboard_handler(); + break; + } + if (isr_param->int_vector > IDT_RESERVED_ENTRIES && isr_param->int_vector < IDT_RESERVED_ENTRIES + 16) acknowledge(isr_param->int_vector); diff --git a/k/events/idt.h b/k/events/idt.h index 88a306a..b50948f 100644 --- a/k/events/idt.h +++ b/k/events/idt.h @@ -12,6 +12,8 @@ #define INTERRUPT_TYPE 0x6 #define TRAP_TYPE 0x7 +#define KEYBOARD_INT_VECTOR 33 + struct idt_entry { uint16_t offset_1 : 16; diff --git a/k/events/pic/keyboard.c b/k/events/pic/keyboard.c new file mode 100644 index 0000000..47f2c85 --- /dev/null +++ b/k/events/pic/keyboard.c @@ -0,0 +1,7 @@ +#include "keyboard.h" +#include "io.h" + +void keyboard_handler(void) +{ + inb(KEYBOARD_IO); +} diff --git a/k/events/pic/keyboard.h b/k/events/pic/keyboard.h new file mode 100644 index 0000000..8913deb --- /dev/null +++ b/k/events/pic/keyboard.h @@ -0,0 +1,9 @@ +#ifndef KEYBOARD_H +#define KEYBOARD_H + +#define KEYBOARD_IO 0x60 +#define KEYBOARD_STATUS 0x64 + +void keyboard_handler(void); + +#endif /* !KEYBOARD_H */