diff options
Diffstat (limited to 'arch/x86_64/hal/idt.c')
| -rw-r--r-- | arch/x86_64/hal/idt.c | 20 |
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; } } |
