aboutsummaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-06-06 17:47:26 -0400
committerIan Moffett <ian@osmora.org>2024-06-06 17:47:26 -0400
commit19e1b54d12edbe80419b7fde9c602833544eb7ab (patch)
tree7c17a98c069ad455036f63b8062925b183e311aa /sys/arch
parenta84cacff59d6e31c05b6f9eddebf28dbb418b303 (diff)
kernel/amd64: lapic: Assign timer to IST_SCHED
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/lapic.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c
index 823e830..3a87b74 100644
--- a/sys/arch/amd64/amd64/lapic.c
+++ b/sys/arch/amd64/amd64/lapic.c
@@ -41,6 +41,7 @@
#include <machine/cpu.h>
#include <machine/msr.h>
#include <machine/idt.h>
+#include <machine/tss.h>
#define pr_trace(fmt, ...) kprintf("lapic: " fmt, ##__VA_ARGS__)
@@ -281,6 +282,7 @@ void
lapic_init(void)
{
struct cpu_info *ci = this_cpu();
+ union tss_stack tmr_stack;
tmrr_status_t tmr_status;
/*
@@ -291,10 +293,18 @@ lapic_init(void)
panic("This machine does not support LAPIC!\n");
}
+ /* Try to allocate LAPIC timer interrupt stack */
+ if (tss_alloc_stack(&tmr_stack, DEFAULT_PAGESIZE) != 0) {
+ panic("Failed to allocate LAPIC TMR stack!\n");
+ }
+
+ tss_update_ist(ci, tmr_stack, IST_SCHED);
+
/* Allocate a vector if needed */
if (lapic_timer_vec == 0) {
lapic_timer_vec = intr_alloc_vector();
- idt_set_desc(lapic_timer_vec, IDT_INT_GATE, ISR(lapic_tmr_isr), 0);
+ idt_set_desc(lapic_timer_vec, IDT_INT_GATE, ISR(lapic_tmr_isr),
+ IST_SCHED);
}
/* Ensure the LAPIC base is valid */