Add check to make sure we don't go below the thread's stack base.

This commit is contained in:
Jean-Philip Desjardins 2016-10-26 21:01:02 -04:00
parent 9e595a1867
commit 10c29ecaa9

View File

@ -1108,6 +1108,7 @@ void CPS2OS::ThreadSwitchContext(unsigned int id)
auto thread = m_threads[m_currentThreadId];
assert(thread);
thread->contextPtr = m_ee.m_State.nGPR[CMIPS::SP].nV0 - STACKRES;
assert(thread->contextPtr >= thread->stackBase);
auto context = reinterpret_cast<THREADCONTEXT*>(GetStructPtr(thread->contextPtr));