From 27b384e073e11459375740d03a4c32d671faeff5 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Thu, 22 Dec 2022 14:01:54 +0100 Subject: [PATCH] Kernel/aarch64: Remove copy constructor from Processor I can't think of a reason why copying the Processor class makes sense, so lets make sure it's not possible to do it by accident by declaring the copy constructor as deleted. --- Kernel/Arch/aarch64/Processor.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Kernel/Arch/aarch64/Processor.h b/Kernel/Arch/aarch64/Processor.h index 8bca91d587..06fd81b648 100644 --- a/Kernel/Arch/aarch64/Processor.h +++ b/Kernel/Arch/aarch64/Processor.h @@ -42,6 +42,8 @@ class Processor { void* m_processor_specific_data[static_cast(ProcessorSpecificDataID::__Count)]; public: + Processor() = default; + void initialize(u32 cpu); template @@ -166,8 +168,7 @@ public: ALWAYS_INLINE static bool current_in_scheduler() { - auto current_processor = current(); - return current_processor.m_in_scheduler; + return current().m_in_scheduler; } ALWAYS_INLINE static void set_current_in_scheduler(bool value) @@ -178,14 +179,14 @@ public: // FIXME: Share the critical functions with x86/Processor.h ALWAYS_INLINE static void enter_critical() { - auto current_processor = current(); - current_processor.m_in_critical = current_processor.in_critical() + 1; + auto& current_processor = current(); + current_processor.m_in_critical = current_processor.m_in_critical + 1; } ALWAYS_INLINE static void leave_critical() { - auto current_processor = current(); - current_processor.m_in_critical = current_processor.in_critical() - 1; + auto& current_processor = current(); + current_processor.m_in_critical = current_processor.m_in_critical - 1; } static u32 clear_critical(); @@ -269,6 +270,8 @@ public: void exit_trap(TrapFrame& trap); private: + Processor(Processor const&) = delete; + Thread* m_current_thread; Thread* m_idle_thread; u32 m_in_critical { 0 };