From 6c959ef878f16b35599a43b861ddc8c962285ee9 Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 19 Sep 2022 18:32:28 -0300 Subject: [PATCH] cpu: make timer irq use ist1 --- src/arch/x86_64/cpu.c | 12 +++++++++++- src/arch/x86_64/idt.c | 2 +- src/arch/x86_64/include/arch/idt.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/arch/x86_64/cpu.c b/src/arch/x86_64/cpu.c index 33991fc8..74c74428 100644 --- a/src/arch/x86_64/cpu.c +++ b/src/arch/x86_64/cpu.c @@ -3,8 +3,10 @@ #include #include #include +#include +#include -// initialises things like +// initializes things like // syscall, sse, etc // for the current cpu @@ -48,4 +50,12 @@ void cpu_state_init(){ "or $0b11000000000, %%rax;" "mov %%rax, %%cr4;" : : : "rax"); + + // set up interrupt stacks + + // timer stack is 1 + + arch_getcls()->ist.ist1 = pmm_hhdmalloc(10) + PAGE_SIZE*10; + + } diff --git a/src/arch/x86_64/idt.c b/src/arch/x86_64/idt.c index 77eafada..fa17cf53 100644 --- a/src/arch/x86_64/idt.c +++ b/src/arch/x86_64/idt.c @@ -59,7 +59,7 @@ void idt_bspinit(){ idt_setentry(&idt[VECTOR_LAPICNMI], asmisr_lapicnmi, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0); - idt_setentry(&idt[VECTOR_TIMER], asmisr_timer, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0); + idt_setentry(&idt[VECTOR_TIMER], asmisr_timer, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, TIMER_IST); idt_setentry(&idt[VECTOR_PS2KBD], asmisr_ps2kbd, 0x28, FLAGS_PRESENT | FLAGS_TYPE_INTERRUPT, 0); diff --git a/src/arch/x86_64/include/arch/idt.h b/src/arch/x86_64/include/arch/idt.h index fc040659..bdec3b23 100644 --- a/src/arch/x86_64/include/arch/idt.h +++ b/src/arch/x86_64/include/arch/idt.h @@ -30,6 +30,8 @@ #define VECTOR_PS2KBD 0x40 #define VECTOR_TIMER 0x80 +#define TIMER_IST 1 + typedef struct{ uint16_t size; uint64_t offset;