From a998bba73b5e1e2f4da15ea66ecfaca5b26766ce Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Thu, 20 Oct 2022 13:01:26 +0200 Subject: [PATCH] Kernel/aarch64: Store a pointer to the current Thread on Processor And also implemented and update the related functions. --- Kernel/Arch/aarch64/Processor.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Kernel/Arch/aarch64/Processor.h b/Kernel/Arch/aarch64/Processor.h index f45b7caa5d..38ae725aeb 100644 --- a/Kernel/Arch/aarch64/Processor.h +++ b/Kernel/Arch/aarch64/Processor.h @@ -111,11 +111,9 @@ public: m_idle_thread = &idle_thread; } - // FIXME: Actually return the current thread once aarch64 supports threading. ALWAYS_INLINE static Thread* current_thread() { - static Thread* current_thread { nullptr }; - return current_thread; + return current().m_current_thread; } ALWAYS_INLINE bool has_nx() const @@ -204,14 +202,12 @@ public: ALWAYS_INLINE static void set_current_thread(Thread& current_thread) { - (void)current_thread; - TODO_AARCH64(); + current().m_current_thread = ¤t_thread; } - // FIXME: Actually return the idle thread once aarch64 supports threading. ALWAYS_INLINE static Thread* idle_thread() { - return nullptr; + return current().m_idle_thread; } ALWAYS_INLINE static Processor& current() @@ -241,6 +237,7 @@ public: static ErrorOr> capture_stack_trace(Thread& thread, size_t max_frames = 0); private: + Thread* m_current_thread; Thread* m_idle_thread; u32 m_in_critical { 0 };