summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/hal/idt.h
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-09-04 11:31:40 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-09-04 11:31:40 -0400
commit8251da342161767fe203627223ccd4a7026701c6 (patch)
treeaf2db0f11b0ea8ad35f88663a855bab39a80f679 /arch/x86_64/hal/idt.h
downloadjove-kernel-8251da342161767fe203627223ccd4a7026701c6.tar.gz
jove-kernel-8251da342161767fe203627223ccd4a7026701c6.tar.bz2
jove-kernel-8251da342161767fe203627223ccd4a7026701c6.zip
initial commit. working on tasking
Diffstat (limited to 'arch/x86_64/hal/idt.h')
-rw-r--r--arch/x86_64/hal/idt.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/arch/x86_64/hal/idt.h b/arch/x86_64/hal/idt.h
new file mode 100644
index 0000000..961e720
--- /dev/null
+++ b/arch/x86_64/hal/idt.h
@@ -0,0 +1,66 @@
+#ifndef _JOVE_x86_64_HAL_IDT_H
+#define _JOVE_x86_64_HAL_IDT_H 1
+
+#include <stdint.h>
+#include "jove.h"
+#include "../x86_64.h"
+
+struct idt_entry
+{
+ uint16_t offset_0_15;
+ uint16_t segment_selector;
+ union {
+ struct {
+ uint8_t ist : 3;
+ uint8_t zero_1 : 5;
+ uint8_t type : 4;
+ uint8_t zero_2 : 1;
+ uint8_t dpl : 2;
+ uint8_t p : 1;
+ };
+ uint16_t flags;
+ };
+ uint16_t offset_16_31;
+ uint32_t offset_32_63;
+ uint32_t resv;
+};
+
+#define IDT_INTERRUPT_GATE 0xE
+
+struct idt_descriptor
+{
+ uint16_t limit;
+ uint64_t base;
+} PACKED;
+
+struct int_stackframe
+{
+ struct cpu_state state;
+ uint64_t int_num, int_err;
+ uint64_t int_rip, int_cs, int_flags, int_rsp, int_rss;
+};
+
+#define IDT_ENTRIES 48
+
+#define IDT_EXCEPT_DE 0
+#define IDT_EXCEPT_DB 1
+#define IDT_EXCEPT_NMI 2
+#define IDT_EXCEPT_BP 3
+#define IDT_EXCEPT_OF 4
+#define IDT_EXCEPT_BR 5
+#define IDT_EXCEPT_UD 6
+#define IDT_EXCEPT_NM 7
+#define IDT_EXCEPT_DF 8
+#define IDT_EXCEPT_TS 10
+#define IDT_EXCEPT_NP 11
+#define IDT_EXCEPT_SS 12
+#define IDT_EXCEPT_GP 13
+#define IDT_EXCEPT_PF 14
+#define IDT_EXCEPT_MF 16
+#define IDT_EXCEPT_AC 17
+#define IDT_EXCEPT_MC 18
+#define IDT_EXCEPT_XM 19
+#define IDT_EXCEPT_VE 20
+#define IDT_EXCEPT_CP 21
+
+#endif