diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-06 11:31:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-06 11:33:32 +0200 |
commit | 163c9d5f8fa1a59e287578565d3f547c3b163084 (patch) | |
tree | febe6f9fe950d9ab06cc367a067673706941c119 /Kernel/Arch/i386 | |
parent | 3e0020e67daa92f2b6db90e95959b2804fb7f9e9 (diff) | |
download | serenity-163c9d5f8fa1a59e287578565d3f547c3b163084.zip |
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.
Diffstat (limited to 'Kernel/Arch/i386')
-rw-r--r-- | Kernel/Arch/i386/CPU.h | 8 |
1 files changed, 8 insertions, 0 deletions
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 }; |