Add an PanicAlert in case we try to do an >32 bit displacement

If you see this alert, dolphin will probably crash in a few moments.

Found in the course of fiddling with DSPLLEs JIT, which puts its data
structures and static code somewhere above 0x7fff00000000 on my machine, making
it unreachable via 32bit displacements from the created code at ~ 0x40000000.

Fixed all the offending places in DSPLLEs JIT to emit register indirect accesses,
only to find out that the generated code is slower than the interpreter and does
work just as good(or bad). Oh well, back to DSPHLE it is then.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6229 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
pierre 2010-09-26 19:37:30 +00:00
parent 2f44464eef
commit bc1e0c24e8
1 changed files with 6 additions and 1 deletions

View File

@ -168,7 +168,12 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg) const
//TODO : add some checks
#ifdef _M_X64
u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes;
s32 offs = (s32)((s64)offset - (s64)ripAddr);
s64 distance = (s64)offset - (s64)ripAddr;
if (distance >= 0x0000000080000000LL
|| distance < -0x0000000080000000LL) {
PanicAlert("WriteRest: op out of range (%p uses %p)", ripAddr, offset);
}
s32 offs = (s32)distance;
emit->Write32((u32)offs);
#else
emit->Write32((u32)offset);