From 414cc1eb1fdbaa0001938711665f47c940bed3c7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 31 Jan 2019 23:05:00 -0500 Subject: kernel: Remove the Timer class A holdover from citra, the Horizon kernel on the switch has no prominent kernel object that functions as a timer. At least not to the degree of sophistication that this class provided. As such, this can be removed entirely. This class also wasn't used at all in any meaningful way within the core, so this was just code sitting around doing nothing. This also allows removing a few things from the main KernelCore class that allows it to use slightly less resources overall (though very minor and not anything really noticeable). --- src/core/hle/kernel/kernel.cpp | 42 ------------------------------------------ 1 file changed, 42 deletions(-) (limited to 'src/core/hle/kernel/kernel.cpp') diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 67674cd47..7a524ce5a 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -18,7 +18,6 @@ #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/thread.h" -#include "core/hle/kernel/timer.h" #include "core/hle/lock.h" #include "core/hle/result.h" @@ -86,27 +85,12 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] int cycles_ } } -/// The timer callback event, called when a timer is fired -static void TimerCallback(u64 timer_handle, int cycles_late) { - const auto proper_handle = static_cast(timer_handle); - const auto& system = Core::System::GetInstance(); - SharedPtr timer = system.Kernel().RetrieveTimerFromCallbackHandleTable(proper_handle); - - if (timer == nullptr) { - LOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); - return; - } - - timer->Signal(cycles_late); -} - struct KernelCore::Impl { void Initialize(KernelCore& kernel) { Shutdown(); InitializeSystemResourceLimit(kernel); InitializeThreads(); - InitializeTimers(); } void Shutdown() { @@ -122,9 +106,6 @@ struct KernelCore::Impl { thread_wakeup_callback_handle_table.Clear(); thread_wakeup_event_type = nullptr; - timer_callback_handle_table.Clear(); - timer_callback_event_type = nullptr; - named_ports.clear(); } @@ -146,11 +127,6 @@ struct KernelCore::Impl { CoreTiming::RegisterEvent("ThreadWakeupCallback", ThreadWakeupCallback); } - void InitializeTimers() { - timer_callback_handle_table.Clear(); - timer_callback_event_type = CoreTiming::RegisterEvent("TimerCallback", TimerCallback); - } - std::atomic next_object_id{0}; std::atomic next_process_id{Process::ProcessIDMin}; std::atomic next_thread_id{1}; @@ -161,12 +137,6 @@ struct KernelCore::Impl { SharedPtr system_resource_limit; - /// The event type of the generic timer callback event - CoreTiming::EventType* timer_callback_event_type = nullptr; - // TODO(yuriks): This can be removed if Timer objects are explicitly pooled in the future, - // allowing us to simply use a pool index or similar. - Kernel::HandleTable timer_callback_handle_table; - CoreTiming::EventType* thread_wakeup_event_type = nullptr; // TODO(yuriks): This can be removed if Thread objects are explicitly pooled in the future, // allowing us to simply use a pool index or similar. @@ -198,10 +168,6 @@ SharedPtr KernelCore::RetrieveThreadFromWakeupCallbackHandleTable(Handle return impl->thread_wakeup_callback_handle_table.Get(handle); } -SharedPtr KernelCore::RetrieveTimerFromCallbackHandleTable(Handle handle) const { - return impl->timer_callback_handle_table.Get(handle); -} - void KernelCore::AppendNewProcess(SharedPtr process) { impl->process_list.push_back(std::move(process)); } @@ -247,18 +213,10 @@ u64 KernelCore::CreateNewProcessID() { return impl->next_process_id++; } -ResultVal KernelCore::CreateTimerCallbackHandle(const SharedPtr& timer) { - return impl->timer_callback_handle_table.Create(timer); -} - CoreTiming::EventType* KernelCore::ThreadWakeupCallbackEventType() const { return impl->thread_wakeup_event_type; } -CoreTiming::EventType* KernelCore::TimerCallbackEventType() const { - return impl->timer_callback_event_type; -} - Kernel::HandleTable& KernelCore::ThreadWakeupCallbackHandleTable() { return impl->thread_wakeup_callback_handle_table; } -- cgit v1.2.3