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
This commit is contained in:
j4ck.fr0st
2010-06-30 16:17:20 +00:00
parent 599a4c974d
commit 89c4068663
4 changed files with 109 additions and 109 deletions

View File

@ -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)
{