aboutsummaryrefslogtreecommitdiff
path: root/src/core/idt.hpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-04-21 18:54:50 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-04-21 18:54:50 +0200
commit99019721a9e147c49becc466c5427609b937aca8 (patch)
tree3b187d90bdb606a9c27760cd6e187aeb995fd956 /src/core/idt.hpp
parent2f712d027b38bebd571e4fa673f0d642b59e3c98 (diff)
Enable interrupts
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