summaryrefslogtreecommitdiff
path: root/kc/core/cpu/exceptions.h
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-02-13 12:26:58 +0000
committerAda Christine <adachristine18@gmail.com>2022-02-13 12:26:58 +0000
commitc1d179d50751d0ce08dc2b009fc5e334d20db11a (patch)
treec24a48ef55fbfe898b58f61a880ae4e3d96e8440 /kc/core/cpu/exceptions.h
parent23f4c7eaa0bae30bebbac68950e96d17c6d77c36 (diff)
exception changes
Diffstat (limited to 'kc/core/cpu/exceptions.h')
-rw-r--r--kc/core/cpu/exceptions.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/kc/core/cpu/exceptions.h b/kc/core/cpu/exceptions.h
new file mode 100644
index 0000000..c35c8ca
--- /dev/null
+++ b/kc/core/cpu/exceptions.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#define DIVIDE_ZER0_EXCEPTION 0x0
+#define DEBUG_EXCEPTION 0x1
+#define NONMASKABLE_EXCEPTION 0x2
+#define BREAKPOINT_EXCEPTION 0x3
+#define OVERFLOW_EXCEPTION 0x4
+#define BOUND_RANGE_EXCEPTION 0x5
+#define INVALID_OPCODE_EXCEPTION 0x6
+#define DEVICE_NOT_AVAILABLE_EXCEPTION 0x7
+#define DOUBLE_FAULT_EXCEPTION 0x8
+#define INVALID_TSS_EXCEPTION 0x10
+#define SEGMENT_NOT_PRESENT_EXCEPTION 0x11
+#define STACK_EXCEPTION 0xc
+#define GENERAL_PROTECTION_EXCEPTION 0xd
+#define PAGE_FAULT_EXCEPTION 0xe
+#define X87_FLOAT_EXCEPTION 0x10
+#define ALIGNMENT_CHECK_EXCEPTION 0x11
+#define MACHINE_CHECK_EXCEPTION 0x12
+#define SIMD_FLOAT_EXCEPTION 0x13
+
+#ifndef __ASSEMBLER__
+
+void general_protection_isr();
+void general_protection_handler();
+void page_fault_isr();
+void page_fault_handler();
+
+void exceptions_init(void);
+
+#else
+
+.macro EXCEPTION_DECLARE name:req, vec:req
+.hidden \name\()_isr
+.global \name\()_isr
+.extern \name\()_handler
+.type \name\()_isr, @function
+.endm
+
+#endif
+