From 940e5f172d50809d109de6285da07e4c848209a1 Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Tue, 10 Aug 2010 14:20:25 +1200 Subject: [PATCH] dis: decode MSP430X group 14xx instructions (PUSHM/POPM). --- dis.c | 17 +++++++++++++++-- dis.h | 6 +++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dis.c b/dis.c index ac1e22d..87f93b1 100644 --- a/dis.c +++ b/dis.c @@ -459,7 +459,16 @@ int dis_decode(const uint8_t *code, address_t offset, address_t len, insn->dsize = MSP430_DSIZE_UNKNOWN; } } else { - if ((op & 0xf000) == 0x1000) { + if ((op & 0xfc00) == 0x1400) { + insn->itype = MSP430_ITYPE_SINGLE; + insn->op = op & 0xfe00; + insn->dst_mode = MSP430_AMODE_REGISTER; + insn->dst_reg = op & 0xf; + insn->rep_index = (op >> 4) & 0xf; + insn->dsize = (op & 0x0100) ? + MSP430_DSIZE_WORD : MSP430_DSIZE_AWORD; + ret = 2; + } else if ((op & 0xf000) == 0x1000) { insn->itype = MSP430_ITYPE_SINGLE; ret = decode_single(code, offset, len, insn); } else if ((op & 0xff00) >= 0x2000 && @@ -577,7 +586,11 @@ static const struct { {MSP430_OP_SWPBX, "SWPBX"}, {MSP430_OP_RRAX, "RRAX"}, {MSP430_OP_SXTX, "SXTX"}, - {MSP430_OP_PUSHX, "PUSHX"} + {MSP430_OP_PUSHX, "PUSHX"}, + + /* MSP430X group 14xx */ + {MSP430_OP_PUSHM, "PUSHM"}, + {MSP430_OP_POPM, "POPM"} }; /* Return the mnemonic for an operation, if possible. */ diff --git a/dis.h b/dis.h index 926dd9a..169dd34 100644 --- a/dis.h +++ b/dis.h @@ -205,7 +205,11 @@ typedef enum { MSP430_OP_BICX = 0x2C000, MSP430_OP_BISX = 0x2D000, MSP430_OP_XORX = 0x2E000, - MSP430_OP_ANDX = 0x2F000 + MSP430_OP_ANDX = 0x2F000, + + /* MSP430X group 14xx */ + MSP430_OP_PUSHM = 0x1400, + MSP430_OP_POPM = 0x1600 } msp430_op_t; /* This represents a decoded instruction. All decoded addresses are