swissChili | 9b3584b | 2021-02-18 13:57:27 -0800 | [diff] [blame] | 1 | [bits 32] |
| 2 | |
| 3 | %macro IRQ 2 |
| 4 | [global irq%1] |
| 5 | irq%1: |
| 6 | cli |
swissChili | 825d46b | 2021-02-21 10:14:16 -0800 | [diff] [blame] | 7 | push 0 ; Error code |
| 8 | push %2 ; Interrupt number |
swissChili | 9b3584b | 2021-02-18 13:57:27 -0800 | [diff] [blame] | 9 | jmp irq_common |
| 10 | %endmacro |
| 11 | |
| 12 | IRQ 0, 32 |
| 13 | IRQ 1, 33 |
| 14 | IRQ 2, 34 |
| 15 | IRQ 3, 35 |
| 16 | IRQ 4, 36 |
| 17 | IRQ 5, 37 |
| 18 | IRQ 6, 38 |
| 19 | IRQ 7, 39 |
| 20 | IRQ 8, 40 |
| 21 | IRQ 9, 41 |
| 22 | IRQ 10, 42 |
| 23 | IRQ 11, 43 |
| 24 | IRQ 12, 44 |
| 25 | IRQ 13, 45 |
| 26 | IRQ 14, 46 |
| 27 | IRQ 15, 47 |
| 28 | |
| 29 | [extern irq_handler] |
| 30 | irq_common: |
swissChili | 1e8b756 | 2021-12-22 21:22:57 -0800 | [diff] [blame] | 31 | pushad |
swissChili | 9b3584b | 2021-02-18 13:57:27 -0800 | [diff] [blame] | 32 | mov ax, ds ; Save data segment |
| 33 | push eax |
| 34 | |
| 35 | mov ax, 0x10 ; New segments |
| 36 | mov ds, ax |
| 37 | mov es, ax |
| 38 | mov fs, ax |
| 39 | mov gs, ax |
| 40 | |
| 41 | call irq_handler |
| 42 | |
| 43 | pop ebx ; Old data segment |
| 44 | mov ds, bx |
| 45 | mov es, bx |
| 46 | mov fs, bx |
| 47 | mov gs, bx |
| 48 | |
swissChili | 1e8b756 | 2021-12-22 21:22:57 -0800 | [diff] [blame] | 49 | popad |
swissChili | 9b3584b | 2021-02-18 13:57:27 -0800 | [diff] [blame] | 50 | add esp, 8 |
| 51 | sti |
| 52 | iret |
| 53 | |