aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/exceptions.s
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2021-02-28 14:53:13 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2021-02-28 14:53:13 +0200
commit09cf6b4ca8799990b9c01db04c5f4ffbef798773 (patch)
treed660da543cccbfad03d637b34815017d0e477e47 /src/cpu/exceptions.s
parentEnable interrupts (diff)
downloadkernel.cpp-09cf6b4ca8799990b9c01db04c5f4ffbef798773.tar.xz
Fix interrupts causing exception 0xd
Diffstat (limited to 'src/cpu/exceptions.s')
-rw-r--r--src/cpu/exceptions.s51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/cpu/exceptions.s b/src/cpu/exceptions.s
new file mode 100644
index 0000000..9736be1
--- /dev/null
+++ b/src/cpu/exceptions.s
@@ -0,0 +1,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
+