summaryrefslogtreecommitdiff
path: root/src/interrupt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interrupt.c')
-rw-r--r--src/interrupt.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/interrupt.c b/src/interrupt.c
new file mode 100644
index 0000000..97bc921
--- /dev/null
+++ b/src/interrupt.c
@@ -0,0 +1,41 @@
+#include "aplos.h"
+
+static char8_t *descriptions[256] = {
+ [0] = u8"divide-by-zero-error",
+ [1] = u8"debug",
+ [2] = u8"non-maskable-interrupt",
+ [3] = u8"breakpoint",
+ [4] = u8"overflow",
+ [5] = u8"bound-range",
+ [6] = u8"invalid-opcode",
+ [7] = u8"device-not-available",
+ [8] = u8"double-fault",
+ [9] = u8"coprocessor-segment-overrun",
+ [10] = u8"invalid-tss",
+ [11] = u8"segment-not-present",
+ [12] = u8"stack",
+ [13] = u8"general-protection",
+ [14] = u8"page-fault",
+ [16] = u8"x87 floating-point exception-pending",
+ [17] = u8"alignment-check",
+ [18] = u8"machine-check",
+ [19] = u8"simd floating-point",
+ [21] = u8"control protection",
+ [28] = u8"hypervisor injection exception",
+ [29] = u8"vmm communication exception",
+ [30] = u8"security exception",
+};
+
+void
+interrupt_handler(uint8_t n)
+{
+ char8_t *desc = descriptions[n];
+
+ print(u8"Got interrupt: %u8", n);
+ if(desc)
+ print(u8" (%s)", desc);
+ print(u8"\n");
+ panic();
+}
+
+