blob: 3e2ce5df59d85daa6bd9e02d06b7ffc4dfb18ddd [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
43ISRNOERR 17
44ISRNOERR 18
45ISRNOERR 19
46ISRNOERR 20
47ISRNOERR 21
48ISRNOERR 22
49ISRNOERR 23
50ISRNOERR 24
51ISRNOERR 25
52ISRNOERR 26
53ISRNOERR 27
54ISRNOERR 28
55ISRNOERR 29
56ISRNOERR 30
57ISRNOERR 31
58
59
60 [extern isr_handler]
61isr_common:
62 pusha ; Save all registers
63
swissChilidefeb0d2021-02-18 15:28:36 -080064 mov ax, ds ; Save data segment
swissChilid8137922021-02-17 15:34:07 -080065 push eax
66
swissChilidefeb0d2021-02-18 15:28:36 -080067 mov ax, 0x10 ; New segments
swissChilid8137922021-02-17 15:34:07 -080068 mov ds, ax
69 mov es, ax
70 mov fs, ax
71 mov gs, ax
72
73 call isr_handler
74
swissChilidefeb0d2021-02-18 15:28:36 -080075 pop eax ; Reset segments
swissChilid8137922021-02-17 15:34:07 -080076 mov ds, ax
77 mov es, ax
78 mov fs, ax
79 mov gs, ax
80
81 popa
82 add esp, 8 ; Passed arguments
83 sti
84 iret ; Return from interrupt