From e61d22b5b6399f2d870d939b838ba4f26ac1beda Mon Sep 17 00:00:00 2001 From: Jesse Buhagiar Date: Mon, 17 Oct 2022 23:00:48 +1100 Subject: [PATCH] Kernel: Prevent atomic read/write from failing on nullptr Having this function return `nullptr` explicitly triggers the compiler's inbuilt checker, as it knows the destination is null. Having this as a static (scoped) variable for now circumvents this problem. --- Kernel/Arch/aarch64/Processor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/Arch/aarch64/Processor.h b/Kernel/Arch/aarch64/Processor.h index 03bd67b2a2..f45b7caa5d 100644 --- a/Kernel/Arch/aarch64/Processor.h +++ b/Kernel/Arch/aarch64/Processor.h @@ -114,7 +114,8 @@ public: // FIXME: Actually return the current thread once aarch64 supports threading. ALWAYS_INLINE static Thread* current_thread() { - return nullptr; + static Thread* current_thread { nullptr }; + return current_thread; } ALWAYS_INLINE bool has_nx() const