Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement 8 bit loads backpatching
  • Loading branch information
delroth committed Jan 19, 2013
1 parent c553c42 commit 905d388
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 3 additions & 4 deletions Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp
Expand Up @@ -94,6 +94,9 @@ const u8 *TrampolineCache::GetReadTrampoline(const InstructionInfo &info)
CALL(thunks.ProtectFunction((void *)&Memory::Read_U16, 1));
SHL(32, R(EAX), Imm8(16));
break;
case 1:
CALL(thunks.ProtectFunction((void *)&Memory::Read_U8, 1));
break;
}
ABI_PopAllCallerSavedRegsAndAdjustStack();
if (dataReg != EAX) {
Expand Down Expand Up @@ -180,10 +183,6 @@ const u8 *JitBase::BackPatch(u8 *codePtr, int accessType, u32 emAddress, void *c
codePtr, emAddress);
}*/

if (info.operandSize == 1) {
BackPatchError(StringFromFormat("BackPatch - no support for operand size %i", info.operandSize), codePtr, emAddress);
}

if (info.otherReg != RBX)
PanicAlert("BackPatch : Base reg not RBX."
"\n\nAttempted to access %08x.", emAddress);
Expand Down
12 changes: 7 additions & 5 deletions Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp
Expand Up @@ -96,7 +96,11 @@ void EmuCodeBlock::UnsafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize,
MOVZX(32, accessSize, EAX, MDisp(EAX, (u32)Memory::base + offset));
}
#endif


// Add a 2 bytes NOP to have some space for the backpatching
if (accessSize == 8)
NOP(2);

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

0 comments on commit 905d388

Please sign in to comment.