rendered paste bodyGLOBAL asm_load_idt
GLOBAL inthandler_default
EXTERN int_handler
%macro ISR_ERROR 1
isr%1: cli
push byte %1 ; Interrupt number
jmp inthandler_handled
%endmacro
%macro ISR_NOERROR 1
isr%1: cli
push byte 0 ; No error
push byte %1 ; Interrupt number
jmp inthandler_handled
%endmacro
asm_load_idt:
mov eax, [esp + 4]
lidt [eax]
ret
inthandler_default:
push byte 0xFF ; ERROR 0xFF INT 0xFF indicates unspecified interrupt
push byte 0xFF
jmp inthandler_handled
inthandler_handled:
pushad
cli
mov eax, ds
push eax
mov eax, 0x10
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
call int_handler
pop ds
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
popad
sti
iret
GLOBAL isr
isr:
%assign i 0
%rep 19
dd isr %+ i
%endrep
%assign i 0
%rep 19
%if (i == 8) || ((i >= 10) && (i <= 14))
ISR_ERROR i
%else
ISR_NOERROR i
%endif
%assign i i + 1
%endrep