]> git.dujemihanovic.xyz Git - nameless-os.git/blob - kernel/arch/x86/irq/stub.s
Rework interrupt handling
[nameless-os.git] / kernel / arch / x86 / irq / stub.s
1 ; Stubs for interrupt handlers
2
3 bits 32
4 section .text
5
6 extern int_handler
7
8 int_common:
9 cld
10 call int_handler
11 add esp, 4
12 popad
13 iretd
14
15 %macro INTERRUPT 1
16 global int%1
17 int_%1:
18 pushad
19 push dword %1
20 jmp int_common
21 %endmacro
22
23 %assign i 0
24 %rep 48
25 INTERRUPT i
26 %assign i i+1
27 %endrep
28
29 ; Define flat table containing addresses of handlers
30 section .rodata
31 global _int_handler_table
32 _int_handler_table:
33 %macro INT 1
34 dd int_%1
35 %endmacro
36
37 %assign i 0
38 %rep 48
39 INT i
40 %assign i i+1
41 %endrep