mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
Fixed CALL range check.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@364 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
9b1ddfcc69
commit
ad748bfc05
@ -307,21 +307,15 @@ namespace Gen
|
||||
arg.WriteRest();
|
||||
}
|
||||
|
||||
inline s64 myabs(s64 a) {
|
||||
if (a < 0) return -a;
|
||||
return a;
|
||||
}
|
||||
|
||||
void CALL(void *fnptr)
|
||||
{
|
||||
s64 fn = (s64)fnptr;
|
||||
s64 c = (s64)code;
|
||||
if (myabs(fn - c) >= 0x80000000ULL) {
|
||||
PanicAlert("CALL out of range (%p calls %p)", c, fn);
|
||||
u64 distance = u64(fnptr) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
PanicAlert("CALL out of range (%p calls %p)", code, fnptr);
|
||||
}
|
||||
s32 distance = (s32)(fn - ((u64)code + 5));
|
||||
Write8(0xE8);
|
||||
Write32(distance);
|
||||
Write8(0xE8);
|
||||
Write32(u32(distance));
|
||||
}
|
||||
|
||||
void x86SetJ8(u8 *j8)
|
||||
|
Loading…
x
Reference in New Issue
Block a user