From 055d49b1fd44ba7c450ad40051a2f34f38508b5f Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 19 Feb 2019 21:38:15 -0500 Subject: [PATCH] kernel/x86: Pin the current thread before calling interrupt handlers. int_io_* functions do not touch the thread state, but we already have it here as we will modify its contents later, so it makes more sense to set this flag here. This is mostly only relevant following the previous commit, i.e. finding interrupt handlers that brokenly try to context-switch. --- src/system/kernel/arch/x86/arch_int.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/system/kernel/arch/x86/arch_int.cpp b/src/system/kernel/arch/x86/arch_int.cpp index 5588d5d181..b8213c6fcc 100644 --- a/src/system/kernel/arch/x86/arch_int.cpp +++ b/src/system/kernel/arch/x86/arch_int.cpp @@ -233,7 +233,9 @@ x86_hardware_interrupt(struct iframe* frame) apic_end_of_interrupt(); } + thread->pinned_to_cpu++; int_io_interrupt_handler(vector, levelTriggered); + thread->pinned_to_cpu--; if (levelTriggered) { if (!sCurrentPIC->end_of_interrupt(vector))