Core/Common: Allow LEA(32,...) with M() OpArgs exceeding the 2G range.

Fixes JitIL in debug builds.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7478 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
pierre 2011-04-22 15:51:40 +00:00
parent f777aca3a6
commit 35026f9de1
2 changed files with 7 additions and 5 deletions

View File

@ -167,7 +167,8 @@ void OpArg::WriteRex(XEmitter *emit, int opBits, int bits, int customOp) const
#endif
}
void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg) const
void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg,
bool warn_64bit_offset) const
{
if (_operandReg == 0xff)
_operandReg = (X64Reg)this->operandReg;
@ -185,8 +186,9 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg) const
#ifdef _M_X64
u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes;
s64 distance = (s64)offset - (s64)ripAddr;
_assert_msg_(DYNA_REC, distance < 0x80000000LL
&& distance >= -0x80000000LL,
_assert_msg_(DYNA_REC, (distance < 0x80000000LL
&& distance >= -0x80000000LL) ||
!warn_64bit_offset,
"WriteRest: op out of range (0x%llx uses 0x%llx)",
ripAddr, offset);
s32 offs = (s32)distance;
@ -772,7 +774,7 @@ void XEmitter::LEA(int bits, X64Reg dest, OpArg src)
if (bits == 16) Write8(0x66); //TODO: performance warning
src.WriteRex(this, bits, bits);
Write8(0x8D);
src.WriteRest(this);
src.WriteRest(this, 0, (X64Reg)0xFF, bits == 64);
}
//shift can be either imm8 or cl

View File

@ -120,7 +120,7 @@ struct OpArg
offset = _offset;
}
void WriteRex(XEmitter *emit, int opBits, int bits, int customOp = -1) const;
void WriteRest(XEmitter *emit, int extraBytes=0, X64Reg operandReg=(X64Reg)0xFF) const;
void WriteRest(XEmitter *emit, int extraBytes=0, X64Reg operandReg=(X64Reg)0xFF, bool warn_64bit_offset = true) const;
void WriteSingleByteOp(XEmitter *emit, u8 op, X64Reg operandReg, int bits);
// This one is public - must be written to
u64 offset; // use RIP-relative as much as possible - 64-bit immediates are not available.