diff --git a/include/idt.h b/include/idt.h index 671d5f0..90ab51a 100644 --- a/include/idt.h +++ b/include/idt.h @@ -17,6 +17,7 @@ typedef struct IDTR_s { extern IDTR_t idtr; extern InterruptDescriptor_t* idt_start; +extern char num_interrupts; void setup_idt(); void write_descriptors(); diff --git a/src/allocidt.s b/src/allocidt.s index 18f6f6b..263a1aa 100644 --- a/src/allocidt.s +++ b/src/allocidt.s @@ -1,13 +1,15 @@ -global idtr, idt_start +%define NUM_INTERRUPTS 32 +global idtr, idt_start, num_interrupts section .idtr + num_interrupts: + db NUM_INTERRUPTS idtr: ;Normally, the size would be the size of the whole table, but i'm only defining 32 interrupts for now. ;dw idt_end - idt_start - dw 32 + dw NUM_INTERRUPTS * 8 dd idt_start - section .idt nobits idt_start: - resb 256 * 8 ;idt technically has 256 entries by the spec, so i'm reserving that much space... even if i dont implement that many. + resb NUM_INTERRUPTS * 8 idt_end: diff --git a/src/idt.c b/src/idt.c index 1daa346..b353ff2 100644 --- a/src/idt.c +++ b/src/idt.c @@ -8,10 +8,9 @@ void setup_idt() { void write_descriptors() { - for(int i = 0; i < idtr.size; i+=(sizeof(InterruptDescriptor_t))) { - + for(int i = 0; i < num_interrupts; i++) { + } - return; } void load_idt() {