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

21
k/idt.c
View File

@ -1,8 +1,9 @@
#include "idt.h"
#include "stdio.h"
#include "pic/pic.h"
#include "io.h"
#include "pic/keyboard.h"
#include "pic/pic.h"
#include "pic/pit.h"
#include "stdio.h"
static struct idt idt = { 0 };
@ -25,17 +26,21 @@ static struct idt_entry_info infos[] = {
{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
// 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)
{
if (args->int_code >= 32)
switch (args->int_code)
{
add_key_to_buffer();
outb(MASTER_PORT_A, OCW2_EOI);
return;
case 32: // PIT
pit_handler();
outb(MASTER_PORT_A, OCW2_EOI);
return;
case 33: // keyboard
keyboard_handler();
outb(MASTER_PORT_A, OCW2_EOI);
return;
}
printf("INTERRUPT: %d, error code: %d\r\n", args->int_code, args->err_code);

View File

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

View File

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