summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/hal/idt.c
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-09-15 10:03:20 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-09-15 10:03:20 -0400
commita783cc865f1f261c20f6ef55cb37d4839f519865 (patch)
treeeabd6992f3be7c0f4d778a9fba2bfe7173ed6c8c /arch/x86_64/hal/idt.c
parent1f4260648f02db1b4fe8c60fe36f936125042880 (diff)
downloadjove-kernel-a783cc865f1f261c20f6ef55cb37d4839f519865.tar.gz
jove-kernel-a783cc865f1f261c20f6ef55cb37d4839f519865.tar.bz2
jove-kernel-a783cc865f1f261c20f6ef55cb37d4839f519865.zip
move constants to api. centralize interrupts. fix rootdir lock hang
Diffstat (limited to 'arch/x86_64/hal/idt.c')
-rw-r--r--arch/x86_64/hal/idt.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/arch/x86_64/hal/idt.c b/arch/x86_64/hal/idt.c
index b2251bd..235d8c6 100644
--- a/arch/x86_64/hal/idt.c
+++ b/arch/x86_64/hal/idt.c
@@ -3,6 +3,7 @@
#include "gdt.h"
#include "jove.h"
#include "lib/printf.h"
+#include "lib/string.h"
ALIGN(8)
static struct idt_entry s_idt[IDT_ENTRIES];
@@ -11,7 +12,9 @@ typedef void (*isr_t)(void);
extern isr_t __isrs[IDT_ENTRIES];
typedef struct int_stackframe *(*int_handler_t)(struct int_stackframe*);
-int_handler_t __int_handles[IDT_ENTRIES];
+int_handler_t __int_kernel_handles[IDT_ENTRIES];
+
+struct int_user_handle __int_user_handles[IDT_ENTRIES];
static struct int_stackframe*
s_int_handle_stub(struct int_stackframe* frame)
@@ -20,9 +23,22 @@ s_int_handle_stub(struct int_stackframe* frame)
hcf();
}
+struct int_stackframe*
+__int_handle_body(struct int_stackframe *frame)
+{
+ frame = __int_kernel_handles[frame->int_num](frame);
+
+ struct int_user_handle *usr_handle = &__int_user_handles[frame->int_num];
+ if(usr_handle->pid == 0) return frame;
+
+ kprintf("TODO: Handle user interrupt switching\n");
+ return frame;
+}
+
void
idt_init(void)
{
+ memset(__int_user_handles, 0, sizeof(struct int_user_handle) * IDT_ENTRIES);
for(size_t i = 0; i < IDT_ENTRIES; i++) {
uintptr_t isr = (uintptr_t)(__isrs[i]);
@@ -37,7 +53,7 @@ idt_init(void)
.offset_32_63 = (uint32_t)(isr >> 32)
};
- __int_handles[i] = s_int_handle_stub;
+ __int_kernel_handles[i] = s_int_handle_stub;
}
}