feat(pit): add pit to isr and idt entries

This commit is contained in:
Malo Lecomte 2021-07-17 11:57:21 +02:00
parent 416b4337c7
commit 8762f55b24
3 changed files with 16 additions and 8 deletions

17
k/idt.c

@ -1,8 +1,9 @@
#include "idt.h" #include "idt.h"
#include "stdio.h"
#include "pic/pic.h"
#include "io.h" #include "io.h"
#include "pic/keyboard.h" #include "pic/keyboard.h"
#include "pic/pic.h"
#include "pic/pit.h"
#include "stdio.h"
static struct idt idt = { 0 }; static struct idt idt = { 0 };
@ -25,15 +26,19 @@ static struct idt_entry_info infos[] = {
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
// user-defined (32-255) // user-defined (32-255)
{0, INTERRUPT_TYPE}, {pic_keyboard, INTERRUPT_TYPE} {pic_pit, INTERRUPT_TYPE}, {pic_keyboard, INTERRUPT_TYPE}
}; };
void handle_interrupt(struct int_args *args) void handle_interrupt(struct int_args *args)
{ {
if (args->int_code >= 32) switch (args->int_code)
{ {
add_key_to_buffer(); case 32: // PIT
pit_handler();
outb(MASTER_PORT_A, OCW2_EOI);
return;
case 33: // keyboard
keyboard_handler();
outb(MASTER_PORT_A, OCW2_EOI); outb(MASTER_PORT_A, OCW2_EOI);
return; return;
} }

@ -48,4 +48,5 @@ ISR_NO_ERRCODE(int_xm, 19)
ISR_NO_ERRCODE(int_ve, 20) ISR_NO_ERRCODE(int_ve, 20)
// user-defined // user-defined
ISR_NO_ERRCODE(pic_pit, 32)
ISR_NO_ERRCODE(pic_keyboard, 33) ISR_NO_ERRCODE(pic_keyboard, 33)

@ -24,6 +24,8 @@ void int_xm(void); // SIMD Floating-Point Exception
void int_ve(void); // Virtualization Exception void int_ve(void); // Virtualization Exception
// ISR for PIC interrupts. // ISR for PIC interrupts.
void pic_pit(void);
void pic_keyboard(void); void pic_keyboard(void);
#endif /* !ISR_H */ #endif /* !ISR_H */