90 lines
1.3 KiB
NASM
90 lines
1.3 KiB
NASM
extern idt_exception_handler
|
|
extern idt_pic_timer
|
|
extern idt_pic_keyboard
|
|
extern idt_pic_generic
|
|
global isr_stub_table
|
|
|
|
%macro ISRErrorStub 1
|
|
isr_stub_%+%1:
|
|
push dword %1
|
|
call idt_exception_handler
|
|
pop eax
|
|
iret
|
|
%endmacro
|
|
|
|
%macro PICGeneric 1
|
|
isr_stub_%+%1:
|
|
push dword %1
|
|
call idt_pic_generic
|
|
pop eax
|
|
iret
|
|
%endmacro
|
|
|
|
%macro PICTimer 1
|
|
isr_stub_%+%1:
|
|
push dword %1
|
|
call idt_pic_generic
|
|
call idt_pic_timer
|
|
pop eax
|
|
iret
|
|
%endmacro
|
|
|
|
%macro PICKeyboard 1
|
|
isr_stub_%+%1:
|
|
push dword %1
|
|
call idt_pic_generic
|
|
call idt_pic_keyboard
|
|
pop eax
|
|
iret
|
|
%endmacro
|
|
|
|
%macro ISRSyscall 1
|
|
isr_stub_%+%1:
|
|
push eax
|
|
push ebx
|
|
push ecx
|
|
push edx
|
|
call idt_syscall
|
|
add esp, 16
|
|
pop eax
|
|
iret
|
|
%endmacro
|
|
|
|
section .text
|
|
align 8
|
|
%assign i 0
|
|
%rep 32
|
|
ISRErrorStub i
|
|
%assign i i+1
|
|
%endrep
|
|
PICTimer 32
|
|
PICKeyboard 33
|
|
PICGeneric 34
|
|
PICGeneric 35
|
|
PICGeneric 36
|
|
PICGeneric 37
|
|
PICGeneric 38
|
|
PICGeneric 39
|
|
PICGeneric 40
|
|
PICGeneric 41
|
|
PICGeneric 42
|
|
PICGeneric 43
|
|
PICGeneric 44
|
|
PICGeneric 45
|
|
PICGeneric 46
|
|
PICGeneric 47
|
|
%assign i 48
|
|
%rep 256 - 48
|
|
ISRErrorStub i
|
|
%assign i i+1
|
|
%endrep
|
|
|
|
section .rodata
|
|
align 8
|
|
isr_stub_table:
|
|
%assign i 0x00
|
|
%rep 256
|
|
dd isr_stub_%+i
|
|
%assign i i+0x01
|
|
%endrep
|