diff --git a/Source/Core/Core/Src/HW/Memmap.h b/Source/Core/Core/Src/HW/Memmap.h index 720e39359b..703fd6c399 100644 --- a/Source/Core/Core/Src/HW/Memmap.h +++ b/Source/Core/Core/Src/HW/Memmap.h @@ -128,6 +128,10 @@ namespace Memory u32 Read_U32(const u32 _Address); u64 Read_U64(const u32 _Address); + // used by JIT. Return zero-extended 32bit values + u32 Read_U8_ZX(const u32 _Address); + u32 Read_U16_ZX(const u32 _Address); + void Write_U8(const u8 _Data, const u32 _Address); void Write_U16(const u16 _Data, const u32 _Address); void Write_U32(const u32 _Data, const u32 _Address); diff --git a/Source/Core/Core/Src/HW/MemmapFunctions.cpp b/Source/Core/Core/Src/HW/MemmapFunctions.cpp index ccbcc3bdcf..b21a81fc94 100644 --- a/Source/Core/Core/Src/HW/MemmapFunctions.cpp +++ b/Source/Core/Core/Src/HW/MemmapFunctions.cpp @@ -368,6 +368,15 @@ u64 Read_U64(const u32 _Address) return _var; } +u32 Read_U8_ZX(const u32 _Address) +{ + return (u32)Read_U8(_Address); +} + +u32 Read_U16_ZX(const u32 _Address) +{ + return (u32)Read_U16(_Address); +} void Write_U8(const u8 _Data, const u32 _Address) { diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h index ff1468883e..f2f77263af 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR.h @@ -167,7 +167,10 @@ enum Opcode { // reference directly; this is a size optimization Tramp, // "Opcode"s representing the start and end - BlockStart, BlockEnd + BlockStart, BlockEnd, + + // used for debugging + Int3 }; typedef unsigned Inst; @@ -505,6 +508,10 @@ public: InstLoc EmitStoreSRR(InstLoc op1, unsigned srr) { return FoldUOp(StoreSRR, op1, srr); } + InstLoc EmitINT3() + { + return FoldZeroOp(Int3, 0); + } void StartBackPass() { curReadPtr = &InstList[InstList.size()]; } void StartForwardPass() { curReadPtr = &InstList[0]; } diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp index d045da4cd9..0cefd13e34 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/IR_X86.cpp @@ -470,8 +470,8 @@ static void regEmitMemLoad(RegInfo& RI, InstLoc I, unsigned Size) { switch (Size) { case 32: RI.Jit->ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U32, 1), ECX); break; - case 16: RI.Jit->ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U16, 1), ECX); break; - case 8: RI.Jit->ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U8, 1), ECX); break; + case 16: RI.Jit->ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U16_ZX, 1), ECX); break; + case 8: RI.Jit->ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U8_ZX, 1), ECX); break; } if (reg != EAX) { RI.Jit->MOV(32, R(reg), R(EAX)); @@ -665,7 +665,8 @@ static void DoWriteCode(IRBuilder* ibuild, Jit64* Jit, bool UseProfile, bool Mak case SystemCall: case RFIExit: case InterpreterBranch: - case ShortIdleLoop: + case ShortIdleLoop: + case Int3: case Tramp: // No liveness effects break; @@ -1590,6 +1591,10 @@ static void DoWriteCode(IRBuilder* ibuild, Jit64* Jit, bool UseProfile, bool Mak Jit->WriteRfiExitDestInEAX(); break; } + case Int3: { + Jit->INT3(); + break; + } case Tramp: break; case Nop: break; default: diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp index 3eadc2a34e..f05b404448 100644 --- a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp +++ b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp @@ -85,8 +85,8 @@ void Jit64::SafeLoadRegToEAX(X64Reg reg, int accessSize, s32 offset, bool signEx switch (accessSize) { case 32: ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U32, 1), reg); break; - case 16: ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U16, 1), reg); break; - case 8: ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U8, 1), reg); break; + case 16: ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U16_ZX, 1), reg); break; + case 8: ABI_CallFunctionR(thunks.ProtectFunction((void *)&Memory::Read_U8_ZX, 1), reg); break; } if (signExtend && accessSize < 32) { // Need to sign extend values coming from the Read_U* functions.