From 84d3428ab34ef79b82c643f704bd8de720298b37 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 27 Jul 2021 14:38:04 +0200 Subject: [PATCH] Kernel: Remove a handful of unused member functions in Processor --- Kernel/Arch/x86/Processor.h | 27 --------------------------- Kernel/Arch/x86/common/Processor.cpp | 23 ----------------------- 2 files changed, 50 deletions(-) diff --git a/Kernel/Arch/x86/Processor.h b/Kernel/Arch/x86/Processor.h index 1a27e071c7..7a11445649 100644 --- a/Kernel/Arch/x86/Processor.h +++ b/Kernel/Arch/x86/Processor.h @@ -217,8 +217,6 @@ public: void flush_gdt(); const DescriptorTablePointer& get_gdtr(); - static Processor& by_id(u32 cpu); - static size_t processor_count() { return processors().size(); } template Callback> @@ -323,30 +321,6 @@ public: return Processor::id() == 0; } - ALWAYS_INLINE u32 raise_irq() - { - return m_in_irq++; - } - - ALWAYS_INLINE void restore_irq(u32 prev_irq) - { - VERIFY(prev_irq <= m_in_irq); - if (!prev_irq) { - u32 prev_critical = 0; - if (m_in_critical.compare_exchange_strong(prev_critical, 1)) { - m_in_irq = prev_irq; - deferred_call_execute_pending(); - auto prev_raised = m_in_critical.exchange(prev_critical); - VERIFY(prev_raised == prev_critical + 1); - check_invoke_scheduler(); - } else if (prev_critical == 0) { - check_invoke_scheduler(); - } - } else { - m_in_irq = prev_irq; - } - } - ALWAYS_INLINE u32& in_irq() { return m_in_irq; @@ -416,7 +390,6 @@ public: static void smp_enable(); bool smp_process_pending_messages(); - static void smp_broadcast(Function, bool async); static void smp_unicast(u32 cpu, Function, bool async); static void smp_broadcast_flush_tlb(const PageDirectory*, VirtualAddress, size_t); static u32 smp_wake_n_idle_processors(u32 wake_count); diff --git a/Kernel/Arch/x86/common/Processor.cpp b/Kernel/Arch/x86/common/Processor.cpp index 29eed55ae4..8f59b97dbb 100644 --- a/Kernel/Arch/x86/common/Processor.cpp +++ b/Kernel/Arch/x86/common/Processor.cpp @@ -576,18 +576,6 @@ ProcessorContainer& Processor::processors() return s_processors; } -Processor& Processor::by_id(u32 cpu) -{ - // s_processors does not need to be protected by a lock of any kind. - // It is populated early in the boot process, and the BSP is waiting - // for all APs to finish, after which this array never gets modified - // again, so it's safe to not protect access to it here - auto& procs = processors(); - VERIFY(procs[cpu] != nullptr); - VERIFY(procs.size() > cpu); - return *procs[cpu]; -} - void Processor::enter_trap(TrapFrame& trap, bool raise_irq) { VERIFY_INTERRUPTS_DISABLED(); @@ -922,17 +910,6 @@ void Processor::smp_broadcast_wait_sync(ProcessorMessage& msg) smp_return_to_pool(msg); } -void Processor::smp_broadcast(Function callback, bool async) -{ - auto& msg = smp_get_from_pool(); - msg.async = async; - msg.type = ProcessorMessage::Callback; - new (msg.callback_storage) ProcessorMessage::CallbackFunction(move(callback)); - smp_broadcast_message(msg); - if (!async) - smp_broadcast_wait_sync(msg); -} - void Processor::smp_unicast_message(u32 cpu, ProcessorMessage& msg, bool async) { auto& cur_proc = Processor::current();