Implement backpatch support for 16 bit loads

This commit is contained in:
Pierre Bourdon 2013-01-19 05:09:00 +01:00
parent 621204f3e8
commit c553c42d63
2 changed files with 9 additions and 5 deletions

View File

@ -90,6 +90,10 @@ const u8 *TrampolineCache::GetReadTrampoline(const InstructionInfo &info)
case 4:
CALL(thunks.ProtectFunction((void *)&Memory::Read_U32, 1));
break;
case 2:
CALL(thunks.ProtectFunction((void *)&Memory::Read_U16, 1));
SHL(32, R(EAX), Imm8(16));
break;
}
ABI_PopAllCallerSavedRegsAndAdjustStack();
if (dataReg != EAX) {
@ -176,7 +180,7 @@ const u8 *JitBase::BackPatch(u8 *codePtr, int accessType, u32 emAddress, void *c
codePtr, emAddress);
}*/
if (info.operandSize != 4) {
if (info.operandSize == 1) {
BackPatchError(StringFromFormat("BackPatch - no support for operand size %i", info.operandSize), codePtr, emAddress);
}
@ -188,7 +192,6 @@ const u8 *JitBase::BackPatch(u8 *codePtr, int accessType, u32 emAddress, void *c
PanicAlert("BackPatch : Currently only supporting reads."
"\n\nAttempted to write to %08x.", emAddress);
// In the first iteration, we assume that all accesses are 32-bit. We also only deal with reads.
if (accessType == 0)
{
XEmitter emitter(codePtr);

View File

@ -120,12 +120,13 @@ void EmuCodeBlock::SafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, s
{
#if defined(_M_X64)
#ifdef ENABLE_MEM_CHECK
if (accessSize == 32 && !Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging)
if (accessSize != 8 && !Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging)
#else
if (accessSize == 32 && !Core::g_CoreStartupParameter.bMMU)
if (accessSize != 8 && !Core::g_CoreStartupParameter.bMMU)
#endif
{
// BackPatch only supports 32-bits accesses
// We don't support 8 bit loads backpatching at the moment, but they
// are very rare.
UnsafeLoadToEAX(opAddress, accessSize, offset, signExtend);
}
else