diff options
| author | j4ck.fr0st <j4ck.fr0st@gmail.com> | 2010-06-30 16:17:20 +0000 |
|---|---|---|
| committer | j4ck.fr0st <j4ck.fr0st@gmail.com> | 2010-06-30 16:17:20 +0000 |
| commit | 89c4068663ca961cd9cec40c94eac4bf0f2d6583 (patch) | |
| tree | 8d90ce8b6ca6afe0548012389bcffc8963c46240 /Source/Core/Common | |
| parent | 599a4c974d949ef5fc587f3084f5c88ac23539e5 (diff) | |
Fix a bug in DSP Jit where branches had a blockSize of zero.
Add some useful checking to J_CC/SetJumpTarget.
Refactor increment/decrement and reuse code with increase/decrease.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5816 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Src/x64Emitter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/x64Emitter.cpp b/Source/Core/Common/Src/x64Emitter.cpp index 996d51ae74..a916de02c7 100644 --- a/Source/Core/Common/Src/x64Emitter.cpp +++ b/Source/Core/Common/Src/x64Emitter.cpp @@ -389,7 +389,8 @@ void XEmitter::J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes) u64 fn = (u64)addr; if (!force5Bytes) { - s32 distance = (s32)(fn - ((u64)code + 2)); //TODO - sanity check + s32 distance = (s32)(fn - ((u64)code + 2)); + _assert_msg_(DYNA_REC, distance < 0x80, "Jump target too far away, needs force5Bytes = true"); //8 bits will do Write8(0x70 + conditionCode); Write8((u8)(s8)distance); @@ -407,7 +408,9 @@ void XEmitter::SetJumpTarget(const FixupBranch &branch) { if (branch.type == 0) { - branch.ptr[-1] = (u8)(s8)(code - branch.ptr); + s32 distance = (s32)(code - branch.ptr); + _assert_msg_(DYNA_REC, distance < 0x80, "Jump target too far away, needs force5Bytes = true"); + branch.ptr[-1] = (u8)(s8)distance; } else if (branch.type == 1) { |
