aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/interrupts.s
blob: 17c39e9a6acb62dda6a4e087aa8305619e56cf38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.section .text
.extern handle_interrupt

.macro interrupt num
.global interrupt\num
interrupt\num:
    movb $\num, (irq)
    jmp interrupt_common
.endm

interrupt 0x00  # system timer
interrupt 0x01  # keyboard controller
interrupt 0x02  # slave pic
interrupt 0x03  # serial port 2 and 4
interrupt 0x04  # serial port 1 and 3
interrupt 0x05  # parallel port 2 and 3, sound card
interrupt 0x06  # floppy controller
interrupt 0x07  # parallel port 1

interrupt 0x08  # real-time clock
interrupt 0x09  # acpi
interrupt 0x0a  #
interrupt 0x0b  #
interrupt 0x0c  # mouse on ps/2
interrupt 0x0d  # fpu
interrupt 0x0e  # primary ATA
interrupt 0x0f  # secondary ATA

interrupt_common:
    pusha
    pushl %ds
    pushl %es
    pushl %fs
    pushl %gs

    pushl %esp
    push (irq)
    call handle_interrupt
    mov %eax, %esp

    popl %gs
    popl %fs
    popl %es
    popl %ds
    popa
    iret

.data
    irq: .byte 0