aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcomex2016-11-15 20:44:41 -0500
committerGitHub2016-11-15 20:44:41 -0500
commitf04e014accf41dad3698f7b7e6df6111a18cc399 (patch)
tree0b3496ae2d761002e891ab983bc80b3da18f62c6
parentmake ln command more robust (diff)
parentFixed extraction for BL/BLX thumb2 (diff)
downloadsubstitute-f04e014accf41dad3698f7b7e6df6111a18cc399.tar.gz
Merge pull request #16 from yifanlu/fix-t2-bl
Fix bad handling of thumb2 BL/BLX
-rw-r--r--lib/arm/dis-thumb2.inc.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/arm/dis-thumb2.inc.h b/lib/arm/dis-thumb2.inc.h
index b8082f3..4203c01 100644
--- a/lib/arm/dis-thumb2.inc.h
+++ b/lib/arm/dis-thumb2.inc.h
@@ -171,19 +171,19 @@ static INLINE void P(unk_Rt_13_VMOVRRD)(tdis_ctx ctx, UNUSED struct bitslice Rt)
return P(unidentified)(ctx);
}
static INLINE void P(t_bltarget_func_1_tBL)(tdis_ctx ctx, struct bitslice func) {
- unsigned crap = bs_get(func, ctx->base.op) << 1;
+ unsigned crap = bs_get(func, ctx->base.op) << 1; // first bit zero
unsigned S = crap >> 24 & 1;
- if (S)
+ if (!S)
crap ^= (3 << 22);
- return P(branch)(ctx, ctx->base.pc + 4 + 2 * sext(crap, 25), CC_CALL);
+ return P(branch)(ctx, ctx->base.pc + 4 + sext(crap, 25), CC_CALL);
}
static INLINE void P(t_blxtarget_func_1_tBLXi)(tdis_ctx ctx, struct bitslice func) {
- unsigned crap = bs_get(func, ctx->base.op);
+ unsigned crap = bs_get(func, ctx->base.op) << 1; // first two bits zero
unsigned S = crap >> 24 & 1;
- if (S)
+ if (!S)
crap ^= (3 << 22);
- return P(branch)(ctx, ctx->base.pc + 4 + 2 * sext(crap, 25), CC_CALL);
+ return P(branch)(ctx, ctx->base.pc + 4 + sext(crap, 25), CC_CALL);
}
static INLINE void P(rGPR_func_1_t2BXJ)(tdis_ctx ctx, UNUSED struct bitslice func) {
return P(unidentified)(ctx);