diff options
| author | 2019-02-01 12:49:16 -0500 | |
|---|---|---|
| committer | 2019-02-01 12:49:16 -0500 | |
| commit | 11e7c1244c9811d71b45aacfc15a06da7d60c1a4 (patch) | |
| tree | ece24e05d7c2bb9bcad5d00f6d50c541ecbbf25b /src/core/hle/kernel/kernel.cpp | |
| parent | Merge pull request #2079 from ReinUsesLisp/remove-fill (diff) | |
| parent | kernel: Remove the Timer class (diff) | |
| download | yuzu-11e7c1244c9811d71b45aacfc15a06da7d60c1a4.tar.gz yuzu-11e7c1244c9811d71b45aacfc15a06da7d60c1a4.tar.xz yuzu-11e7c1244c9811d71b45aacfc15a06da7d60c1a4.zip | |
Merge pull request #2078 from lioncash/timer
kernel: Remove the Timer class
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
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 @@ | |||
| 18 | #include "core/hle/kernel/process.h" | 18 | #include "core/hle/kernel/process.h" |
| 19 | #include "core/hle/kernel/resource_limit.h" | 19 | #include "core/hle/kernel/resource_limit.h" |
| 20 | #include "core/hle/kernel/thread.h" | 20 | #include "core/hle/kernel/thread.h" |
| 21 | #include "core/hle/kernel/timer.h" | ||
| 22 | #include "core/hle/lock.h" | 21 | #include "core/hle/lock.h" |
| 23 | #include "core/hle/result.h" | 22 | #include "core/hle/result.h" |
| 24 | 23 | ||
| @@ -86,27 +85,12 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] int cycles_ | |||
| 86 | } | 85 | } |
| 87 | } | 86 | } |
| 88 | 87 | ||
| 89 | /// The timer callback event, called when a timer is fired | ||
| 90 | static void TimerCallback(u64 timer_handle, int cycles_late) { | ||
| 91 | const auto proper_handle = static_cast<Handle>(timer_handle); | ||
| 92 | const auto& system = Core::System::GetInstance(); | ||
| 93 | SharedPtr<Timer> timer = system.Kernel().RetrieveTimerFromCallbackHandleTable(proper_handle); | ||
| 94 | |||
| 95 | if (timer == nullptr) { | ||
| 96 | LOG_CRITICAL(Kernel, "Callback fired for invalid timer {:016X}", timer_handle); | ||
| 97 | return; | ||
| 98 | } | ||
| 99 | |||
| 100 | timer->Signal(cycles_late); | ||
| 101 | } | ||
| 102 | |||
| 103 | struct KernelCore::Impl { | 88 | struct KernelCore::Impl { |
| 104 | void Initialize(KernelCore& kernel) { | 89 | void Initialize(KernelCore& kernel) { |
| 105 | Shutdown(); | 90 | Shutdown(); |
| 106 | 91 | ||
| 107 | InitializeSystemResourceLimit(kernel); | 92 | InitializeSystemResourceLimit(kernel); |
| 108 | InitializeThreads(); | 93 | InitializeThreads(); |
| 109 | InitializeTimers(); | ||
| 110 | } | 94 | } |
| 111 | 95 | ||
| 112 | void Shutdown() { | 96 | void Shutdown() { |
| @@ -122,9 +106,6 @@ struct KernelCore::Impl { | |||
| 122 | thread_wakeup_callback_handle_table.Clear(); | 106 | thread_wakeup_callback_handle_table.Clear(); |
| 123 | thread_wakeup_event_type = nullptr; | 107 | thread_wakeup_event_type = nullptr; |
| 124 | 108 | ||
| 125 | timer_callback_handle_table.Clear(); | ||
| 126 | timer_callback_event_type = nullptr; | ||
| 127 | |||
| 128 | named_ports.clear(); | 109 | named_ports.clear(); |
| 129 | } | 110 | } |
| 130 | 111 | ||
| @@ -146,11 +127,6 @@ struct KernelCore::Impl { | |||
| 146 | CoreTiming::RegisterEvent("ThreadWakeupCallback", ThreadWakeupCallback); | 127 | CoreTiming::RegisterEvent("ThreadWakeupCallback", ThreadWakeupCallback); |
| 147 | } | 128 | } |
| 148 | 129 | ||
| 149 | void InitializeTimers() { | ||
| 150 | timer_callback_handle_table.Clear(); | ||
| 151 | timer_callback_event_type = CoreTiming::RegisterEvent("TimerCallback", TimerCallback); | ||
| 152 | } | ||
| 153 | |||
| 154 | std::atomic<u32> next_object_id{0}; | 130 | std::atomic<u32> next_object_id{0}; |
| 155 | std::atomic<u64> next_process_id{Process::ProcessIDMin}; | 131 | std::atomic<u64> next_process_id{Process::ProcessIDMin}; |
| 156 | std::atomic<u64> next_thread_id{1}; | 132 | std::atomic<u64> next_thread_id{1}; |
| @@ -161,12 +137,6 @@ struct KernelCore::Impl { | |||
| 161 | 137 | ||
| 162 | SharedPtr<ResourceLimit> system_resource_limit; | 138 | SharedPtr<ResourceLimit> system_resource_limit; |
| 163 | 139 | ||
| 164 | /// The event type of the generic timer callback event | ||
| 165 | CoreTiming::EventType* timer_callback_event_type = nullptr; | ||
| 166 | // TODO(yuriks): This can be removed if Timer objects are explicitly pooled in the future, | ||
| 167 | // allowing us to simply use a pool index or similar. | ||
| 168 | Kernel::HandleTable timer_callback_handle_table; | ||
| 169 | |||
| 170 | CoreTiming::EventType* thread_wakeup_event_type = nullptr; | 140 | CoreTiming::EventType* thread_wakeup_event_type = nullptr; |
| 171 | // TODO(yuriks): This can be removed if Thread objects are explicitly pooled in the future, | 141 | // TODO(yuriks): This can be removed if Thread objects are explicitly pooled in the future, |
| 172 | // allowing us to simply use a pool index or similar. | 142 | // allowing us to simply use a pool index or similar. |
| @@ -198,10 +168,6 @@ SharedPtr<Thread> KernelCore::RetrieveThreadFromWakeupCallbackHandleTable(Handle | |||
| 198 | return impl->thread_wakeup_callback_handle_table.Get<Thread>(handle); | 168 | return impl->thread_wakeup_callback_handle_table.Get<Thread>(handle); |
| 199 | } | 169 | } |
| 200 | 170 | ||
| 201 | SharedPtr<Timer> KernelCore::RetrieveTimerFromCallbackHandleTable(Handle handle) const { | ||
| 202 | return impl->timer_callback_handle_table.Get<Timer>(handle); | ||
| 203 | } | ||
| 204 | |||
| 205 | void KernelCore::AppendNewProcess(SharedPtr<Process> process) { | 171 | void KernelCore::AppendNewProcess(SharedPtr<Process> process) { |
| 206 | impl->process_list.push_back(std::move(process)); | 172 | impl->process_list.push_back(std::move(process)); |
| 207 | } | 173 | } |
| @@ -247,18 +213,10 @@ u64 KernelCore::CreateNewProcessID() { | |||
| 247 | return impl->next_process_id++; | 213 | return impl->next_process_id++; |
| 248 | } | 214 | } |
| 249 | 215 | ||
| 250 | ResultVal<Handle> KernelCore::CreateTimerCallbackHandle(const SharedPtr<Timer>& timer) { | ||
| 251 | return impl->timer_callback_handle_table.Create(timer); | ||
| 252 | } | ||
| 253 | |||
| 254 | CoreTiming::EventType* KernelCore::ThreadWakeupCallbackEventType() const { | 216 | CoreTiming::EventType* KernelCore::ThreadWakeupCallbackEventType() const { |
| 255 | return impl->thread_wakeup_event_type; | 217 | return impl->thread_wakeup_event_type; |
| 256 | } | 218 | } |
| 257 | 219 | ||
| 258 | CoreTiming::EventType* KernelCore::TimerCallbackEventType() const { | ||
| 259 | return impl->timer_callback_event_type; | ||
| 260 | } | ||
| 261 | |||
| 262 | Kernel::HandleTable& KernelCore::ThreadWakeupCallbackHandleTable() { | 220 | Kernel::HandleTable& KernelCore::ThreadWakeupCallbackHandleTable() { |
| 263 | return impl->thread_wakeup_callback_handle_table; | 221 | return impl->thread_wakeup_callback_handle_table; |
| 264 | } | 222 | } |