aboutsummaryrefslogtreecommitdiff
path: root/src/core/int.S
blob: 861d5cc65145723c0f376d5b60f6919bc96146b3 (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
.code64

.extern printk
.extern ack

.macro call_printk msg
    mov \msg, %rdi
    mov $0, %eax # Required for variadic functions
    mov $printk,%rcx
    call *(%rcx)
.endm

.globl INT_DEFAULT
INT_DEFAULT:
    iretq

.globl INT_0
INT_0:
    call_printk $MSG_INT_0
    INT_0_INFINITE:
    jmp INT_0_INFINITE
    iretq

.globl INT_14
INT_14:
    call_printk $MSG_INT_14
    mov $0, %eax
    call printk
    INT_14_INFINITE:
    jmp INT_14_INFINITE
    iretq

.globl INT_KBD
INT_KBD:
    call_printk $MSG_INT_KBD
    call ack
    iretq

MSG_INT_0:
.asciz "Zero Division error!"
MSG_INT_14:
.asciz "Page fault!"
MSG_INT_KBD:
.asciz "Key press!"
MSG:
.asciz "Called :)\n"