diff options
author | Tom <tomut@yahoo.com> | 2021-01-28 20:07:41 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-04 16:44:02 +0200 |
commit | ec27cbbb2ae5cd7c48886e8fccf487847fcbddca (patch) | |
tree | 04b47aa9e305f3bf82687ddc01c922dbe138ebdc /Kernel/Arch/x86 | |
parent | 9a69b9112bcc1f6a497b6c3506d5a044b45b04b4 (diff) | |
download | serenity-ec27cbbb2ae5cd7c48886e8fccf487847fcbddca.zip |
Kernel: Store whether a thread is the idle thread in Thread directly
This solves a problem where checking whether a thread is an idle
thread may require iterating all processors if it is not the idle
thread of the current processor.
Diffstat (limited to 'Kernel/Arch/x86')
-rw-r--r-- | Kernel/Arch/x86/CPU.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Kernel/Arch/x86/CPU.h b/Kernel/Arch/x86/CPU.h index 64f6114e58..296ea2e39a 100644 --- a/Kernel/Arch/x86/CPU.h +++ b/Kernel/Arch/x86/CPU.h @@ -779,11 +779,6 @@ public: return *m_mm_data; } - ALWAYS_INLINE Thread* idle_thread() const - { - return m_idle_thread; - } - ALWAYS_INLINE void set_idle_thread(Thread& idle_thread) { m_idle_thread = &idle_thread; @@ -806,6 +801,12 @@ public: write_fs_u32(__builtin_offsetof(Processor, m_current_thread), FlatPtr(¤t_thread)); } + ALWAYS_INLINE static Thread* idle_thread() + { + // See comment in Processor::current_thread + return (Thread*)read_fs_u32(__builtin_offsetof(Processor, m_idle_thread)); + } + ALWAYS_INLINE u32 get_id() const { // NOTE: This variant should only be used when iterating over all |