mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 01:02:48 +01:00
thread: Add THREADSTATUS_WAIT_HLE_EVENT, remove THREADSTATUS_WAIT_ARB.
This commit is contained in:
parent
6317a0b2ca
commit
e353b9fb3d
4 changed files with 9 additions and 23 deletions
|
@ -55,16 +55,6 @@ inline static u32 const NewThreadId() {
|
||||||
Thread::Thread() {}
|
Thread::Thread() {}
|
||||||
Thread::~Thread() {}
|
Thread::~Thread() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the specified thread is waiting on the specified address to be arbitrated
|
|
||||||
* @param thread The thread to test
|
|
||||||
* @param wait_address The address to test against
|
|
||||||
* @return True if the thread is waiting, false otherwise
|
|
||||||
*/
|
|
||||||
static bool CheckWait_AddressArbiter(const Thread* thread, VAddr wait_address) {
|
|
||||||
return thread->status == THREADSTATUS_WAIT_ARB && wait_address == thread->wait_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Thread::Stop() {
|
void Thread::Stop() {
|
||||||
// Cancel any outstanding wakeup events for this thread
|
// Cancel any outstanding wakeup events for this thread
|
||||||
CoreTiming::UnscheduleEvent(ThreadWakeupEventType, callback_handle);
|
CoreTiming::UnscheduleEvent(ThreadWakeupEventType, callback_handle);
|
||||||
|
@ -102,12 +92,6 @@ void WaitCurrentThread_Sleep() {
|
||||||
thread->status = THREADSTATUS_WAIT_SLEEP;
|
thread->status = THREADSTATUS_WAIT_SLEEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaitCurrentThread_ArbitrateAddress(VAddr wait_address) {
|
|
||||||
Thread* thread = GetCurrentThread();
|
|
||||||
thread->wait_address = wait_address;
|
|
||||||
thread->status = THREADSTATUS_WAIT_ARB;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExitCurrentThread() {
|
void ExitCurrentThread() {
|
||||||
Thread* thread = GetCurrentThread();
|
Thread* thread = GetCurrentThread();
|
||||||
thread->Stop();
|
thread->Stop();
|
||||||
|
@ -129,7 +113,8 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) {
|
||||||
bool resume = true;
|
bool resume = true;
|
||||||
|
|
||||||
if (thread->status == THREADSTATUS_WAIT_SYNCH_ANY ||
|
if (thread->status == THREADSTATUS_WAIT_SYNCH_ANY ||
|
||||||
thread->status == THREADSTATUS_WAIT_SYNCH_ALL || thread->status == THREADSTATUS_WAIT_ARB) {
|
thread->status == THREADSTATUS_WAIT_SYNCH_ALL ||
|
||||||
|
thread->status == THREADSTATUS_WAIT_HLE_EVENT) {
|
||||||
|
|
||||||
// Remove the thread from each of its waiting objects' waitlists
|
// Remove the thread from each of its waiting objects' waitlists
|
||||||
for (auto& object : thread->wait_objects)
|
for (auto& object : thread->wait_objects)
|
||||||
|
@ -163,7 +148,7 @@ void Thread::ResumeFromWait() {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case THREADSTATUS_WAIT_SYNCH_ALL:
|
case THREADSTATUS_WAIT_SYNCH_ALL:
|
||||||
case THREADSTATUS_WAIT_SYNCH_ANY:
|
case THREADSTATUS_WAIT_SYNCH_ANY:
|
||||||
case THREADSTATUS_WAIT_ARB:
|
case THREADSTATUS_WAIT_HLE_EVENT:
|
||||||
case THREADSTATUS_WAIT_SLEEP:
|
case THREADSTATUS_WAIT_SLEEP:
|
||||||
case THREADSTATUS_WAIT_IPC:
|
case THREADSTATUS_WAIT_IPC:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -38,7 +38,7 @@ enum ThreadProcessorId : s32 {
|
||||||
enum ThreadStatus {
|
enum ThreadStatus {
|
||||||
THREADSTATUS_RUNNING, ///< Currently running
|
THREADSTATUS_RUNNING, ///< Currently running
|
||||||
THREADSTATUS_READY, ///< Ready to run
|
THREADSTATUS_READY, ///< Ready to run
|
||||||
THREADSTATUS_WAIT_ARB, ///< Waiting on an address arbiter
|
THREADSTATUS_WAIT_HLE_EVENT, ///< Waiting for hle event to finish
|
||||||
THREADSTATUS_WAIT_SLEEP, ///< Waiting due to a SleepThread SVC
|
THREADSTATUS_WAIT_SLEEP, ///< Waiting due to a SleepThread SVC
|
||||||
THREADSTATUS_WAIT_IPC, ///< Waiting for the reply from an IPC request
|
THREADSTATUS_WAIT_IPC, ///< Waiting for the reply from an IPC request
|
||||||
THREADSTATUS_WAIT_SYNCH_ANY, ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false
|
THREADSTATUS_WAIT_SYNCH_ANY, ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false
|
||||||
|
|
|
@ -39,7 +39,8 @@ SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() {
|
||||||
for (const auto& thread : waiting_threads) {
|
for (const auto& thread : waiting_threads) {
|
||||||
// The list of waiting threads must not contain threads that are not waiting to be awakened.
|
// The list of waiting threads must not contain threads that are not waiting to be awakened.
|
||||||
ASSERT_MSG(thread->status == THREADSTATUS_WAIT_SYNCH_ANY ||
|
ASSERT_MSG(thread->status == THREADSTATUS_WAIT_SYNCH_ANY ||
|
||||||
thread->status == THREADSTATUS_WAIT_SYNCH_ALL,
|
thread->status == THREADSTATUS_WAIT_SYNCH_ALL ||
|
||||||
|
thread->status == THREADSTATUS_WAIT_HLE_EVENT,
|
||||||
"Inconsistent thread statuses in waiting_threads");
|
"Inconsistent thread statuses in waiting_threads");
|
||||||
|
|
||||||
if (thread->current_priority >= candidate_priority)
|
if (thread->current_priority >= candidate_priority)
|
||||||
|
|
|
@ -150,8 +150,8 @@ QString WaitTreeThread::GetText() const {
|
||||||
case THREADSTATUS_READY:
|
case THREADSTATUS_READY:
|
||||||
status = tr("ready");
|
status = tr("ready");
|
||||||
break;
|
break;
|
||||||
case THREADSTATUS_WAIT_ARB:
|
case THREADSTATUS_WAIT_HLE_EVENT:
|
||||||
status = tr("waiting for address 0x%1").arg(thread.wait_address, 8, 16, QLatin1Char('0'));
|
status = tr("waiting for HLE return");
|
||||||
break;
|
break;
|
||||||
case THREADSTATUS_WAIT_SLEEP:
|
case THREADSTATUS_WAIT_SLEEP:
|
||||||
status = tr("sleeping");
|
status = tr("sleeping");
|
||||||
|
@ -180,7 +180,7 @@ QColor WaitTreeThread::GetColor() const {
|
||||||
return QColor(Qt::GlobalColor::darkGreen);
|
return QColor(Qt::GlobalColor::darkGreen);
|
||||||
case THREADSTATUS_READY:
|
case THREADSTATUS_READY:
|
||||||
return QColor(Qt::GlobalColor::darkBlue);
|
return QColor(Qt::GlobalColor::darkBlue);
|
||||||
case THREADSTATUS_WAIT_ARB:
|
case THREADSTATUS_WAIT_HLE_EVENT:
|
||||||
return QColor(Qt::GlobalColor::darkRed);
|
return QColor(Qt::GlobalColor::darkRed);
|
||||||
case THREADSTATUS_WAIT_SLEEP:
|
case THREADSTATUS_WAIT_SLEEP:
|
||||||
return QColor(Qt::GlobalColor::darkYellow);
|
return QColor(Qt::GlobalColor::darkYellow);
|
||||||
|
|
Loading…
Reference in a new issue