From 5b0c5da5f574812be034a6c0f1f1eae65d7f6a19 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Mon, 22 Jan 2024 07:31:21 +0900 Subject: [PATCH] x86_64: always go through isr_common for lapic timer We should always update the clocks on lapic timer, so it should not short-circuit in kernel mode. --- kernel/arch/x86_64/idt.c | 2 +- kernel/arch/x86_64/irq.S | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/kernel/arch/x86_64/idt.c b/kernel/arch/x86_64/idt.c index 7120b1f9d..b4e048d38 100644 --- a/kernel/arch/x86_64/idt.c +++ b/kernel/arch/x86_64/idt.c @@ -538,7 +538,7 @@ static void _page_fault(struct regs * r) { static void _local_timer(struct regs * r) { extern void arch_update_clock(void); arch_update_clock(); - switch_task(1); + if (r->cs != 0x08) switch_task(1); } /** diff --git a/kernel/arch/x86_64/irq.S b/kernel/arch/x86_64/irq.S index bcb59300f..f39a1a63c 100644 --- a/kernel/arch/x86_64/irq.S +++ b/kernel/arch/x86_64/irq.S @@ -98,16 +98,10 @@ _isr123: add $0xb0, %r12 movl $0, (%r12) popq %r12 - /* Are we in userspace? */ - cmpq $8, 8(%rsp) - je 1f /* Then we can proceed! */ pushq $0x00 pushq $123 jmp isr_common -1: - /* If we were not in userspace, nothing to do; we were already idle. */ - iretq .global _isr124