diff options
author | comex | 2015-02-08 23:45:24 -0500 |
---|---|---|
committer | comex | 2015-02-08 23:45:24 -0500 |
commit | eb93cee2a22cde812ccd6b9bd418d36185c058f5 (patch) | |
tree | 43a22ccf021a1513dba3a9c99f7b81822fe950fa /lib/arm/dis-main.inc.h | |
parent | formatting (diff) | |
download | substitute-eb93cee2a22cde812ccd6b9bd418d36185c058f5.tar.gz |
Refactor disassembly so x86 works, and add x86 transform-dis.
This patch is a monolithic mess, because I was too lazy to do the
refactor first (that would require some stash fun, since I wasn't
actually sure before doing x86 transform-dis what would be needed).
Anyway, the resulting code should be cleaner - less duplication.
This breaks ARM/ARM64.
Diffstat (limited to 'lib/arm/dis-main.inc.h')
-rw-r--r-- | lib/arm/dis-main.inc.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/arm/dis-main.inc.h b/lib/arm/dis-main.inc.h new file mode 100644 index 0000000..bf2767e --- /dev/null +++ b/lib/arm/dis-main.inc.h @@ -0,0 +1,16 @@ +#include "dis-thumb.inc.h" +#include "dis-thumb2.inc.h" +#include "dis-arm.inc.h" + +static INLINE void P(dis)(tdis_ctx ctx) { + 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) + return P(dis_thumb2)(ctx); + else + return P(dis_thumb)(ctx); + } else { + return P(dis_arm)(ctx); + } +} |