aboutsummaryrefslogtreecommitdiff
path: root/src/core/idt.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/idt.hpp')
-rw-r--r--src/core/idt.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/idt.hpp b/src/core/idt.hpp
new file mode 100644
index 0000000..f2aca43
--- /dev/null
+++ b/src/core/idt.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "types.hpp"
+#include "libs/stdio.hpp"
+
+#define IDT_GATE_SIZE 16
+#define IDT_MAX_ENTRIES 50
+#define IDT_ADDR 0x200000
+
+#define IDT_OPT_P (1 << 15)
+#define IDT_OPT_TYPE_INT 0xE << 8
+#define IDT_OPT_PRVL_0 0
+#define IDT_OPT_PRVL_1 (1 << 13)
+#define IDT_OPT_PRVL_2 (2 << 13)
+#define IDT_OPT_PRVL_3 (3 << 13)
+
+
+
+typedef struct IDT_REGISTER {
+ u16 limit;
+ u64 base;
+} __attribute__((packed)) IDT_REGISTER;
+
+typedef struct IDT_DESCRIPTOR {
+ u64 offset;
+ u16 selector;
+ u16 options;
+ u8 ist;
+ u32 ign;
+} __attribute__((packed)) IDT_DESCRIPTOR;
+
+void idt_enable_interrupt(void);
+void idt_write_descriptor(IDT_DESCRIPTOR desc, u16 index); \ No newline at end of file