From 163c9d5f8fa1a59e287578565d3f547c3b163084 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 Jul 2020 11:31:21 +0200 Subject: Kernel: Thread::wait_on() must always leave interrupts enabled on exit The short-circuit path added for waiting on a queue that already had a pending wake was able to return with interrupts disabled, which breaks the API contract of wait_on() always returning with IF=1. Fix this by adding a way to override the restored IF in ScopedCritical. --- Kernel/Arch/i386/CPU.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Kernel/Arch/i386/CPU.h') diff --git a/Kernel/Arch/i386/CPU.h b/Kernel/Arch/i386/CPU.h index a5d4a98712..1c53a48660 100644 --- a/Kernel/Arch/i386/CPU.h +++ b/Kernel/Arch/i386/CPU.h @@ -837,6 +837,14 @@ public: return *this; } + void set_interrupt_flag_on_destruction(bool flag) + { + if (flag) + m_prev_flags |= 0x200; + else + m_prev_flags &= ~0x200; + } + private: u32 m_prev_flags { 0 }; bool m_valid { false }; -- cgit v1.2.3