blob: 5ed637efb36229f7d1975b94aebb1dc64ce3fd77 [file] [log] [blame]
swissChilid8137922021-02-17 15:34:07 -08001 [bits 32]
2 [global idt_flush]
3
4idt_flush:
5 mov eax, [esp + 4]
6 lidt [eax]
7 ret
8
9%macro ISRNOERR 1
10 [global isr%1]
11isr%1:
12 cli
swissChili825d46b2021-02-21 10:14:16 -080013 push 0
14 push %1
swissChilid8137922021-02-17 15:34:07 -080015 jmp isr_common
16%endmacro
17
18%macro ISRERR 1
19 [global isr%1]
20isr%1:
21 cli
22 push byte %1
23 jmp isr_common
24%endmacro
25
26ISRNOERR 0
27ISRNOERR 1
28ISRNOERR 2
29ISRNOERR 3
30ISRNOERR 4
31ISRNOERR 5
32ISRNOERR 6
33ISRNOERR 7
34ISRERR 8
35ISRNOERR 9
36ISRERR 10
37ISRERR 11
38ISRERR 12
39ISRERR 13
40ISRERR 14
41ISRNOERR 15
42ISRNOERR 16
swissChilib58ab672022-01-17 21:18:01 -080043ISRERR 17
swissChilid8137922021-02-17 15:34:07 -080044ISRNOERR 18
45ISRNOERR 19
46ISRNOERR 20
swissChilib58ab672022-01-17 21:18:01 -080047ISRERR 21
swissChilid8137922021-02-17 15:34:07 -080048ISRNOERR 22
49ISRNOERR 23
50ISRNOERR 24
51ISRNOERR 25
52ISRNOERR 26
53ISRNOERR 27
54ISRNOERR 28
55ISRNOERR 29
56ISRNOERR 30
57ISRNOERR 31
58
swissChiliee6d10d2021-05-29 18:05:16 -070059ISRNOERR 128
60ISRNOERR 129
swissChilid8137922021-02-17 15:34:07 -080061
62 [extern isr_handler]
63isr_common:
swissChili1e8b7562021-12-22 21:22:57 -080064 pushad ; Save all registers
swissChilid8137922021-02-17 15:34:07 -080065
swissChilidefeb0d2021-02-18 15:28:36 -080066 mov ax, ds ; Save data segment
swissChilid8137922021-02-17 15:34:07 -080067 push eax
68
swissChilidefeb0d2021-02-18 15:28:36 -080069 mov ax, 0x10 ; New segments
swissChilid8137922021-02-17 15:34:07 -080070 mov ds, ax
71 mov es, ax
72 mov fs, ax
73 mov gs, ax
74
75 call isr_handler
76
swissChilidefeb0d2021-02-18 15:28:36 -080077 pop eax ; Reset segments
swissChilid8137922021-02-17 15:34:07 -080078 mov ds, ax
79 mov es, ax
80 mov fs, ax
81 mov gs, ax
82
swissChili1e8b7562021-12-22 21:22:57 -080083 popad
swissChilid8137922021-02-17 15:34:07 -080084 add esp, 8 ; Passed arguments
85 sti
86 iret ; Return from interrupt