Small IDT work, gotta go hiking lol

This commit is contained in:
lordtet 2025-06-17 20:13:09 -04:00
parent 8c51b7010e
commit fbef354410
3 changed files with 9 additions and 7 deletions

View file

@ -17,6 +17,7 @@ typedef struct IDTR_s {
extern IDTR_t idtr; extern IDTR_t idtr;
extern InterruptDescriptor_t* idt_start; extern InterruptDescriptor_t* idt_start;
extern char num_interrupts;
void setup_idt(); void setup_idt();
void write_descriptors(); void write_descriptors();

View file

@ -1,13 +1,15 @@
global idtr, idt_start %define NUM_INTERRUPTS 32
global idtr, idt_start, num_interrupts
section .idtr section .idtr
num_interrupts:
db NUM_INTERRUPTS
idtr: idtr:
;Normally, the size would be the size of the whole table, but i'm only defining 32 interrupts for now. ;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 idt_end - idt_start
dw 32 dw NUM_INTERRUPTS * 8
dd idt_start dd idt_start
section .idt nobits section .idt nobits
idt_start: 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: idt_end:

View file

@ -8,10 +8,9 @@ void setup_idt() {
void write_descriptors() { 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() { void load_idt() {