From 7ee9347560768641096df68c545ac085a20233e4 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Sun, 17 Aug 2025 14:16:55 -0400 Subject: working usermode pager. fix usermode interrupts --- arch/x86_64/idt.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'arch/x86_64/idt.c') diff --git a/arch/x86_64/idt.c b/arch/x86_64/idt.c index 99e1da1..1080f92 100644 --- a/arch/x86_64/idt.c +++ b/arch/x86_64/idt.c @@ -1,16 +1,13 @@ #include "arch/x86_64/tables.h" #include "arch/x86_64/idt.h" -__attribute__((aligned(4096))) +__attribute__((aligned(0x10))) interrupt_gate_t s_idtd[256]; -int64_t __isr_err; -int64_t __isr_num; - void isr_handle(ivt_state_t* state) { - kpanic_state(state, "Unhandled interrupt %i", __isr_num); + kpanic_state(state, "Unhandled interrupt %i", state->num); } void @@ -21,13 +18,9 @@ ivt_setup(void) uintptr_t base = __ivt[i]; s_idtd[i] = (interrupt_gate_t) { .base_0_15 = (base & 0xFFFF), - .segment_selector = 0x8, + .cs = GDT_OFFSET_KERNEL_CODE, .ist = 0, - .zero_0 = 0, - .type = 0xE, - .zero_1 = 0, - .dpl = 0, - .p = 1, + .type_flags = IDT_TYPE_INT_GATE | IDT_FLAG_DPL(0) | IDT_FLAG_P, .base_16_31 = (base >> 16) & 0xFFFF, .base_32_63 = (base >> 32) & 0xFFFFFFFF, .resv = 0 -- cgit v1.2.1