I know in C is more easy but i'm trying to implement the IDT in pure assembly for learning purposes.
Code: Select all
%ifndef IDT
%define IDT
extern K_int_handler
idt_start:
%assign i 0
%rep 32
irq %+i:
dw <ADDRESS OF ISR> & 0FFFFh
dw DATA_SEG ; 0x08
db 0
db 08eh
dw <ADDRESS OF ISR> & 0FFFF0000h) >> 16
%assign i i+1
%endrep
times (255-31) resb 0 ; fill rest of idt
idt_end:
idtr:
dw idt_end - idt_start - 1
dd idt_start
%assign i 0
%rep 32
isr %+i:
cli
pusha
call K_int_handler
popa
sti
iret
%assign i i+1
%endrep
idt_setup:
pusha
cli
lidt [idtr]
sti
popa
ret
%endif ; IDT