From 9fbf8080fb308d9c6dad8c534ad8892c2d715087 Mon Sep 17 00:00:00 2001 From: comex Date: Wed, 21 Jan 2015 17:02:52 -0500 Subject: minor cleanup - stop caring about thumb outside of arch-specific code (and fix makefile bug where files whose names contained 'arm' would always be ldid'd) --- lib/arm/dis-arm-multi.inc.h | 2 +- lib/arm/misc.h | 5 ++++- lib/arm/transform-dis-arm-multi.inc.h | 14 +++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'lib/arm') diff --git a/lib/arm/dis-arm-multi.inc.h b/lib/arm/dis-arm-multi.inc.h index 56cde35..bf2767e 100644 --- a/lib/arm/dis-arm-multi.inc.h +++ b/lib/arm/dis-arm-multi.inc.h @@ -3,7 +3,7 @@ #include "dis-arm.inc.h" static INLINE void P(dis)(tdis_ctx ctx) { - if (ctx->pc_low_bit) { + if (ctx->arch.pc_low_bit) { uint16_t op = *(uint16_t *) ctx->ptr; bool is_32 = (op >> 13 & 7) == 7 && (op >> 11 & 3) != 0; if (is_32) diff --git a/lib/arm/misc.h b/lib/arm/misc.h index 44d8e7a..047be2d 100644 --- a/lib/arm/misc.h +++ b/lib/arm/misc.h @@ -3,5 +3,8 @@ #define TARGET_DIS_HEADER "arm/dis-arm-multi.inc.h" #define TARGET_TRANSFORM_DIS_HEADER "arm/transform-dis-arm-multi.inc.h" #define MIN_INSN_SIZE 2 -struct arch_dis_ctx { unsigned thumb_it_length; }; +struct arch_dis_ctx { + unsigned thumb_it_length; + bool pc_low_bit; +}; enum { IS_LDRD_STRD = 1 << 16 }; diff --git a/lib/arm/transform-dis-arm-multi.inc.h b/lib/arm/transform-dis-arm-multi.inc.h index 662b501..f1b9b80 100644 --- a/lib/arm/transform-dis-arm-multi.inc.h +++ b/lib/arm/transform-dis-arm-multi.inc.h @@ -1,19 +1,19 @@ static inline void PUSHone(struct transform_dis_ctx *ctx, int Rt) { - if (ctx->pc_low_bit) + if (ctx->arch.pc_low_bit) op32(ctx, 0x0d04f84d | Rt << 28); else op32(ctx, 0xe52d0004 | Rt << 12); } static inline void POPone(struct transform_dis_ctx *ctx, int Rt) { - if (ctx->pc_low_bit) + if (ctx->arch.pc_low_bit) op32(ctx, 0x0b04f85d | Rt << 28); else op32(ctx, 0xe49d0004 | Rt << 12); } static inline void POPmulti(struct transform_dis_ctx *ctx, uint16_t mask) { - if (ctx->pc_low_bit) + if (ctx->arch.pc_low_bit) op32(ctx, 0x0000e8bd | mask << 16); else op32(ctx, 0xe8bd0000 | mask); @@ -21,7 +21,7 @@ static inline void POPmulti(struct transform_dis_ctx *ctx, uint16_t mask) { static inline void MOVW_MOVT(struct transform_dis_ctx *ctx, int Rd, uint32_t val) { uint16_t hi = val >> 16, lo = (uint16_t) val; - if (ctx->pc_low_bit) { + if (ctx->arch.pc_low_bit) { op32(ctx, 0x0000f240 | Rd << 24 | lo >> 12 | (lo >> 11 & 1) << 10 | (lo >> 8 & 7) << 28 | (lo & 0xff) << 16); op32(ctx, 0x0000f2c0 | Rd << 24 | hi >> 12 | (hi >> 11 & 1) << 10 | @@ -35,7 +35,7 @@ static inline void MOVW_MOVT(struct transform_dis_ctx *ctx, int Rd, uint32_t val } static inline void STRri(struct transform_dis_ctx *ctx, int Rt, int Rn, uint32_t off) { - if (ctx->pc_low_bit) + if (ctx->arch.pc_low_bit) op32(ctx, 0x0000f8c0 | Rn | Rt << 28 | off << 16); else op32(ctx, 0xe4800000 | Rn << 16 | Rt << 12 | off); @@ -43,7 +43,7 @@ static inline void STRri(struct transform_dis_ctx *ctx, int Rt, int Rn, uint32_t static inline void LDRxi(struct transform_dis_ctx *ctx, int Rt, int Rn, uint32_t off, enum pcrel_load_mode load_mode) { - if (ctx->pc_low_bit) { + if (ctx->arch.pc_low_bit) { int subop, sign; switch (load_mode) { case PLM_U8: subop = 0; sign = 0; break; @@ -118,7 +118,7 @@ static NOINLINE UNUSED void transform_dis_data(struct transform_dis_ctx *ctx, } if (out_mask & IS_LDRD_STRD) in_regs |= 1 << (newval[0] + 1); - uint32_t pc = ctx->pc + (ctx->pc_low_bit ? 4 : 8); + uint32_t pc = ctx->pc + (ctx->arch.pc_low_bit ? 4 : 8); int scratch = __builtin_ctz(~(in_regs | (1 << out_reg))); #ifdef TRANSFORM_DIS_VERBOSE -- cgit v1.2.3