diff options
| author | 2020-02-11 10:46:25 -0400 | |
|---|---|---|
| committer | 2020-02-11 10:46:25 -0400 | |
| commit | c5aefe42aaec7afa29d317709cacc8524f7add20 (patch) | |
| tree | 5f9341ac7eb10d85b52c5a70e217f80963dc9e99 /src | |
| parent | Merge pull request #3372 from ReinUsesLisp/fix-back-stencil (diff) | |
| download | yuzu-c5aefe42aaec7afa29d317709cacc8524f7add20.tar.gz yuzu-c5aefe42aaec7afa29d317709cacc8524f7add20.tar.xz yuzu-c5aefe42aaec7afa29d317709cacc8524f7add20.zip | |
Kernel: Change WaitObject to Synchronization object. In order to better reflect RE.
Diffstat (limited to 'src')
22 files changed, 110 insertions, 98 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d342cafe0..052907f08 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -181,14 +181,14 @@ add_library(core STATIC | |||
| 181 | hle/kernel/svc.cpp | 181 | hle/kernel/svc.cpp |
| 182 | hle/kernel/svc.h | 182 | hle/kernel/svc.h |
| 183 | hle/kernel/svc_wrap.h | 183 | hle/kernel/svc_wrap.h |
| 184 | hle/kernel/synchronization_object.cpp | ||
| 185 | hle/kernel/synchronization_object.h | ||
| 184 | hle/kernel/thread.cpp | 186 | hle/kernel/thread.cpp |
| 185 | hle/kernel/thread.h | 187 | hle/kernel/thread.h |
| 186 | hle/kernel/transfer_memory.cpp | 188 | hle/kernel/transfer_memory.cpp |
| 187 | hle/kernel/transfer_memory.h | 189 | hle/kernel/transfer_memory.h |
| 188 | hle/kernel/vm_manager.cpp | 190 | hle/kernel/vm_manager.cpp |
| 189 | hle/kernel/vm_manager.h | 191 | hle/kernel/vm_manager.h |
| 190 | hle/kernel/wait_object.cpp | ||
| 191 | hle/kernel/wait_object.h | ||
| 192 | hle/kernel/writable_event.cpp | 192 | hle/kernel/writable_event.cpp |
| 193 | hle/kernel/writable_event.h | 193 | hle/kernel/writable_event.h |
| 194 | hle/lock.cpp | 194 | hle/lock.cpp |
diff --git a/src/core/hle/kernel/client_session.cpp b/src/core/hle/kernel/client_session.cpp index 4669a14ad..3dfeb9813 100644 --- a/src/core/hle/kernel/client_session.cpp +++ b/src/core/hle/kernel/client_session.cpp | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | namespace Kernel { | 13 | namespace Kernel { |
| 14 | 14 | ||
| 15 | ClientSession::ClientSession(KernelCore& kernel) : WaitObject{kernel} {} | 15 | ClientSession::ClientSession(KernelCore& kernel) : SynchronizationObject{kernel} {} |
| 16 | 16 | ||
| 17 | ClientSession::~ClientSession() { | 17 | ClientSession::~ClientSession() { |
| 18 | // This destructor will be called automatically when the last ClientSession handle is closed by | 18 | // This destructor will be called automatically when the last ClientSession handle is closed by |
diff --git a/src/core/hle/kernel/client_session.h b/src/core/hle/kernel/client_session.h index b4289a9a8..9cf9219b1 100644 --- a/src/core/hle/kernel/client_session.h +++ b/src/core/hle/kernel/client_session.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | 9 | ||
| 10 | #include "core/hle/kernel/wait_object.h" | 10 | #include "core/hle/kernel/synchronization_object.h" |
| 11 | #include "core/hle/result.h" | 11 | #include "core/hle/result.h" |
| 12 | 12 | ||
| 13 | union ResultCode; | 13 | union ResultCode; |
| @@ -22,7 +22,7 @@ class KernelCore; | |||
| 22 | class Session; | 22 | class Session; |
| 23 | class Thread; | 23 | class Thread; |
| 24 | 24 | ||
| 25 | class ClientSession final : public WaitObject { | 25 | class ClientSession final : public SynchronizationObject { |
| 26 | public: | 26 | public: |
| 27 | explicit ClientSession(KernelCore& kernel); | 27 | explicit ClientSession(KernelCore& kernel); |
| 28 | ~ClientSession() override; | 28 | ~ClientSession() override; |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index ab05788d7..c558a2f33 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -47,15 +47,15 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread( | |||
| 47 | const std::string& reason, u64 timeout, WakeupCallback&& callback, | 47 | const std::string& reason, u64 timeout, WakeupCallback&& callback, |
| 48 | std::shared_ptr<WritableEvent> writable_event) { | 48 | std::shared_ptr<WritableEvent> writable_event) { |
| 49 | // Put the client thread to sleep until the wait event is signaled or the timeout expires. | 49 | // Put the client thread to sleep until the wait event is signaled or the timeout expires. |
| 50 | thread->SetWakeupCallback([context = *this, callback](ThreadWakeupReason reason, | 50 | thread->SetWakeupCallback( |
| 51 | std::shared_ptr<Thread> thread, | 51 | [context = *this, callback](ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |
| 52 | std::shared_ptr<WaitObject> object, | 52 | std::shared_ptr<SynchronizationObject> object, |
| 53 | std::size_t index) mutable -> bool { | 53 | std::size_t index) mutable -> bool { |
| 54 | ASSERT(thread->GetStatus() == ThreadStatus::WaitHLEEvent); | 54 | ASSERT(thread->GetStatus() == ThreadStatus::WaitHLEEvent); |
| 55 | callback(thread, context, reason); | 55 | callback(thread, context, reason); |
| 56 | context.WriteToOutgoingCommandBuffer(*thread); | 56 | context.WriteToOutgoingCommandBuffer(*thread); |
| 57 | return true; | 57 | return true; |
| 58 | }); | 58 | }); |
| 59 | 59 | ||
| 60 | auto& kernel = Core::System::GetInstance().Kernel(); | 60 | auto& kernel = Core::System::GetInstance().Kernel(); |
| 61 | if (!writable_event) { | 61 | if (!writable_event) { |
| @@ -67,7 +67,7 @@ std::shared_ptr<WritableEvent> HLERequestContext::SleepClientThread( | |||
| 67 | const auto readable_event{writable_event->GetReadableEvent()}; | 67 | const auto readable_event{writable_event->GetReadableEvent()}; |
| 68 | writable_event->Clear(); | 68 | writable_event->Clear(); |
| 69 | thread->SetStatus(ThreadStatus::WaitHLEEvent); | 69 | thread->SetStatus(ThreadStatus::WaitHLEEvent); |
| 70 | thread->SetWaitObjects({readable_event}); | 70 | thread->SetSynchronizationObjects({readable_event}); |
| 71 | readable_event->AddWaitingThread(thread); | 71 | readable_event->AddWaitingThread(thread); |
| 72 | 72 | ||
| 73 | if (timeout > 0) { | 73 | if (timeout > 0) { |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index edd4c4259..26799f6b5 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -54,10 +54,10 @@ static void ThreadWakeupCallback(u64 thread_handle, [[maybe_unused]] s64 cycles_ | |||
| 54 | if (thread->GetStatus() == ThreadStatus::WaitSynch || | 54 | if (thread->GetStatus() == ThreadStatus::WaitSynch || |
| 55 | thread->GetStatus() == ThreadStatus::WaitHLEEvent) { | 55 | thread->GetStatus() == ThreadStatus::WaitHLEEvent) { |
| 56 | // Remove the thread from each of its waiting objects' waitlists | 56 | // Remove the thread from each of its waiting objects' waitlists |
| 57 | for (const auto& object : thread->GetWaitObjects()) { | 57 | for (const auto& object : thread->GetSynchronizationObjects()) { |
| 58 | object->RemoveWaitingThread(thread); | 58 | object->RemoveWaitingThread(thread); |
| 59 | } | 59 | } |
| 60 | thread->ClearWaitObjects(); | 60 | thread->ClearSynchronizationObjects(); |
| 61 | 61 | ||
| 62 | // Invoke the wakeup callback before clearing the wait objects | 62 | // Invoke the wakeup callback before clearing the wait objects |
| 63 | if (thread->HasWakeupCallback()) { | 63 | if (thread->HasWakeupCallback()) { |
diff --git a/src/core/hle/kernel/process.cpp b/src/core/hle/kernel/process.cpp index b9035a0be..7a616435a 100644 --- a/src/core/hle/kernel/process.cpp +++ b/src/core/hle/kernel/process.cpp | |||
| @@ -337,7 +337,7 @@ void Process::LoadModule(CodeSet module_, VAddr base_addr) { | |||
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | Process::Process(Core::System& system) | 339 | Process::Process(Core::System& system) |
| 340 | : WaitObject{system.Kernel()}, vm_manager{system}, | 340 | : SynchronizationObject{system.Kernel()}, vm_manager{system}, |
| 341 | address_arbiter{system}, mutex{system}, system{system} {} | 341 | address_arbiter{system}, mutex{system}, system{system} {} |
| 342 | 342 | ||
| 343 | Process::~Process() = default; | 343 | Process::~Process() = default; |
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 3483fa19d..7b64c564a 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | #include "core/hle/kernel/handle_table.h" | 15 | #include "core/hle/kernel/handle_table.h" |
| 16 | #include "core/hle/kernel/mutex.h" | 16 | #include "core/hle/kernel/mutex.h" |
| 17 | #include "core/hle/kernel/process_capability.h" | 17 | #include "core/hle/kernel/process_capability.h" |
| 18 | #include "core/hle/kernel/synchronization_object.h" | ||
| 18 | #include "core/hle/kernel/vm_manager.h" | 19 | #include "core/hle/kernel/vm_manager.h" |
| 19 | #include "core/hle/kernel/wait_object.h" | ||
| 20 | #include "core/hle/result.h" | 20 | #include "core/hle/result.h" |
| 21 | 21 | ||
| 22 | namespace Core { | 22 | namespace Core { |
| @@ -60,7 +60,7 @@ enum class ProcessStatus { | |||
| 60 | DebugBreak, | 60 | DebugBreak, |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | class Process final : public WaitObject { | 63 | class Process final : public SynchronizationObject { |
| 64 | public: | 64 | public: |
| 65 | explicit Process(Core::System& system); | 65 | explicit Process(Core::System& system); |
| 66 | ~Process() override; | 66 | ~Process() override; |
diff --git a/src/core/hle/kernel/readable_event.cpp b/src/core/hle/kernel/readable_event.cpp index d8ac97aa1..8ab796ba8 100644 --- a/src/core/hle/kernel/readable_event.cpp +++ b/src/core/hle/kernel/readable_event.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | namespace Kernel { | 12 | namespace Kernel { |
| 13 | 13 | ||
| 14 | ReadableEvent::ReadableEvent(KernelCore& kernel) : WaitObject{kernel} {} | 14 | ReadableEvent::ReadableEvent(KernelCore& kernel) : SynchronizationObject{kernel} {} |
| 15 | ReadableEvent::~ReadableEvent() = default; | 15 | ReadableEvent::~ReadableEvent() = default; |
| 16 | 16 | ||
| 17 | bool ReadableEvent::ShouldWait(const Thread* thread) const { | 17 | bool ReadableEvent::ShouldWait(const Thread* thread) const { |
diff --git a/src/core/hle/kernel/readable_event.h b/src/core/hle/kernel/readable_event.h index 11ff71c3a..c7b0d6add 100644 --- a/src/core/hle/kernel/readable_event.h +++ b/src/core/hle/kernel/readable_event.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "core/hle/kernel/object.h" | 7 | #include "core/hle/kernel/object.h" |
| 8 | #include "core/hle/kernel/wait_object.h" | 8 | #include "core/hle/kernel/synchronization_object.h" |
| 9 | 9 | ||
| 10 | union ResultCode; | 10 | union ResultCode; |
| 11 | 11 | ||
| @@ -14,7 +14,7 @@ namespace Kernel { | |||
| 14 | class KernelCore; | 14 | class KernelCore; |
| 15 | class WritableEvent; | 15 | class WritableEvent; |
| 16 | 16 | ||
| 17 | class ReadableEvent final : public WaitObject { | 17 | class ReadableEvent final : public SynchronizationObject { |
| 18 | friend class WritableEvent; | 18 | friend class WritableEvent; |
| 19 | 19 | ||
| 20 | public: | 20 | public: |
diff --git a/src/core/hle/kernel/server_port.cpp b/src/core/hle/kernel/server_port.cpp index a4ccfa35e..4f02f8df2 100644 --- a/src/core/hle/kernel/server_port.cpp +++ b/src/core/hle/kernel/server_port.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | namespace Kernel { | 14 | namespace Kernel { |
| 15 | 15 | ||
| 16 | ServerPort::ServerPort(KernelCore& kernel) : WaitObject{kernel} {} | 16 | ServerPort::ServerPort(KernelCore& kernel) : SynchronizationObject{kernel} {} |
| 17 | ServerPort::~ServerPort() = default; | 17 | ServerPort::~ServerPort() = default; |
| 18 | 18 | ||
| 19 | ResultVal<std::shared_ptr<ServerSession>> ServerPort::Accept() { | 19 | ResultVal<std::shared_ptr<ServerSession>> ServerPort::Accept() { |
diff --git a/src/core/hle/kernel/server_port.h b/src/core/hle/kernel/server_port.h index 8be8a75ea..43cf3ae18 100644 --- a/src/core/hle/kernel/server_port.h +++ b/src/core/hle/kernel/server_port.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "core/hle/kernel/object.h" | 12 | #include "core/hle/kernel/object.h" |
| 13 | #include "core/hle/kernel/wait_object.h" | 13 | #include "core/hle/kernel/synchronization_object.h" |
| 14 | #include "core/hle/result.h" | 14 | #include "core/hle/result.h" |
| 15 | 15 | ||
| 16 | namespace Kernel { | 16 | namespace Kernel { |
| @@ -20,7 +20,7 @@ class KernelCore; | |||
| 20 | class ServerSession; | 20 | class ServerSession; |
| 21 | class SessionRequestHandler; | 21 | class SessionRequestHandler; |
| 22 | 22 | ||
| 23 | class ServerPort final : public WaitObject { | 23 | class ServerPort final : public SynchronizationObject { |
| 24 | public: | 24 | public: |
| 25 | explicit ServerPort(KernelCore& kernel); | 25 | explicit ServerPort(KernelCore& kernel); |
| 26 | ~ServerPort() override; | 26 | ~ServerPort() override; |
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 7825e1ec4..8207f71c3 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | namespace Kernel { | 25 | namespace Kernel { |
| 26 | 26 | ||
| 27 | ServerSession::ServerSession(KernelCore& kernel) : WaitObject{kernel} {} | 27 | ServerSession::ServerSession(KernelCore& kernel) : SynchronizationObject{kernel} {} |
| 28 | ServerSession::~ServerSession() = default; | 28 | ServerSession::~ServerSession() = default; |
| 29 | 29 | ||
| 30 | ResultVal<std::shared_ptr<ServerSession>> ServerSession::Create(KernelCore& kernel, | 30 | ResultVal<std::shared_ptr<ServerSession>> ServerSession::Create(KernelCore& kernel, |
diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h index d6e48109e..3688c7d11 100644 --- a/src/core/hle/kernel/server_session.h +++ b/src/core/hle/kernel/server_session.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include <vector> | 10 | #include <vector> |
| 11 | 11 | ||
| 12 | #include "common/threadsafe_queue.h" | 12 | #include "common/threadsafe_queue.h" |
| 13 | #include "core/hle/kernel/wait_object.h" | 13 | #include "core/hle/kernel/synchronization_object.h" |
| 14 | #include "core/hle/result.h" | 14 | #include "core/hle/result.h" |
| 15 | 15 | ||
| 16 | namespace Memory { | 16 | namespace Memory { |
| @@ -41,7 +41,7 @@ class Thread; | |||
| 41 | * After the server replies to the request, the response is marshalled back to the caller's | 41 | * After the server replies to the request, the response is marshalled back to the caller's |
| 42 | * TLS buffer and control is transferred back to it. | 42 | * TLS buffer and control is transferred back to it. |
| 43 | */ | 43 | */ |
| 44 | class ServerSession final : public WaitObject { | 44 | class ServerSession final : public SynchronizationObject { |
| 45 | public: | 45 | public: |
| 46 | explicit ServerSession(KernelCore& kernel); | 46 | explicit ServerSession(KernelCore& kernel); |
| 47 | ~ServerSession() override; | 47 | ~ServerSession() override; |
diff --git a/src/core/hle/kernel/session.cpp b/src/core/hle/kernel/session.cpp index dee6e2b72..1c1fc440d 100644 --- a/src/core/hle/kernel/session.cpp +++ b/src/core/hle/kernel/session.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | namespace Kernel { | 10 | namespace Kernel { |
| 11 | 11 | ||
| 12 | Session::Session(KernelCore& kernel) : WaitObject{kernel} {} | 12 | Session::Session(KernelCore& kernel) : SynchronizationObject{kernel} {} |
| 13 | Session::~Session() = default; | 13 | Session::~Session() = default; |
| 14 | 14 | ||
| 15 | Session::SessionPair Session::Create(KernelCore& kernel, std::string name) { | 15 | Session::SessionPair Session::Create(KernelCore& kernel, std::string name) { |
diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h index 15a5ac15f..d107dd9aa 100644 --- a/src/core/hle/kernel/session.h +++ b/src/core/hle/kernel/session.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <utility> | 9 | #include <utility> |
| 10 | 10 | ||
| 11 | #include "core/hle/kernel/wait_object.h" | 11 | #include "core/hle/kernel/synchronization_object.h" |
| 12 | 12 | ||
| 13 | namespace Kernel { | 13 | namespace Kernel { |
| 14 | 14 | ||
| @@ -19,7 +19,7 @@ class ServerSession; | |||
| 19 | * Parent structure to link the client and server endpoints of a session with their associated | 19 | * Parent structure to link the client and server endpoints of a session with their associated |
| 20 | * client port. | 20 | * client port. |
| 21 | */ | 21 | */ |
| 22 | class Session final : public WaitObject { | 22 | class Session final : public SynchronizationObject { |
| 23 | public: | 23 | public: |
| 24 | explicit Session(KernelCore& kernel); | 24 | explicit Session(KernelCore& kernel); |
| 25 | ~Session() override; | 25 | ~Session() override; |
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 9cae5c73d..39552a176 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -435,7 +435,8 @@ static ResultCode GetProcessId(Core::System& system, u64* process_id, Handle han | |||
| 435 | 435 | ||
| 436 | /// Default thread wakeup callback for WaitSynchronization | 436 | /// Default thread wakeup callback for WaitSynchronization |
| 437 | static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | 437 | static bool DefaultThreadWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |
| 438 | std::shared_ptr<WaitObject> object, std::size_t index) { | 438 | std::shared_ptr<SynchronizationObject> object, |
| 439 | std::size_t index) { | ||
| 439 | ASSERT(thread->GetStatus() == ThreadStatus::WaitSynch); | 440 | ASSERT(thread->GetStatus() == ThreadStatus::WaitSynch); |
| 440 | 441 | ||
| 441 | if (reason == ThreadWakeupReason::Timeout) { | 442 | if (reason == ThreadWakeupReason::Timeout) { |
| @@ -473,13 +474,13 @@ static ResultCode WaitSynchronization(Core::System& system, Handle* index, VAddr | |||
| 473 | 474 | ||
| 474 | auto* const thread = system.CurrentScheduler().GetCurrentThread(); | 475 | auto* const thread = system.CurrentScheduler().GetCurrentThread(); |
| 475 | 476 | ||
| 476 | using ObjectPtr = Thread::ThreadWaitObjects::value_type; | 477 | using ObjectPtr = Thread::ThreadSynchronizationObjects::value_type; |
| 477 | Thread::ThreadWaitObjects objects(handle_count); | 478 | Thread::ThreadSynchronizationObjects objects(handle_count); |
| 478 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); | 479 | const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable(); |
| 479 | 480 | ||
| 480 | for (u64 i = 0; i < handle_count; ++i) { | 481 | for (u64 i = 0; i < handle_count; ++i) { |
| 481 | const Handle handle = memory.Read32(handles_address + i * sizeof(Handle)); | 482 | const Handle handle = memory.Read32(handles_address + i * sizeof(Handle)); |
| 482 | const auto object = handle_table.Get<WaitObject>(handle); | 483 | const auto object = handle_table.Get<SynchronizationObject>(handle); |
| 483 | 484 | ||
| 484 | if (object == nullptr) { | 485 | if (object == nullptr) { |
| 485 | LOG_ERROR(Kernel_SVC, "Object is a nullptr"); | 486 | LOG_ERROR(Kernel_SVC, "Object is a nullptr"); |
| @@ -496,7 +497,7 @@ static ResultCode WaitSynchronization(Core::System& system, Handle* index, VAddr | |||
| 496 | 497 | ||
| 497 | if (itr != objects.end()) { | 498 | if (itr != objects.end()) { |
| 498 | // We found a ready object, acquire it and set the result value | 499 | // We found a ready object, acquire it and set the result value |
| 499 | WaitObject* object = itr->get(); | 500 | SynchronizationObject* object = itr->get(); |
| 500 | object->Acquire(thread); | 501 | object->Acquire(thread); |
| 501 | *index = static_cast<s32>(std::distance(objects.begin(), itr)); | 502 | *index = static_cast<s32>(std::distance(objects.begin(), itr)); |
| 502 | return RESULT_SUCCESS; | 503 | return RESULT_SUCCESS; |
| @@ -519,7 +520,7 @@ static ResultCode WaitSynchronization(Core::System& system, Handle* index, VAddr | |||
| 519 | object->AddWaitingThread(SharedFrom(thread)); | 520 | object->AddWaitingThread(SharedFrom(thread)); |
| 520 | } | 521 | } |
| 521 | 522 | ||
| 522 | thread->SetWaitObjects(std::move(objects)); | 523 | thread->SetSynchronizationObjects(std::move(objects)); |
| 523 | thread->SetStatus(ThreadStatus::WaitSynch); | 524 | thread->SetStatus(ThreadStatus::WaitSynch); |
| 524 | 525 | ||
| 525 | // Create an event to wake the thread up after the specified nanosecond delay has passed | 526 | // Create an event to wake the thread up after the specified nanosecond delay has passed |
diff --git a/src/core/hle/kernel/wait_object.cpp b/src/core/hle/kernel/synchronization_object.cpp index 1838260fd..95f3f9245 100644 --- a/src/core/hle/kernel/wait_object.cpp +++ b/src/core/hle/kernel/synchronization_object.cpp | |||
| @@ -10,20 +10,21 @@ | |||
| 10 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/kernel.h" |
| 11 | #include "core/hle/kernel/object.h" | 11 | #include "core/hle/kernel/object.h" |
| 12 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/process.h" |
| 13 | #include "core/hle/kernel/synchronization_object.h" | ||
| 13 | #include "core/hle/kernel/thread.h" | 14 | #include "core/hle/kernel/thread.h" |
| 14 | 15 | ||
| 15 | namespace Kernel { | 16 | namespace Kernel { |
| 16 | 17 | ||
| 17 | WaitObject::WaitObject(KernelCore& kernel) : Object{kernel} {} | 18 | SynchronizationObject::SynchronizationObject(KernelCore& kernel) : Object{kernel} {} |
| 18 | WaitObject::~WaitObject() = default; | 19 | SynchronizationObject::~SynchronizationObject() = default; |
| 19 | 20 | ||
| 20 | void WaitObject::AddWaitingThread(std::shared_ptr<Thread> thread) { | 21 | void SynchronizationObject::AddWaitingThread(std::shared_ptr<Thread> thread) { |
| 21 | auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); | 22 | auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); |
| 22 | if (itr == waiting_threads.end()) | 23 | if (itr == waiting_threads.end()) |
| 23 | waiting_threads.push_back(std::move(thread)); | 24 | waiting_threads.push_back(std::move(thread)); |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | void WaitObject::RemoveWaitingThread(std::shared_ptr<Thread> thread) { | 27 | void SynchronizationObject::RemoveWaitingThread(std::shared_ptr<Thread> thread) { |
| 27 | auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); | 28 | auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); |
| 28 | // If a thread passed multiple handles to the same object, | 29 | // If a thread passed multiple handles to the same object, |
| 29 | // the kernel might attempt to remove the thread from the object's | 30 | // the kernel might attempt to remove the thread from the object's |
| @@ -32,7 +33,7 @@ void WaitObject::RemoveWaitingThread(std::shared_ptr<Thread> thread) { | |||
| 32 | waiting_threads.erase(itr); | 33 | waiting_threads.erase(itr); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | std::shared_ptr<Thread> WaitObject::GetHighestPriorityReadyThread() const { | 36 | std::shared_ptr<Thread> SynchronizationObject::GetHighestPriorityReadyThread() const { |
| 36 | Thread* candidate = nullptr; | 37 | Thread* candidate = nullptr; |
| 37 | u32 candidate_priority = THREADPRIO_LOWEST + 1; | 38 | u32 candidate_priority = THREADPRIO_LOWEST + 1; |
| 38 | 39 | ||
| @@ -57,7 +58,7 @@ std::shared_ptr<Thread> WaitObject::GetHighestPriorityReadyThread() const { | |||
| 57 | return SharedFrom(candidate); | 58 | return SharedFrom(candidate); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | void WaitObject::WakeupWaitingThread(std::shared_ptr<Thread> thread) { | 61 | void SynchronizationObject::WakeupWaitingThread(std::shared_ptr<Thread> thread) { |
| 61 | ASSERT(!ShouldWait(thread.get())); | 62 | ASSERT(!ShouldWait(thread.get())); |
| 62 | 63 | ||
| 63 | if (!thread) { | 64 | if (!thread) { |
| @@ -65,7 +66,7 @@ void WaitObject::WakeupWaitingThread(std::shared_ptr<Thread> thread) { | |||
| 65 | } | 66 | } |
| 66 | 67 | ||
| 67 | if (thread->IsSleepingOnWait()) { | 68 | if (thread->IsSleepingOnWait()) { |
| 68 | for (const auto& object : thread->GetWaitObjects()) { | 69 | for (const auto& object : thread->GetSynchronizationObjects()) { |
| 69 | ASSERT(!object->ShouldWait(thread.get())); | 70 | ASSERT(!object->ShouldWait(thread.get())); |
| 70 | object->Acquire(thread.get()); | 71 | object->Acquire(thread.get()); |
| 71 | } | 72 | } |
| @@ -73,9 +74,9 @@ void WaitObject::WakeupWaitingThread(std::shared_ptr<Thread> thread) { | |||
| 73 | Acquire(thread.get()); | 74 | Acquire(thread.get()); |
| 74 | } | 75 | } |
| 75 | 76 | ||
| 76 | const std::size_t index = thread->GetWaitObjectIndex(SharedFrom(this)); | 77 | const std::size_t index = thread->GetSynchronizationObjectIndex(SharedFrom(this)); |
| 77 | 78 | ||
| 78 | thread->ClearWaitObjects(); | 79 | thread->ClearSynchronizationObjects(); |
| 79 | 80 | ||
| 80 | thread->CancelWakeupTimer(); | 81 | thread->CancelWakeupTimer(); |
| 81 | 82 | ||
| @@ -90,13 +91,13 @@ void WaitObject::WakeupWaitingThread(std::shared_ptr<Thread> thread) { | |||
| 90 | } | 91 | } |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | void WaitObject::WakeupAllWaitingThreads() { | 94 | void SynchronizationObject::WakeupAllWaitingThreads() { |
| 94 | while (auto thread = GetHighestPriorityReadyThread()) { | 95 | while (auto thread = GetHighestPriorityReadyThread()) { |
| 95 | WakeupWaitingThread(thread); | 96 | WakeupWaitingThread(thread); |
| 96 | } | 97 | } |
| 97 | } | 98 | } |
| 98 | 99 | ||
| 99 | const std::vector<std::shared_ptr<Thread>>& WaitObject::GetWaitingThreads() const { | 100 | const std::vector<std::shared_ptr<Thread>>& SynchronizationObject::GetWaitingThreads() const { |
| 100 | return waiting_threads; | 101 | return waiting_threads; |
| 101 | } | 102 | } |
| 102 | 103 | ||
diff --git a/src/core/hle/kernel/wait_object.h b/src/core/hle/kernel/synchronization_object.h index 9a17958a4..a0f891c97 100644 --- a/src/core/hle/kernel/wait_object.h +++ b/src/core/hle/kernel/synchronization_object.h | |||
| @@ -15,10 +15,10 @@ class KernelCore; | |||
| 15 | class Thread; | 15 | class Thread; |
| 16 | 16 | ||
| 17 | /// Class that represents a Kernel object that a thread can be waiting on | 17 | /// Class that represents a Kernel object that a thread can be waiting on |
| 18 | class WaitObject : public Object { | 18 | class SynchronizationObject : public Object { |
| 19 | public: | 19 | public: |
| 20 | explicit WaitObject(KernelCore& kernel); | 20 | explicit SynchronizationObject(KernelCore& kernel); |
| 21 | ~WaitObject() override; | 21 | ~SynchronizationObject() override; |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | * Check if the specified thread should wait until the object is available | 24 | * Check if the specified thread should wait until the object is available |
| @@ -65,11 +65,12 @@ private: | |||
| 65 | std::vector<std::shared_ptr<Thread>> waiting_threads; | 65 | std::vector<std::shared_ptr<Thread>> waiting_threads; |
| 66 | }; | 66 | }; |
| 67 | 67 | ||
| 68 | // Specialization of DynamicObjectCast for WaitObjects | 68 | // Specialization of DynamicObjectCast for SynchronizationObjects |
| 69 | template <> | 69 | template <> |
| 70 | inline std::shared_ptr<WaitObject> DynamicObjectCast<WaitObject>(std::shared_ptr<Object> object) { | 70 | inline std::shared_ptr<SynchronizationObject> DynamicObjectCast<SynchronizationObject>( |
| 71 | std::shared_ptr<Object> object) { | ||
| 71 | if (object != nullptr && object->IsWaitable()) { | 72 | if (object != nullptr && object->IsWaitable()) { |
| 72 | return std::static_pointer_cast<WaitObject>(object); | 73 | return std::static_pointer_cast<SynchronizationObject>(object); |
| 73 | } | 74 | } |
| 74 | return nullptr; | 75 | return nullptr; |
| 75 | } | 76 | } |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index e965b5b04..0f096ed6d 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -35,7 +35,7 @@ void Thread::Acquire(Thread* thread) { | |||
| 35 | ASSERT_MSG(!ShouldWait(thread), "object unavailable!"); | 35 | ASSERT_MSG(!ShouldWait(thread), "object unavailable!"); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | Thread::Thread(KernelCore& kernel) : WaitObject{kernel} {} | 38 | Thread::Thread(KernelCore& kernel) : SynchronizationObject{kernel} {} |
| 39 | Thread::~Thread() = default; | 39 | Thread::~Thread() = default; |
| 40 | 40 | ||
| 41 | void Thread::Stop() { | 41 | void Thread::Stop() { |
| @@ -215,7 +215,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) { | |||
| 215 | context.cpu_registers[1] = output; | 215 | context.cpu_registers[1] = output; |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | s32 Thread::GetWaitObjectIndex(std::shared_ptr<WaitObject> object) const { | 218 | s32 Thread::GetSynchronizationObjectIndex(std::shared_ptr<SynchronizationObject> object) const { |
| 219 | ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything"); | 219 | ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything"); |
| 220 | const auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object); | 220 | const auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object); |
| 221 | return static_cast<s32>(std::distance(match, wait_objects.rend()) - 1); | 221 | return static_cast<s32>(std::distance(match, wait_objects.rend()) - 1); |
| @@ -336,14 +336,16 @@ void Thread::ChangeCore(u32 core, u64 mask) { | |||
| 336 | SetCoreAndAffinityMask(core, mask); | 336 | SetCoreAndAffinityMask(core, mask); |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | bool Thread::AllWaitObjectsReady() const { | 339 | bool Thread::AllSynchronizationObjectsReady() const { |
| 340 | return std::none_of( | 340 | return std::none_of(wait_objects.begin(), wait_objects.end(), |
| 341 | wait_objects.begin(), wait_objects.end(), | 341 | [this](const std::shared_ptr<SynchronizationObject>& object) { |
| 342 | [this](const std::shared_ptr<WaitObject>& object) { return object->ShouldWait(this); }); | 342 | return object->ShouldWait(this); |
| 343 | }); | ||
| 343 | } | 344 | } |
| 344 | 345 | ||
| 345 | bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | 346 | bool Thread::InvokeWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |
| 346 | std::shared_ptr<WaitObject> object, std::size_t index) { | 347 | std::shared_ptr<SynchronizationObject> object, |
| 348 | std::size_t index) { | ||
| 347 | ASSERT(wakeup_callback); | 349 | ASSERT(wakeup_callback); |
| 348 | return wakeup_callback(reason, std::move(thread), std::move(object), index); | 350 | return wakeup_callback(reason, std::move(thread), std::move(object), index); |
| 349 | } | 351 | } |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 3bcf9e137..895258095 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "core/arm/arm_interface.h" | 12 | #include "core/arm/arm_interface.h" |
| 13 | #include "core/hle/kernel/object.h" | 13 | #include "core/hle/kernel/object.h" |
| 14 | #include "core/hle/kernel/wait_object.h" | 14 | #include "core/hle/kernel/synchronization_object.h" |
| 15 | #include "core/hle/result.h" | 15 | #include "core/hle/result.h" |
| 16 | 16 | ||
| 17 | namespace Kernel { | 17 | namespace Kernel { |
| @@ -95,7 +95,7 @@ enum class ThreadSchedMasks : u32 { | |||
| 95 | ForcePauseMask = 0x0070, | 95 | ForcePauseMask = 0x0070, |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | class Thread final : public WaitObject { | 98 | class Thread final : public SynchronizationObject { |
| 99 | public: | 99 | public: |
| 100 | explicit Thread(KernelCore& kernel); | 100 | explicit Thread(KernelCore& kernel); |
| 101 | ~Thread() override; | 101 | ~Thread() override; |
| @@ -104,11 +104,11 @@ public: | |||
| 104 | 104 | ||
| 105 | using ThreadContext = Core::ARM_Interface::ThreadContext; | 105 | using ThreadContext = Core::ARM_Interface::ThreadContext; |
| 106 | 106 | ||
| 107 | using ThreadWaitObjects = std::vector<std::shared_ptr<WaitObject>>; | 107 | using ThreadSynchronizationObjects = std::vector<std::shared_ptr<SynchronizationObject>>; |
| 108 | 108 | ||
| 109 | using WakeupCallback = | 109 | using WakeupCallback = |
| 110 | std::function<bool(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | 110 | std::function<bool(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |
| 111 | std::shared_ptr<WaitObject> object, std::size_t index)>; | 111 | std::shared_ptr<SynchronizationObject> object, std::size_t index)>; |
| 112 | 112 | ||
| 113 | /** | 113 | /** |
| 114 | * Creates and returns a new thread. The new thread is immediately scheduled | 114 | * Creates and returns a new thread. The new thread is immediately scheduled |
| @@ -233,7 +233,7 @@ public: | |||
| 233 | * | 233 | * |
| 234 | * @param object Object to query the index of. | 234 | * @param object Object to query the index of. |
| 235 | */ | 235 | */ |
| 236 | s32 GetWaitObjectIndex(std::shared_ptr<WaitObject> object) const; | 236 | s32 GetSynchronizationObjectIndex(std::shared_ptr<SynchronizationObject> object) const; |
| 237 | 237 | ||
| 238 | /** | 238 | /** |
| 239 | * Stops a thread, invalidating it from further use | 239 | * Stops a thread, invalidating it from further use |
| @@ -314,15 +314,15 @@ public: | |||
| 314 | return owner_process; | 314 | return owner_process; |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | const ThreadWaitObjects& GetWaitObjects() const { | 317 | const ThreadSynchronizationObjects& GetSynchronizationObjects() const { |
| 318 | return wait_objects; | 318 | return wait_objects; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | void SetWaitObjects(ThreadWaitObjects objects) { | 321 | void SetSynchronizationObjects(ThreadSynchronizationObjects objects) { |
| 322 | wait_objects = std::move(objects); | 322 | wait_objects = std::move(objects); |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | void ClearWaitObjects() { | 325 | void ClearSynchronizationObjects() { |
| 326 | for (const auto& waiting_object : wait_objects) { | 326 | for (const auto& waiting_object : wait_objects) { |
| 327 | waiting_object->RemoveWaitingThread(SharedFrom(this)); | 327 | waiting_object->RemoveWaitingThread(SharedFrom(this)); |
| 328 | } | 328 | } |
| @@ -330,7 +330,7 @@ public: | |||
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | /// Determines whether all the objects this thread is waiting on are ready. | 332 | /// Determines whether all the objects this thread is waiting on are ready. |
| 333 | bool AllWaitObjectsReady() const; | 333 | bool AllSynchronizationObjectsReady() const; |
| 334 | 334 | ||
| 335 | const MutexWaitingThreads& GetMutexWaitingThreads() const { | 335 | const MutexWaitingThreads& GetMutexWaitingThreads() const { |
| 336 | return wait_mutex_threads; | 336 | return wait_mutex_threads; |
| @@ -395,7 +395,7 @@ public: | |||
| 395 | * will cause an assertion to trigger. | 395 | * will cause an assertion to trigger. |
| 396 | */ | 396 | */ |
| 397 | bool InvokeWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, | 397 | bool InvokeWakeupCallback(ThreadWakeupReason reason, std::shared_ptr<Thread> thread, |
| 398 | std::shared_ptr<WaitObject> object, std::size_t index); | 398 | std::shared_ptr<SynchronizationObject> object, std::size_t index); |
| 399 | 399 | ||
| 400 | u32 GetIdealCore() const { | 400 | u32 GetIdealCore() const { |
| 401 | return ideal_core; | 401 | return ideal_core; |
| @@ -494,7 +494,7 @@ private: | |||
| 494 | 494 | ||
| 495 | /// Objects that the thread is waiting on, in the same order as they were | 495 | /// Objects that the thread is waiting on, in the same order as they were |
| 496 | /// passed to WaitSynchronization. | 496 | /// passed to WaitSynchronization. |
| 497 | ThreadWaitObjects wait_objects; | 497 | ThreadSynchronizationObjects wait_objects; |
| 498 | 498 | ||
| 499 | /// List of threads that are waiting for a mutex that is held by this thread. | 499 | /// List of threads that are waiting for a mutex that is held by this thread. |
| 500 | MutexWaitingThreads wait_mutex_threads; | 500 | MutexWaitingThreads wait_mutex_threads; |
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp index 727bd8a94..3f1a94627 100644 --- a/src/yuzu/debugger/wait_tree.cpp +++ b/src/yuzu/debugger/wait_tree.cpp | |||
| @@ -12,8 +12,8 @@ | |||
| 12 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/process.h" |
| 13 | #include "core/hle/kernel/readable_event.h" | 13 | #include "core/hle/kernel/readable_event.h" |
| 14 | #include "core/hle/kernel/scheduler.h" | 14 | #include "core/hle/kernel/scheduler.h" |
| 15 | #include "core/hle/kernel/synchronization_object.h" | ||
| 15 | #include "core/hle/kernel/thread.h" | 16 | #include "core/hle/kernel/thread.h" |
| 16 | #include "core/hle/kernel/wait_object.h" | ||
| 17 | #include "core/memory.h" | 17 | #include "core/memory.h" |
| 18 | 18 | ||
| 19 | WaitTreeItem::WaitTreeItem() = default; | 19 | WaitTreeItem::WaitTreeItem() = default; |
| @@ -133,8 +133,9 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons | |||
| 133 | return list; | 133 | return list; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | WaitTreeWaitObject::WaitTreeWaitObject(const Kernel::WaitObject& o) : object(o) {} | 136 | WaitTreeSynchronizationObject::WaitTreeSynchronizationObject(const Kernel::SynchronizationObject& o) |
| 137 | WaitTreeWaitObject::~WaitTreeWaitObject() = default; | 137 | : object(o) {} |
| 138 | WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default; | ||
| 138 | 139 | ||
| 139 | WaitTreeExpandableItem::WaitTreeExpandableItem() = default; | 140 | WaitTreeExpandableItem::WaitTreeExpandableItem() = default; |
| 140 | WaitTreeExpandableItem::~WaitTreeExpandableItem() = default; | 141 | WaitTreeExpandableItem::~WaitTreeExpandableItem() = default; |
| @@ -143,25 +144,26 @@ bool WaitTreeExpandableItem::IsExpandable() const { | |||
| 143 | return true; | 144 | return true; |
| 144 | } | 145 | } |
| 145 | 146 | ||
| 146 | QString WaitTreeWaitObject::GetText() const { | 147 | QString WaitTreeSynchronizationObject::GetText() const { |
| 147 | return tr("[%1]%2 %3") | 148 | return tr("[%1]%2 %3") |
| 148 | .arg(object.GetObjectId()) | 149 | .arg(object.GetObjectId()) |
| 149 | .arg(QString::fromStdString(object.GetTypeName()), | 150 | .arg(QString::fromStdString(object.GetTypeName()), |
| 150 | QString::fromStdString(object.GetName())); | 151 | QString::fromStdString(object.GetName())); |
| 151 | } | 152 | } |
| 152 | 153 | ||
| 153 | std::unique_ptr<WaitTreeWaitObject> WaitTreeWaitObject::make(const Kernel::WaitObject& object) { | 154 | std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make( |
| 155 | const Kernel::SynchronizationObject& object) { | ||
| 154 | switch (object.GetHandleType()) { | 156 | switch (object.GetHandleType()) { |
| 155 | case Kernel::HandleType::ReadableEvent: | 157 | case Kernel::HandleType::ReadableEvent: |
| 156 | return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::ReadableEvent&>(object)); | 158 | return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::ReadableEvent&>(object)); |
| 157 | case Kernel::HandleType::Thread: | 159 | case Kernel::HandleType::Thread: |
| 158 | return std::make_unique<WaitTreeThread>(static_cast<const Kernel::Thread&>(object)); | 160 | return std::make_unique<WaitTreeThread>(static_cast<const Kernel::Thread&>(object)); |
| 159 | default: | 161 | default: |
| 160 | return std::make_unique<WaitTreeWaitObject>(object); | 162 | return std::make_unique<WaitTreeSynchronizationObject>(object); |
| 161 | } | 163 | } |
| 162 | } | 164 | } |
| 163 | 165 | ||
| 164 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeWaitObject::GetChildren() const { | 166 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeSynchronizationObject::GetChildren() const { |
| 165 | std::vector<std::unique_ptr<WaitTreeItem>> list; | 167 | std::vector<std::unique_ptr<WaitTreeItem>> list; |
| 166 | 168 | ||
| 167 | const auto& threads = object.GetWaitingThreads(); | 169 | const auto& threads = object.GetWaitingThreads(); |
| @@ -173,8 +175,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeWaitObject::GetChildren() con | |||
| 173 | return list; | 175 | return list; |
| 174 | } | 176 | } |
| 175 | 177 | ||
| 176 | WaitTreeObjectList::WaitTreeObjectList(const std::vector<std::shared_ptr<Kernel::WaitObject>>& list, | 178 | WaitTreeObjectList::WaitTreeObjectList( |
| 177 | bool w_all) | 179 | const std::vector<std::shared_ptr<Kernel::SynchronizationObject>>& list, bool w_all) |
| 178 | : object_list(list), wait_all(w_all) {} | 180 | : object_list(list), wait_all(w_all) {} |
| 179 | 181 | ||
| 180 | WaitTreeObjectList::~WaitTreeObjectList() = default; | 182 | WaitTreeObjectList::~WaitTreeObjectList() = default; |
| @@ -188,11 +190,12 @@ QString WaitTreeObjectList::GetText() const { | |||
| 188 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const { | 190 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const { |
| 189 | std::vector<std::unique_ptr<WaitTreeItem>> list(object_list.size()); | 191 | std::vector<std::unique_ptr<WaitTreeItem>> list(object_list.size()); |
| 190 | std::transform(object_list.begin(), object_list.end(), list.begin(), | 192 | std::transform(object_list.begin(), object_list.end(), list.begin(), |
| 191 | [](const auto& t) { return WaitTreeWaitObject::make(*t); }); | 193 | [](const auto& t) { return WaitTreeSynchronizationObject::make(*t); }); |
| 192 | return list; | 194 | return list; |
| 193 | } | 195 | } |
| 194 | 196 | ||
| 195 | WaitTreeThread::WaitTreeThread(const Kernel::Thread& thread) : WaitTreeWaitObject(thread) {} | 197 | WaitTreeThread::WaitTreeThread(const Kernel::Thread& thread) |
| 198 | : WaitTreeSynchronizationObject(thread) {} | ||
| 196 | WaitTreeThread::~WaitTreeThread() = default; | 199 | WaitTreeThread::~WaitTreeThread() = default; |
| 197 | 200 | ||
| 198 | QString WaitTreeThread::GetText() const { | 201 | QString WaitTreeThread::GetText() const { |
| @@ -241,7 +244,8 @@ QString WaitTreeThread::GetText() const { | |||
| 241 | const QString pc_info = tr(" PC = 0x%1 LR = 0x%2") | 244 | const QString pc_info = tr(" PC = 0x%1 LR = 0x%2") |
| 242 | .arg(context.pc, 8, 16, QLatin1Char{'0'}) | 245 | .arg(context.pc, 8, 16, QLatin1Char{'0'}) |
| 243 | .arg(context.cpu_registers[30], 8, 16, QLatin1Char{'0'}); | 246 | .arg(context.cpu_registers[30], 8, 16, QLatin1Char{'0'}); |
| 244 | return QStringLiteral("%1%2 (%3) ").arg(WaitTreeWaitObject::GetText(), pc_info, status); | 247 | return QStringLiteral("%1%2 (%3) ") |
| 248 | .arg(WaitTreeSynchronizationObject::GetText(), pc_info, status); | ||
| 245 | } | 249 | } |
| 246 | 250 | ||
| 247 | QColor WaitTreeThread::GetColor() const { | 251 | QColor WaitTreeThread::GetColor() const { |
| @@ -273,7 +277,7 @@ QColor WaitTreeThread::GetColor() const { | |||
| 273 | } | 277 | } |
| 274 | 278 | ||
| 275 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const { | 279 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const { |
| 276 | std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren()); | 280 | std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeSynchronizationObject::GetChildren()); |
| 277 | 281 | ||
| 278 | const auto& thread = static_cast<const Kernel::Thread&>(object); | 282 | const auto& thread = static_cast<const Kernel::Thread&>(object); |
| 279 | 283 | ||
| @@ -314,7 +318,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const { | |||
| 314 | } | 318 | } |
| 315 | 319 | ||
| 316 | if (thread.GetStatus() == Kernel::ThreadStatus::WaitSynch) { | 320 | if (thread.GetStatus() == Kernel::ThreadStatus::WaitSynch) { |
| 317 | list.push_back(std::make_unique<WaitTreeObjectList>(thread.GetWaitObjects(), | 321 | list.push_back(std::make_unique<WaitTreeObjectList>(thread.GetSynchronizationObjects(), |
| 318 | thread.IsSleepingOnWait())); | 322 | thread.IsSleepingOnWait())); |
| 319 | } | 323 | } |
| 320 | 324 | ||
| @@ -323,7 +327,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const { | |||
| 323 | return list; | 327 | return list; |
| 324 | } | 328 | } |
| 325 | 329 | ||
| 326 | WaitTreeEvent::WaitTreeEvent(const Kernel::ReadableEvent& object) : WaitTreeWaitObject(object) {} | 330 | WaitTreeEvent::WaitTreeEvent(const Kernel::ReadableEvent& object) |
| 331 | : WaitTreeSynchronizationObject(object) {} | ||
| 327 | WaitTreeEvent::~WaitTreeEvent() = default; | 332 | WaitTreeEvent::~WaitTreeEvent() = default; |
| 328 | 333 | ||
| 329 | WaitTreeThreadList::WaitTreeThreadList(const std::vector<std::shared_ptr<Kernel::Thread>>& list) | 334 | WaitTreeThreadList::WaitTreeThreadList(const std::vector<std::shared_ptr<Kernel::Thread>>& list) |
diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h index 631274a5f..8e3bc4b24 100644 --- a/src/yuzu/debugger/wait_tree.h +++ b/src/yuzu/debugger/wait_tree.h | |||
| @@ -19,7 +19,7 @@ class EmuThread; | |||
| 19 | namespace Kernel { | 19 | namespace Kernel { |
| 20 | class HandleTable; | 20 | class HandleTable; |
| 21 | class ReadableEvent; | 21 | class ReadableEvent; |
| 22 | class WaitObject; | 22 | class SynchronizationObject; |
| 23 | class Thread; | 23 | class Thread; |
| 24 | } // namespace Kernel | 24 | } // namespace Kernel |
| 25 | 25 | ||
| @@ -99,35 +99,37 @@ private: | |||
| 99 | const Kernel::Thread& thread; | 99 | const Kernel::Thread& thread; |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | class WaitTreeWaitObject : public WaitTreeExpandableItem { | 102 | class WaitTreeSynchronizationObject : public WaitTreeExpandableItem { |
| 103 | Q_OBJECT | 103 | Q_OBJECT |
| 104 | public: | 104 | public: |
| 105 | explicit WaitTreeWaitObject(const Kernel::WaitObject& object); | 105 | explicit WaitTreeSynchronizationObject(const Kernel::SynchronizationObject& object); |
| 106 | ~WaitTreeWaitObject() override; | 106 | ~WaitTreeSynchronizationObject() override; |
| 107 | 107 | ||
| 108 | static std::unique_ptr<WaitTreeWaitObject> make(const Kernel::WaitObject& object); | 108 | static std::unique_ptr<WaitTreeSynchronizationObject> make( |
| 109 | const Kernel::SynchronizationObject& object); | ||
| 109 | QString GetText() const override; | 110 | QString GetText() const override; |
| 110 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; | 111 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; |
| 111 | 112 | ||
| 112 | protected: | 113 | protected: |
| 113 | const Kernel::WaitObject& object; | 114 | const Kernel::SynchronizationObject& object; |
| 114 | }; | 115 | }; |
| 115 | 116 | ||
| 116 | class WaitTreeObjectList : public WaitTreeExpandableItem { | 117 | class WaitTreeObjectList : public WaitTreeExpandableItem { |
| 117 | Q_OBJECT | 118 | Q_OBJECT |
| 118 | public: | 119 | public: |
| 119 | WaitTreeObjectList(const std::vector<std::shared_ptr<Kernel::WaitObject>>& list, bool wait_all); | 120 | WaitTreeObjectList(const std::vector<std::shared_ptr<Kernel::SynchronizationObject>>& list, |
| 121 | bool wait_all); | ||
| 120 | ~WaitTreeObjectList() override; | 122 | ~WaitTreeObjectList() override; |
| 121 | 123 | ||
| 122 | QString GetText() const override; | 124 | QString GetText() const override; |
| 123 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; | 125 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; |
| 124 | 126 | ||
| 125 | private: | 127 | private: |
| 126 | const std::vector<std::shared_ptr<Kernel::WaitObject>>& object_list; | 128 | const std::vector<std::shared_ptr<Kernel::SynchronizationObject>>& object_list; |
| 127 | bool wait_all; | 129 | bool wait_all; |
| 128 | }; | 130 | }; |
| 129 | 131 | ||
| 130 | class WaitTreeThread : public WaitTreeWaitObject { | 132 | class WaitTreeThread : public WaitTreeSynchronizationObject { |
| 131 | Q_OBJECT | 133 | Q_OBJECT |
| 132 | public: | 134 | public: |
| 133 | explicit WaitTreeThread(const Kernel::Thread& thread); | 135 | explicit WaitTreeThread(const Kernel::Thread& thread); |
| @@ -138,7 +140,7 @@ public: | |||
| 138 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; | 140 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; |
| 139 | }; | 141 | }; |
| 140 | 142 | ||
| 141 | class WaitTreeEvent : public WaitTreeWaitObject { | 143 | class WaitTreeEvent : public WaitTreeSynchronizationObject { |
| 142 | Q_OBJECT | 144 | Q_OBJECT |
| 143 | public: | 145 | public: |
| 144 | explicit WaitTreeEvent(const Kernel::ReadableEvent& object); | 146 | explicit WaitTreeEvent(const Kernel::ReadableEvent& object); |