diff options
author | comex | 2015-01-11 00:24:55 -0500 |
---|---|---|
committer | comex | 2015-01-11 00:24:55 -0500 |
commit | 0f3430e0035eb4733bb0149f610d59467f5eda82 (patch) | |
tree | 048da495c1b0a41cc4997f2d0490242e7c75b2bd /lib/dis-thumb.inc.h | |
parent | add gitignore (diff) | |
download | substitute-0f3430e0035eb4733bb0149f610d59467f5eda82.tar.gz |
*sigh*
Diffstat (limited to '')
-rw-r--r-- | lib/dis-thumb.inc.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/dis-thumb.inc.h b/lib/dis-thumb.inc.h new file mode 100644 index 0000000..dd38147 --- /dev/null +++ b/lib/dis-thumb.inc.h @@ -0,0 +1,28 @@ +static inline tdis_ret transform_dis_thumb_GPR_Rm_3_tADDhirr(tdis_ctx ctx, struct bitslice Rm) { + return P(regs)(ctx, Rm, 0, 3, Rm, 0, 0); +} +static inline tdis_ret transform_dis_thumb_GPR_Rm_B_1_tBX(tdis_ctx ctx, struct bitslice Rm) { + if(bs_get(Rm, ctx->op) == 15) // bx pc? + return P(bad)(ctx); + return P(unidentified)(ctx); +} +static inline tdis_ret transform_dis_thumb_t_addrmode_pc_addr_unk_Rt_1_tLDRpci(tdis_ctx ctx, struct bitslice addr, struct bitslice Rt) { + return P(adr)(ctx, ((ctx->pc + 4) & ~2) + bs_get(addr, ctx->op)); +} +static inline tdis_ret transform_dis_thumb_t_adrlabel_addr_1_tADR(tdis_ctx ctx, struct bitslice addr) { + return P(adr)(ctx, ((ctx->pc + 4) & ~2) + bs_get(addr, ctx->op)); +} +static inline tdis_ret transform_dis_thumb_t_brtarget_target_B_1_tB(tdis_ctx ctx, struct bitslice target) { + return P(branch)(ctx->pc + 2 + sext(bs_get(target, ctx->op), 11); +} +static inline tdis_ret transform_dis_thumb_t_bcctarget_target_B_1_tBcc(tdis_ctx ctx, struct bitslice target) { + return P(branch)(ctx->pc + 2 + sext(bs_get(target, ctx->op), 8); +} +static inline tdis_ret transform_dis_thumb_t_cbtarget_target_B_2_tCBNZ(tdis_ctx ctx, struct bitslice target) { + return P(branch)(ctx->pc + 2 + bs_get(target, ctx->op); +} + +static inline tdis_ret P(dis_thumb)(tdis_ctx ctx) { + unsigned op = ctx->op; + #include "../generated/transform-dis-thumb.inc" +} |