%macro IRQ 2
    global irq%1
    irq%1:
        cli
        push byte 0     ; push a dummy error code
        push byte %2    ; push the IRQ number
        jmp  irq_common_stub
%endmacro

extern irq_handler

irq_common_stub:
    pusha             ; push all general-purpose registers
    mov   ax, ds      ; lower 16-bits of eax = ds
    push  eax         ; save the data segment descriptor
    mov   ax, 0x10    ; load the kernel data segment descriptor
    mov   edx, eax
    call  irq_handler

%assign i 0
%rep 8
ISR_NOERRCODE i
%assign i i+1
%endrep

ISR_NOERRCODE 9
