mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 638627 - Properly handle failures to patch guards due to non-32-bit offsets (NJ-specific part). r=dvander.
--HG-- extra : convert_revision : b3948560bcbc91ed1e7416d2f9ad495e1c8daca1
This commit is contained in:
parent
a372a8f059
commit
ec0be2faaa
@ -221,10 +221,8 @@ namespace nanojit
|
|||||||
// but from the following instruction. Eg. 'jmp $0' will jump to the
|
// but from the following instruction. Eg. 'jmp $0' will jump to the
|
||||||
// next instruction.
|
// next instruction.
|
||||||
int64_t offset = target ? target - _nIns : 0;
|
int64_t offset = target ? target - _nIns : 0;
|
||||||
if (!isS32(offset)) {
|
if (!isS32(offset))
|
||||||
setError(BranchTooFar);
|
setError(BranchTooFar);
|
||||||
NanoAssert(0); // assert because we'd like to know if this ever happens
|
|
||||||
}
|
|
||||||
emit(op | uint64_t(uint32_t(offset))<<32);
|
emit(op | uint64_t(uint32_t(offset))<<32);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2014,7 +2012,7 @@ namespace nanojit
|
|||||||
// that the old value is poison.
|
// that the old value is poison.
|
||||||
if (!isS32(target - next)) {
|
if (!isS32(target - next)) {
|
||||||
setError(BranchTooFar);
|
setError(BranchTooFar);
|
||||||
NanoAssert(0); // assert because we'd like to know if this ever happens
|
return; // don't patch
|
||||||
}
|
}
|
||||||
((int32_t*)next)[-1] = int32_t(target - next);
|
((int32_t*)next)[-1] = int32_t(target - next);
|
||||||
if (next[0] == 0x0F && next[1] == 0x8A) {
|
if (next[0] == 0x0F && next[1] == 0x8A) {
|
||||||
@ -2022,7 +2020,10 @@ namespace nanojit
|
|||||||
// we just patched the jne, now patch the jp.
|
// we just patched the jne, now patch the jp.
|
||||||
next += 6;
|
next += 6;
|
||||||
NanoAssert(((int32_t*)next)[-1] == 0);
|
NanoAssert(((int32_t*)next)[-1] == 0);
|
||||||
NanoAssert(isS32(target - next));
|
if (!isS32(target - next)) {
|
||||||
|
setError(BranchTooFar);
|
||||||
|
return; // don't patch
|
||||||
|
}
|
||||||
((int32_t*)next)[-1] = int32_t(target - next);
|
((int32_t*)next)[-1] = int32_t(target - next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user