mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 03:35:26 +00:00
Fixed a nasty bug in the JIT. This should fix some JIT (and JITIL) crashes.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4373 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
16c6ec6e7e
commit
b920ade474
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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]; }
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user