From f636fcbadf1c41ca879ae9609d14394d1887969a Mon Sep 17 00:00:00 2001 From: Malo Lecomte Date: Thu, 15 Jul 2021 16:53:58 +0200 Subject: [PATCH] feat(pic): add pic functions to idt --- k/idt.c | 10 +++++++++- k/idt.h | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/k/idt.c b/k/idt.c index 91d0f96..0197e15 100644 --- a/k/idt.c +++ b/k/idt.c @@ -4,6 +4,7 @@ static struct idt idt = { 0 }; static struct idt_entry_info infos[] = { + // Intel-defined (0-20) {int_de, INTERRUPT_TYPE}, {int_db, INTERRUPT_TYPE}, {int_nmi, INTERRUPT_TYPE}, {int_bp, TRAP_TYPE}, {int_of, TRAP_TYPE}, {int_br, INTERRUPT_TYPE}, @@ -14,7 +15,14 @@ static struct idt_entry_info infos[] = { {int_pf, INTERRUPT_TYPE}, {0, INTERRUPT_TYPE}, {int_mf, INTERRUPT_TYPE}, {int_ac, INTERRUPT_TYPE}, {int_mc, INTERRUPT_TYPE}, {int_xm, INTERRUPT_TYPE}, - {int_ve, INTERRUPT_TYPE} + {int_ve, INTERRUPT_TYPE}, + + // Intel-reserved (21-31) + {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) + {0, INTERRUPT_TYPE}, {pic_keyboard, INTERRUPT_TYPE} }; void handle_interrupt(struct int_args *args) diff --git a/k/idt.h b/k/idt.h index b8700a3..68ad454 100644 --- a/k/idt.h +++ b/k/idt.h @@ -5,9 +5,12 @@ #include "gdt.h" #include "isr.h" -#define IDT_NB_ENTRIES 21 +#define IDT_NB_ENTRIES 34 #define IDT_SIZE (IDT_NB_ENTRIES * sizeof(struct idt_entry)) +#define INTEL_DEFINED 21 +#define INTEL_UNUSED 31 + #define INTERRUPT_TYPE 0x6 #define TRAP_TYPE 0x7