I want my kernel to theoretically use all interrupt handlers, so I'd have to define 256 dummy interrupt handlers.

This way sounds like the most efficient one, only I got a little deterred from that method because of the warnings in the wiki article.It works fine this way (installing IDT entries via C function pointers) so long as you know how to fix up the stack...
That's possible, only that would make it static.However, a better option may be just to define the exceptions, IRQ's and whatever else you actually use, rather than having 207 handlers sitting around doing nothing
Code: Select all
idt_set_gate(0, isr0, GDT_CODE_SEG, IDT_RING0 | IDT_GATE_INT_32 | IDT_PRESENT);
idt_set_gate(1, isr1, GDT_CODE_SEG, IDT_RING0 | IDT_GATE_INT_32 | IDT_PRESENT);
idt_set_gate(2, isr2, GDT_CODE_SEG, IDT_RING0 | IDT_GATE_INT_32 | IDT_PRESENT);
idt_set_gate(3, isr3, GDT_CODE_SEG, IDT_RING0 | IDT_GATE_INT_32 | IDT_PRESENT);
idt_set_gate(4, isr4, GDT_CODE_SEG, IDT_RING0 | IDT_GATE_INT_32 | IDT_PRESENT);
..etc
Code: Select all
for (i = 0; i < 255; i++)
idt_set_gate(i, isr0 + i * 10, GDT_CODE_SEG, IDT_RING0 | IDT_GATE_INT_32 | IDT_PRESENT);
Code: Select all
isr7:
cli
push byte 0
push byte 7
jmp isr_common_stub
isr8:
cli
nop
nop
nop
nop
nop
push byte 8
jmp isr_common_stub
isr9:
cli
push byte 0
push byte 9
jmp isr_common_stub
..etc
Good suggestion!Are you sure you want to decode and execute all those nops?
Code: Select all
%macro ISR_ERRCODE 1
global _isr%1
_isr%1:
cli
push byte %1
jmp isrStub
nop
nop
%endmacro