diff options
| author | 2020-04-01 17:28:49 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:36:05 -0400 | |
| commit | 48fa3b7a0f2054a836b0a8061e6b082c246b5ae0 (patch) | |
| tree | 37a09cfb55f13ebf2df2b9a71622c599733100b0 /src/core/hle/kernel | |
| parent | Kernel/svcBreak: Implement CacheInvalidation for Singlecore and correct svcBr... (diff) | |
| download | yuzu-48fa3b7a0f2054a836b0a8061e6b082c246b5ae0.tar.gz yuzu-48fa3b7a0f2054a836b0a8061e6b082c246b5ae0.tar.xz yuzu-48fa3b7a0f2054a836b0a8061e6b082c246b5ae0.zip | |
General: Cleanup legacy code.
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/client_port.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 81 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/synchronization_object.cpp | 64 | ||||
| -rw-r--r-- | src/core/hle/kernel/synchronization_object.h | 15 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 34 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 56 |
8 files changed, 5 insertions, 253 deletions
diff --git a/src/core/hle/kernel/client_port.cpp b/src/core/hle/kernel/client_port.cpp index 5498fd313..8aff2227a 100644 --- a/src/core/hle/kernel/client_port.cpp +++ b/src/core/hle/kernel/client_port.cpp | |||
| @@ -34,7 +34,7 @@ ResultVal<std::shared_ptr<ClientSession>> ClientPort::Connect() { | |||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | // Wake the threads waiting on the ServerPort | 36 | // Wake the threads waiting on the ServerPort |
| 37 | server_port->WakeupAllWaitingThreads(); | 37 | server_port->Signal(); |
| 38 | 38 | ||
| 39 | return MakeResult(std::move(client)); | 39 | return MakeResult(std::move(client)); |
| 40 | } | 40 | } |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 1f230fc4a..dbb75416d 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -48,72 +48,6 @@ MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70)); | |||
| 48 | 48 | ||
| 49 | namespace Kernel { | 49 | namespace Kernel { |
| 50 | 50 | ||
| 51 | /** | ||
| 52 | * Callback that will wake up the thread it was scheduled for | ||
| 53 | * @param thread_handle The handle of the thread that's been awoken | ||
| 54 | * @param cycles_late The number of CPU cycles that have passed since the desired wakeup time | ||
| 55 | */ | ||
| 56 | static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] s64 cycles_late) { | ||
| 57 | UNREACHABLE(); | ||
| 58 | const auto proper_handle = static_cast<Handle>(thread_handle); | ||
| 59 | const auto& system = Core::System::GetInstance(); | ||
| 60 | |||
| 61 | // Lock the global kernel mutex when we enter the kernel HLE. | ||
| 62 | std::lock_guard lock{HLE::g_hle_lock}; | ||
| 63 | |||
| 64 | std::shared_ptr<Thread> thread = | ||
| 65 | system.Kernel().RetrieveThreadFromGlobalHandleTable(proper_handle); | ||
| 66 | if (thread == nullptr) { | ||
| 67 | LOG_CRITICAL(Kernel, "Callback fired for invalid thread {:08X}", proper_handle); | ||
| 68 | return; | ||
| 69 | } | ||
| 70 | |||
| 71 | bool resume = true; | ||
| 72 | |||
| 73 | if (thread->GetStatus() == ThreadStatus::WaitSynch || | ||
| 74 | thread->GetStatus() == ThreadStatus::WaitHLEEvent) { | ||
| 75 | // Remove the thread from each of its waiting objects' waitlists | ||
| 76 | for (const auto& object : thread->GetSynchronizationObjects()) { | ||
| 77 | object->RemoveWaitingThread(thread); | ||
| 78 | } | ||
| 79 | thread->ClearSynchronizationObjects(); | ||
| 80 | |||
| 81 | // Invoke the wakeup callback before clearing the wait objects | ||
| 82 | if (thread->HasWakeupCallback()) { | ||
| 83 | resume = thread->InvokeWakeupCallback(ThreadWakeupReason::Timeout, thread, nullptr, 0); | ||
| 84 | } | ||
| 85 | } else if (thread->GetStatus() == ThreadStatus::WaitMutex || | ||
| 86 | thread->GetStatus() == ThreadStatus::WaitCondVar) { | ||
| 87 | thread->SetMutexWaitAddress(0); | ||
| 88 | thread->SetWaitHandle(0); | ||
| 89 | if (thread->GetStatus() == ThreadStatus::WaitCondVar) { | ||
| 90 | thread->GetOwnerProcess()->RemoveConditionVariableThread(thread); | ||
| 91 | thread->SetCondVarWaitAddress(0); | ||
| 92 | } | ||
| 93 | |||
| 94 | auto* const lock_owner = thread->GetLockOwner(); | ||
| 95 | // Threads waking up by timeout from WaitProcessWideKey do not perform priority inheritance | ||
| 96 | // and don't have a lock owner unless SignalProcessWideKey was called first and the thread | ||
| 97 | // wasn't awakened due to the mutex already being acquired. | ||
| 98 | if (lock_owner != nullptr) { | ||
| 99 | lock_owner->RemoveMutexWaiter(thread); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | if (thread->GetStatus() == ThreadStatus::WaitArb) { | ||
| 104 | auto& address_arbiter = thread->GetOwnerProcess()->GetAddressArbiter(); | ||
| 105 | address_arbiter.HandleWakeupThread(thread); | ||
| 106 | } | ||
| 107 | |||
| 108 | if (resume) { | ||
| 109 | if (thread->GetStatus() == ThreadStatus::WaitCondVar || | ||
| 110 | thread->GetStatus() == ThreadStatus::WaitArb) { | ||
| 111 | thread->SetWaitSynchronizationResult(RESULT_TIMEOUT); | ||
| 112 | } | ||
| 113 | thread->ResumeFromWait(); | ||
| 114 | } | ||
| 115 | } | ||
| 116 | |||
| 117 | struct KernelCore::Impl { | 51 | struct KernelCore::Impl { |
| 118 | explicit Impl(Core::System& system, KernelCore& kernel) | 52 | explicit Impl(Core::System& system, KernelCore& kernel) |
| 119 | : global_scheduler{kernel}, synchronization{system}, time_manager{system}, system{system} {} | 53 | : global_scheduler{kernel}, synchronization{system}, time_manager{system}, system{system} {} |
| @@ -129,7 +63,6 @@ struct KernelCore::Impl { | |||
| 129 | InitializePhysicalCores(); | 63 | InitializePhysicalCores(); |
| 130 | InitializeSystemResourceLimit(kernel); | 64 | InitializeSystemResourceLimit(kernel); |
| 131 | InitializeMemoryLayout(); | 65 | InitializeMemoryLayout(); |
| 132 | InitializeThreads(); | ||
| 133 | InitializePreemption(kernel); | 66 | InitializePreemption(kernel); |
| 134 | InitializeSchedulers(); | 67 | InitializeSchedulers(); |
| 135 | InitializeSuspendThreads(); | 68 | InitializeSuspendThreads(); |
| @@ -161,7 +94,6 @@ struct KernelCore::Impl { | |||
| 161 | system_resource_limit = nullptr; | 94 | system_resource_limit = nullptr; |
| 162 | 95 | ||
| 163 | global_handle_table.Clear(); | 96 | global_handle_table.Clear(); |
| 164 | thread_wakeup_event_type = nullptr; | ||
| 165 | preemption_event = nullptr; | 97 | preemption_event = nullptr; |
| 166 | 98 | ||
| 167 | global_scheduler.Shutdown(); | 99 | global_scheduler.Shutdown(); |
| @@ -210,11 +142,6 @@ struct KernelCore::Impl { | |||
| 210 | } | 142 | } |
| 211 | } | 143 | } |
| 212 | 144 | ||
| 213 | void InitializeThreads() { | ||
| 214 | thread_wakeup_event_type = | ||
| 215 | Core::Timing::CreateEvent("ThreadWakeupCallback", ThreadWakeupCallback); | ||
| 216 | } | ||
| 217 | |||
| 218 | void InitializePreemption(KernelCore& kernel) { | 145 | void InitializePreemption(KernelCore& kernel) { |
| 219 | preemption_event = Core::Timing::CreateEvent( | 146 | preemption_event = Core::Timing::CreateEvent( |
| 220 | "PreemptionCallback", [this, &kernel](u64 userdata, s64 cycles_late) { | 147 | "PreemptionCallback", [this, &kernel](u64 userdata, s64 cycles_late) { |
| @@ -376,7 +303,6 @@ struct KernelCore::Impl { | |||
| 376 | 303 | ||
| 377 | std::shared_ptr<ResourceLimit> system_resource_limit; | 304 | std::shared_ptr<ResourceLimit> system_resource_limit; |
| 378 | 305 | ||
| 379 | std::shared_ptr<Core::Timing::EventType> thread_wakeup_event_type; | ||
| 380 | std::shared_ptr<Core::Timing::EventType> preemption_event; | 306 | std::shared_ptr<Core::Timing::EventType> preemption_event; |
| 381 | 307 | ||
| 382 | // This is the kernel's handle table or supervisor handle table which | 308 | // This is the kernel's handle table or supervisor handle table which |
| @@ -516,7 +442,8 @@ std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>& KernelCore | |||
| 516 | return impl->interrupts; | 442 | return impl->interrupts; |
| 517 | } | 443 | } |
| 518 | 444 | ||
| 519 | const std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>& KernelCore::Interrupts() const { | 445 | const std::array<Core::CPUInterruptHandler, Core::Hardware::NUM_CPU_CORES>& KernelCore::Interrupts() |
| 446 | const { | ||
| 520 | return impl->interrupts; | 447 | return impl->interrupts; |
| 521 | } | 448 | } |
| 522 | 449 | ||
| @@ -595,10 +522,6 @@ u64 KernelCore::CreateNewUserProcessID() { | |||
| 595 | return impl->next_user_process_id++; | 522 | return impl->next_user_process_id++; |
| 596 | } | 523 | } |
| 597 | 524 | ||
| 598 | const std::shared_ptr<Core::Timing::EventType>& KernelCore::ThreadWakeupCallbackEventType() const { | ||
| 599 | return impl->thread_wakeup_event_type; | ||
| 600 | } | ||
| 601 | |||
| 602 | Kernel::HandleTable& KernelCore::GlobalHandleTable() { | 525 | Kernel::HandleTable& KernelCore::GlobalHandleTable() { |
| 603 | return impl->global_handle_table; | 526 | return impl->global_handle_table; |
| 604 | } | 527 | } |
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 846056b85..49bd47e89 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -241,9 +241,6 @@ private: | |||
| 241 | /// Creates a new thread ID, incrementing the internal thread ID counter. | 241 | /// Creates a new thread ID, incrementing the internal thread ID counter. |
| 242 | u64 CreateNewThreadID(); | 242 | u64 CreateNewThreadID(); |
| 243 | 243 | ||
| 244 | /// Retrieves the event type used for thread wakeup callbacks. | ||
| 245 | const std::shared_ptr<Core::Timing::EventType>& ThreadWakeupCallbackEventType() const; | ||
| 246 | |||
| 247 | /// Provides a reference to the global handle table. | 244 | /// Provides a reference to the global handle table. |
| 248 | Kernel::HandleTable& GlobalHandleTable(); | 245 | Kernel::HandleTable& GlobalHandleTable(); |
| 249 | 246 | ||
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index dbd35580e..781032cd1 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include "common/string_util.h" | 16 | #include "common/string_util.h" |
| 17 | #include "core/arm/exclusive_monitor.h" | 17 | #include "core/arm/exclusive_monitor.h" |
| 18 | #include "core/core.h" | 18 | #include "core/core.h" |
| 19 | #include "core/core_manager.h" | ||
| 20 | #include "core/core_timing.h" | 19 | #include "core/core_timing.h" |
| 21 | #include "core/core_timing_util.h" | 20 | #include "core/core_timing_util.h" |
| 22 | #include "core/cpu_manager.h" | 21 | #include "core/cpu_manager.h" |
| @@ -1909,7 +1908,7 @@ static ResultCode SetThreadCoreMask(Core::System& system, Handle thread_handle, | |||
| 1909 | return ERR_INVALID_COMBINATION; | 1908 | return ERR_INVALID_COMBINATION; |
| 1910 | } | 1909 | } |
| 1911 | 1910 | ||
| 1912 | if (core < Core::NUM_CPU_CORES) { | 1911 | if (core < Core::Hardware::NUM_CPU_CORES) { |
| 1913 | if ((affinity_mask & (1ULL << core)) == 0) { | 1912 | if ((affinity_mask & (1ULL << core)) == 0) { |
| 1914 | LOG_ERROR(Kernel_SVC, | 1913 | LOG_ERROR(Kernel_SVC, |
| 1915 | "Core is not enabled for the current mask, core={}, mask={:016X}", core, | 1914 | "Core is not enabled for the current mask, core={}, mask={:016X}", core, |
diff --git a/src/core/hle/kernel/synchronization_object.cpp b/src/core/hle/kernel/synchronization_object.cpp index be9e09106..ba4d39157 100644 --- a/src/core/hle/kernel/synchronization_object.cpp +++ b/src/core/hle/kernel/synchronization_object.cpp | |||
| @@ -38,70 +38,6 @@ void SynchronizationObject::RemoveWaitingThread(std::shared_ptr<Thread> thread) | |||
| 38 | waiting_threads.erase(itr); | 38 | waiting_threads.erase(itr); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | std::shared_ptr<Thread> SynchronizationObject::GetHighestPriorityReadyThread() const { | ||
| 42 | Thread* candidate = nullptr; | ||
| 43 | u32 candidate_priority = THREADPRIO_LOWEST + 1; | ||
| 44 | |||
| 45 | for (const auto& thread : waiting_threads) { | ||
| 46 | const ThreadStatus thread_status = thread->GetStatus(); | ||
| 47 | |||
| 48 | // The list of waiting threads must not contain threads that are not waiting to be awakened. | ||
| 49 | ASSERT_MSG(thread_status == ThreadStatus::WaitSynch || | ||
| 50 | thread_status == ThreadStatus::WaitHLEEvent, | ||
| 51 | "Inconsistent thread statuses in waiting_threads"); | ||
| 52 | |||
| 53 | if (thread->GetPriority() >= candidate_priority) | ||
| 54 | continue; | ||
| 55 | |||
| 56 | if (ShouldWait(thread.get())) | ||
| 57 | continue; | ||
| 58 | |||
| 59 | candidate = thread.get(); | ||
| 60 | candidate_priority = thread->GetPriority(); | ||
| 61 | } | ||
| 62 | |||
| 63 | return SharedFrom(candidate); | ||
| 64 | } | ||
| 65 | |||
| 66 | void SynchronizationObject::WakeupWaitingThread(std::shared_ptr<Thread> thread) { | ||
| 67 | ASSERT(!ShouldWait(thread.get())); | ||
| 68 | |||
| 69 | if (!thread) { | ||
| 70 | return; | ||
| 71 | } | ||
| 72 | |||
| 73 | if (thread->IsSleepingOnWait()) { | ||
| 74 | for (const auto& object : thread->GetSynchronizationObjects()) { | ||
| 75 | ASSERT(!object->ShouldWait(thread.get())); | ||
| 76 | object->Acquire(thread.get()); | ||
| 77 | } | ||
| 78 | } else { | ||
| 79 | Acquire(thread.get()); | ||
| 80 | } | ||
| 81 | |||
| 82 | const std::size_t index = thread->GetSynchronizationObjectIndex(SharedFrom(this)); | ||
| 83 | |||
| 84 | thread->ClearSynchronizationObjects(); | ||
| 85 | |||
| 86 | thread->CancelWakeupTimer(); | ||
| 87 | |||
| 88 | bool resume = true; | ||
| 89 | if (thread->HasWakeupCallback()) { | ||
| 90 | resume = thread->InvokeWakeupCallback(ThreadWakeupReason::Signal, thread, SharedFrom(this), | ||
| 91 | index); | ||
| 92 | } | ||
| 93 | if (resume) { | ||
| 94 | thread->ResumeFromWait(); | ||
| 95 | kernel.PrepareReschedule(thread->GetProcessorID()); | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | void SynchronizationObject::WakeupAllWaitingThreads() { | ||
| 100 | while (auto thread = GetHighestPriorityReadyThread()) { | ||
| 101 | WakeupWaitingThread(thread); | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | void SynchronizationObject::ClearWaitingThreads() { | 41 | void SynchronizationObject::ClearWaitingThreads() { |
| 106 | waiting_threads.clear(); | 42 | waiting_threads.clear(); |
| 107 | } | 43 | } |
diff --git a/src/core/hle/kernel/synchronization_object.h b/src/core/hle/kernel/synchronization_object.h index a35544ac1..f89b24204 100644 --- a/src/core/hle/kernel/synchronization_object.h +++ b/src/core/hle/kernel/synchronization_object.h | |||
| @@ -50,21 +50,6 @@ public: | |||
| 50 | */ | 50 | */ |
| 51 | void RemoveWaitingThread(std::shared_ptr<Thread> thread); | 51 | void RemoveWaitingThread(std::shared_ptr<Thread> thread); |
| 52 | 52 | ||
| 53 | /** | ||
| 54 | * Wake up all threads waiting on this object that can be awoken, in priority order, | ||
| 55 | * and set the synchronization result and output of the thread. | ||
| 56 | */ | ||
| 57 | void /* deprecated */ WakeupAllWaitingThreads(); | ||
| 58 | |||
| 59 | /** | ||
| 60 | * Wakes up a single thread waiting on this object. | ||
| 61 | * @param thread Thread that is waiting on this object to wakeup. | ||
| 62 | */ | ||
| 63 | void WakeupWaitingThread(std::shared_ptr<Thread> thread); | ||
| 64 | |||
| 65 | /// Obtains the highest priority thread that is ready to run from this object's waiting list. | ||
| 66 | std::shared_ptr<Thread> /* deprecated */ GetHighestPriorityReadyThread() const; | ||
| 67 | |||
| 68 | /// Get a const reference to the waiting threads list for debug use | 53 | /// Get a const reference to the waiting threads list for debug use |
| 69 | const std::vector<std::shared_ptr<Thread>>& GetWaitingThreads() const; | 54 | const std::vector<std::shared_ptr<Thread>>& GetWaitingThreads() const; |
| 70 | 55 | ||
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index d88039a16..fba2a9c85 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -56,9 +56,6 @@ Thread::~Thread() = default; | |||
| 56 | void Thread::Stop() { | 56 | void Thread::Stop() { |
| 57 | { | 57 | { |
| 58 | SchedulerLock lock(kernel); | 58 | SchedulerLock lock(kernel); |
| 59 | // Cancel any outstanding wakeup events for this thread | ||
| 60 | Core::System::GetInstance().CoreTiming().UnscheduleEvent( | ||
| 61 | kernel.ThreadWakeupCallbackEventType(), global_handle); | ||
| 62 | SetStatus(ThreadStatus::Dead); | 59 | SetStatus(ThreadStatus::Dead); |
| 63 | Signal(); | 60 | Signal(); |
| 64 | kernel.GlobalHandleTable().Close(global_handle); | 61 | kernel.GlobalHandleTable().Close(global_handle); |
| @@ -75,22 +72,6 @@ void Thread::Stop() { | |||
| 75 | global_handle = 0; | 72 | global_handle = 0; |
| 76 | } | 73 | } |
| 77 | 74 | ||
| 78 | void Thread::WakeAfterDelay(s64 nanoseconds) { | ||
| 79 | // Don't schedule a wakeup if the thread wants to wait forever | ||
| 80 | if (nanoseconds == -1) | ||
| 81 | return; | ||
| 82 | |||
| 83 | // This function might be called from any thread so we have to be cautious and use the | ||
| 84 | // thread-safe version of ScheduleEvent. | ||
| 85 | Core::System::GetInstance().CoreTiming().ScheduleEvent( | ||
| 86 | nanoseconds, kernel.ThreadWakeupCallbackEventType(), global_handle); | ||
| 87 | } | ||
| 88 | |||
| 89 | void Thread::CancelWakeupTimer() { | ||
| 90 | Core::System::GetInstance().CoreTiming().UnscheduleEvent(kernel.ThreadWakeupCallbackEventType(), | ||
| 91 | global_handle); | ||
| 92 | } | ||
| 93 | |||
| 94 | void Thread::ResumeFromWait() { | 75 | void Thread::ResumeFromWait() { |
| 95 | SchedulerLock lock(kernel); | 76 | SchedulerLock lock(kernel); |
| 96 | switch (status) { | 77 | switch (status) { |
| @@ -284,14 +265,6 @@ void Thread::SetPriority(u32 priority) { | |||
| 284 | UpdatePriority(); | 265 | UpdatePriority(); |
| 285 | } | 266 | } |
| 286 | 267 | ||
| 287 | void Thread::SetWaitSynchronizationResult(ResultCode result) { | ||
| 288 | UNREACHABLE(); | ||
| 289 | } | ||
| 290 | |||
| 291 | void Thread::SetWaitSynchronizationOutput(s32 output) { | ||
| 292 | UNREACHABLE(); | ||
| 293 | } | ||
| 294 | |||
| 295 | void Thread::SetSynchronizationResults(SynchronizationObject* object, ResultCode result) { | 268 | void Thread::SetSynchronizationResults(SynchronizationObject* object, ResultCode result) { |
| 296 | signaling_object = object; | 269 | signaling_object = object; |
| 297 | signaling_result = result; | 270 | signaling_result = result; |
| @@ -425,13 +398,6 @@ bool Thread::AllSynchronizationObjectsReady() const { | |||
| 425 | }); | 398 | }); |
| 426 | } | 399 | } |
| 427 | 400 | ||
| 428 | bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||
| 429 | std::shared_ptr<SynchronizationObject> object, | ||
| 430 | std::size_t index) { | ||
| 431 | ASSERT(wakeup_callback); | ||
| 432 | return wakeup_callback(reason, std::move(thread), std::move(object), index); | ||
| 433 | } | ||
| 434 | |||
| 435 | bool Thread::InvokeHLECallback(std::shared_ptr<Thread> thread) { | 401 | bool Thread::InvokeHLECallback(std::shared_ptr<Thread> thread) { |
| 436 | ASSERT(hle_callback); | 402 | ASSERT(hle_callback); |
| 437 | return hle_callback(std::move(thread)); | 403 | return hle_callback(std::move(thread)); |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 61963148d..3ae0df6ef 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -128,9 +128,6 @@ public: | |||
| 128 | 128 | ||
| 129 | using ThreadSynchronizationObjects = std::vector<std::shared_ptr<SynchronizationObject>>; | 129 | using ThreadSynchronizationObjects = std::vector<std::shared_ptr<SynchronizationObject>>; |
| 130 | 130 | ||
| 131 | using WakeupCallback = | ||
| 132 | std::function<bool(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||
| 133 | std::shared_ptr<SynchronizationObject> object, std::size_t index)>; | ||
| 134 | using HLECallback = std::function<bool(std::shared_ptr<Thread> thread)>; | 131 | using HLECallback = std::function<bool(std::shared_ptr<Thread> thread)>; |
| 135 | 132 | ||
| 136 | /** | 133 | /** |
| @@ -235,7 +232,7 @@ public: | |||
| 235 | } | 232 | } |
| 236 | 233 | ||
| 237 | /// Resumes a thread from waiting | 234 | /// Resumes a thread from waiting |
| 238 | void /* deprecated */ ResumeFromWait(); | 235 | void ResumeFromWait(); |
| 239 | 236 | ||
| 240 | void OnWakeUp(); | 237 | void OnWakeUp(); |
| 241 | 238 | ||
| @@ -249,27 +246,6 @@ public: | |||
| 249 | /// | 246 | /// |
| 250 | void CancelWait(); | 247 | void CancelWait(); |
| 251 | 248 | ||
| 252 | /** | ||
| 253 | * Schedules an event to wake up the specified thread after the specified delay | ||
| 254 | * @param nanoseconds The time this thread will be allowed to sleep for | ||
| 255 | */ | ||
| 256 | void /* deprecated */ WakeAfterDelay(s64 nanoseconds); | ||
| 257 | |||
| 258 | /// Cancel any outstanding wakeup events for this thread | ||
| 259 | void /* deprecated */ CancelWakeupTimer(); | ||
| 260 | |||
| 261 | /** | ||
| 262 | * Sets the result after the thread awakens (from svcWaitSynchronization) | ||
| 263 | * @param result Value to set to the returned result | ||
| 264 | */ | ||
| 265 | void /*deprecated*/ SetWaitSynchronizationResult(ResultCode result); | ||
| 266 | |||
| 267 | /** | ||
| 268 | * Sets the output parameter value after the thread awakens (from svcWaitSynchronization) | ||
| 269 | * @param output Value to set to the output parameter | ||
| 270 | */ | ||
| 271 | void /*deprecated*/ SetWaitSynchronizationOutput(s32 output); | ||
| 272 | |||
| 273 | void SetSynchronizationResults(SynchronizationObject* object, ResultCode result); | 249 | void SetSynchronizationResults(SynchronizationObject* object, ResultCode result); |
| 274 | 250 | ||
| 275 | Core::ARM_Interface& ArmInterface(); | 251 | Core::ARM_Interface& ArmInterface(); |
| @@ -330,11 +306,6 @@ public: | |||
| 330 | */ | 306 | */ |
| 331 | VAddr GetCommandBufferAddress() const; | 307 | VAddr GetCommandBufferAddress() const; |
| 332 | 308 | ||
| 333 | /// Returns whether this thread is waiting on objects from a WaitSynchronization call. | ||
| 334 | bool IsSleepingOnWait() const { | ||
| 335 | return status == ThreadStatus::WaitSynch; | ||
| 336 | } | ||
| 337 | |||
| 338 | ThreadContext32& GetContext32() { | 309 | ThreadContext32& GetContext32() { |
| 339 | return context_32; | 310 | return context_32; |
| 340 | } | 311 | } |
| @@ -469,18 +440,10 @@ public: | |||
| 469 | arb_wait_address = address; | 440 | arb_wait_address = address; |
| 470 | } | 441 | } |
| 471 | 442 | ||
| 472 | bool HasWakeupCallback() const { | ||
| 473 | return wakeup_callback != nullptr; | ||
| 474 | } | ||
| 475 | |||
| 476 | bool HasHLECallback() const { | 443 | bool HasHLECallback() const { |
| 477 | return hle_callback != nullptr; | 444 | return hle_callback != nullptr; |
| 478 | } | 445 | } |
| 479 | 446 | ||
| 480 | void SetWakeupCallback(WakeupCallback callback) { | ||
| 481 | wakeup_callback = std::move(callback); | ||
| 482 | } | ||
| 483 | |||
| 484 | void SetHLECallback(HLECallback callback) { | 447 | void SetHLECallback(HLECallback callback) { |
| 485 | hle_callback = std::move(callback); | 448 | hle_callback = std::move(callback); |
| 486 | } | 449 | } |
| @@ -501,22 +464,10 @@ public: | |||
| 501 | return hle_object; | 464 | return hle_object; |
| 502 | } | 465 | } |
| 503 | 466 | ||
| 504 | void InvalidateWakeupCallback() { | ||
| 505 | SetWakeupCallback(nullptr); | ||
| 506 | } | ||
| 507 | |||
| 508 | void InvalidateHLECallback() { | 467 | void InvalidateHLECallback() { |
| 509 | SetHLECallback(nullptr); | 468 | SetHLECallback(nullptr); |
| 510 | } | 469 | } |
| 511 | 470 | ||
| 512 | /** | ||
| 513 | * Invokes the thread's wakeup callback. | ||
| 514 | * | ||
| 515 | * @pre A valid wakeup callback has been set. Violating this precondition | ||
| 516 | * will cause an assertion to trigger. | ||
| 517 | */ | ||
| 518 | bool InvokeWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | ||
| 519 | std::shared_ptr<SynchronizationObject> object, std::size_t index); | ||
| 520 | bool InvokeHLECallback(std::shared_ptr<Thread> thread); | 471 | bool InvokeHLECallback(std::shared_ptr<Thread> thread); |
| 521 | 472 | ||
| 522 | u32 GetIdealCore() const { | 473 | u32 GetIdealCore() const { |
| @@ -698,11 +649,6 @@ private: | |||
| 698 | /// Handle used as userdata to reference this object when inserting into the CoreTiming queue. | 649 | /// Handle used as userdata to reference this object when inserting into the CoreTiming queue. |
| 699 | Handle global_handle = 0; | 650 | Handle global_handle = 0; |
| 700 | 651 | ||
| 701 | /// Callback that will be invoked when the thread is resumed from a waiting state. If the thread | ||
| 702 | /// was waiting via WaitSynchronization then the object will be the last object that became | ||
| 703 | /// available. In case of a timeout, the object will be nullptr. DEPRECATED | ||
| 704 | WakeupCallback wakeup_callback; | ||
| 705 | |||
| 706 | /// Callback for HLE Events | 652 | /// Callback for HLE Events |
| 707 | HLECallback hle_callback; | 653 | HLECallback hle_callback; |
| 708 | Handle hle_time_event; | 654 | Handle hle_time_event; |