diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-22 12:21:31 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-23 00:02:09 +0200 |
commit | d60635cb9df9b4e72702db02b88b26ab9123c2a8 (patch) | |
tree | 162105dee63773b68678c54d5a7f4016f7574c8f /Kernel/Arch/x86/Processor.h | |
parent | 3e3f760808e614ca70d97294013cb58f2a0deaf5 (diff) | |
download | serenity-d60635cb9df9b4e72702db02b88b26ab9123c2a8.zip |
Kernel: Convert Processor::in_irq() to static current_in_irq()
This closes the race window between Processor::current() and a context
switch happening before in_irq().
Diffstat (limited to 'Kernel/Arch/x86/Processor.h')
-rw-r--r-- | Kernel/Arch/x86/Processor.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Arch/x86/Processor.h b/Kernel/Arch/x86/Processor.h index 42ebcc82b8..6377f0ddaf 100644 --- a/Kernel/Arch/x86/Processor.h +++ b/Kernel/Arch/x86/Processor.h @@ -120,7 +120,7 @@ class Processor { u32 m_gdt_length; u32 m_cpu; - u32 m_in_irq; + FlatPtr m_in_irq {}; volatile u32 m_in_critical {}; static Atomic<u32> s_idle_cpu_mask; @@ -329,9 +329,9 @@ public: return Processor::id() == 0; } - ALWAYS_INLINE u32& in_irq() + ALWAYS_INLINE static FlatPtr current_in_irq() { - return m_in_irq; + return read_gs_ptr(__builtin_offsetof(Processor, m_in_irq)); } ALWAYS_INLINE static void restore_in_critical(u32 critical) |