Newer
Older
tree-os / src / kernel / drivers / interrupts / exceptions.asm
%macro isr 1
    global isrHandler%1
    isrHandler%1:
        push byte 0
        push byte %1
        jmp exceptionHandler
%endmacro

%macro isr_error 1
    global isrHandler%1
    isrHandler%1:
        push byte %1
        jmp exceptionHandler
%endmacro

isrs:
    isr 0
    isr 1
    isr 2
    isr 3
    isr 4
    isr 5
    isr 6
    isr 7
    isr_error 8
    isr 9
    isr_error 10
    isr_error 11
    isr_error 12
    isr_error 13
    isr_error 14
    isr 15
    isr 16
    isr_error 17
    isr 18
    isr 19
    isr 20
    isr 21
    isr 22
    isr 23
    isr 24
    isr 25
    isr 26
    isr 27
    isr 28
    isr 29
    isr_error 30
    isr 31

extern handleException

exceptionHandler:
    pusha
    push ds
    push es
    push fs
    push gs
    mov ax, 0x10
    mov ds, ax
    mov es, ax
    mov fs, ax
    mov gs, ax
    mov eax, esp
    push eax
    mov eax, handleException
    call eax
    pop eax
    pop gs
    pop fs
    pop es
    pop ds
    popa
    add esp, 8
    iret