Skip to content

Commit

Permalink
Jit64: Invalidate cached constant values w/o host register on flush
Browse files Browse the repository at this point in the history
If we don't flush the values, they persist in the register cache,
potentially resulting in the values being out of sync with PPCSTATE.

This was causing random crashes in games, mainly booting, when certain
JIT instructions were disabled, or forced to fall back to interpreter.
  • Loading branch information
stenzek committed May 12, 2018
1 parent 22ceecc commit a446b09
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp
Expand Up @@ -101,6 +101,13 @@ void RegCache::Flush(FlushMode mode, BitSet32 regsToFlush)
ASSERT_MSG(DYNA_REC, 0, "Jit64 - Flush unhandled case, reg %u PC: %08x", i, PC);
}
}
else if (m_regs[i].location.IsImm())
{
// We can have a cached value without a host register through speculative constants.
// It must be cleared when flushing, otherwise it may be out of sync with PPCSTATE,
// if PPCSTATE is modified externally (e.g. fallback to interpreter).
m_regs[i].location = GetDefaultLocation(i);
}
}
}

Expand Down

0 comments on commit a446b09

Please sign in to comment.