SPU fixes, various fixes

This commit is contained in:
Nekotekina 2015-07-03 19:07:36 +03:00
parent 721ad404d2
commit 8f9e1100c8
33 changed files with 1021 additions and 871 deletions

View file

@ -168,14 +168,28 @@ void CPUThread::Step()
void CPUThread::Sleep()
{
m_state ^= CPU_STATE_SLEEP;
m_state += CPU_STATE_MAX;
m_state |= CPU_STATE_SLEEP;
cv.notify_one();
}
void CPUThread::Awake()
{
m_state ^= CPU_STATE_SLEEP;
// must be called after the corresponding Sleep() call
m_state.atomic_op([](u64& state)
{
if (state < CPU_STATE_MAX)
{
throw EXCEPTION("Sleep()/Awake() inconsistency");
}
if ((state -= CPU_STATE_MAX) < CPU_STATE_MAX)
{
state &= ~CPU_STATE_SLEEP;
}
});
cv.notify_one();
}