From 82dbeed2cc7324e667478b3f324440f5b0cb60d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Sun, 10 Jun 2012 20:07:14 +0200 Subject: [PATCH] winedbg: Add multiplication operators to Thumb2 disassembler. --- programs/winedbg/be_arm.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c index c66c2b0fcbf..c5edfd935dd 100644 --- a/programs/winedbg/be_arm.c +++ b/programs/winedbg/be_arm.c @@ -594,6 +594,43 @@ static UINT thumb2_disasm_misc(UINT inst, ADDRESS64 *addr) return inst; } +static UINT thumb2_disasm_mul(UINT inst, ADDRESS64 *addr) +{ + WORD op1 = (inst >> 20) & 0x07; + WORD op2 = (inst >> 4) & 0x03; + + if (op1) + return inst; + + if (op2 == 0 && get_nibble(inst, 3) != 0xf) + { + dbg_printf("\n\tmla\t%s, %s, %s, %s\t", tbl_regs[get_nibble(inst, 2)], + tbl_regs[get_nibble(inst, 4)], + tbl_regs[get_nibble(inst, 0)], + tbl_regs[get_nibble(inst, 3)]); + return 0; + } + + if (op2 == 0 && get_nibble(inst, 3) == 0xf) + { + dbg_printf("\n\tmul\t%s, %s, %s\t", tbl_regs[get_nibble(inst, 2)], + tbl_regs[get_nibble(inst, 4)], + tbl_regs[get_nibble(inst, 0)]); + return 0; + } + + if (op2 == 1) + { + dbg_printf("\n\tmls\t%s, %s, %s, %s\t", tbl_regs[get_nibble(inst, 2)], + tbl_regs[get_nibble(inst, 4)], + tbl_regs[get_nibble(inst, 0)], + tbl_regs[get_nibble(inst, 3)]); + return 0; + } + + return inst; +} + struct inst_arm { UINT mask; @@ -648,6 +685,7 @@ static const struct inst_thumb16 tbl_thumb16[] = { static const struct inst_arm tbl_thumb32[] = { { 0xf800f800, 0xf000f800, thumb2_disasm_branchlinked }, { 0xffc0f0c0, 0xfa80f080, thumb2_disasm_misc }, + { 0xff8000c0, 0xfb000000, thumb2_disasm_mul }, { 0x00000000, 0x00000000, NULL } };