aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/exceptions.s
blob: 9736be1be852410cdb2dde845c89b9bae99f02ad (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
51
.section .text
.extern print_exception

.macro exception num
.global exception\num
exception\num:
    movb $\num, (exc)
    jmp exception_common
.endm

exception 0x00
exception 0x01
exception 0x02
exception 0x03
exception 0x04
exception 0x05
exception 0x06
exception 0x07
exception 0x08
exception 0x09
exception 0x0a
exception 0x0b
exception 0x0c
exception 0x0d
exception 0x0e
exception 0x0f
exception 0x10
exception 0x11
exception 0x12
exception 0x13

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

    push (exc)
    call print_exception

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

.data
    exc: .byte 0