dis: decode MSP430X single-operand instructions with extension word.
This commit is contained in:
parent
bc992661cf
commit
f1ee757ab0
22
dis.c
22
dis.c
|
@ -429,6 +429,10 @@ int dis_decode(const uint8_t *code, address_t offset, address_t len,
|
|||
insn->itype = MSP430_ITYPE_DOUBLE;
|
||||
ret = decode_double(code, offset, len, insn);
|
||||
insn->op |= EXTENSION_BIT;
|
||||
} else if ((op & 0xf000) == 0x1000 && (op & 0xfc00) < 0x1280) {
|
||||
insn->itype = MSP430_ITYPE_SINGLE;
|
||||
ret = decode_single(code, offset, len, insn);
|
||||
insn->op |= EXTENSION_BIT;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
@ -436,7 +440,11 @@ int dis_decode(const uint8_t *code, address_t offset, address_t len,
|
|||
if (insn->dst_mode == MSP430_AMODE_REGISTER &&
|
||||
(insn->itype == MSP430_ITYPE_SINGLE ||
|
||||
insn->src_mode == MSP430_AMODE_REGISTER)) {
|
||||
insn->zero_carry = (ex_word >> 8) & 1;
|
||||
if ((ex_word >> 8) & 1) {
|
||||
if (insn->op != MSP430_OP_RRCX)
|
||||
return -1;
|
||||
insn->op = MSP430_OP_RRUX;
|
||||
}
|
||||
insn->rep_register = (ex_word >> 7) & 1;
|
||||
insn->rep_index = ex_word & 0xf;
|
||||
} else {
|
||||
|
@ -549,7 +557,7 @@ static const struct {
|
|||
{MSP430_OP_SETZ, "SETZ"},
|
||||
{MSP430_OP_TST, "TST"},
|
||||
|
||||
/* MSP430X double operand */
|
||||
/* MSP430X double operand (extension word) */
|
||||
{MSP430_OP_MOVX, "MOVX"},
|
||||
{MSP430_OP_ADDX, "ADDX"},
|
||||
{MSP430_OP_ADDCX, "ADDCX"},
|
||||
|
@ -561,7 +569,15 @@ static const struct {
|
|||
{MSP430_OP_BICX, "BICX"},
|
||||
{MSP430_OP_BISX, "BISX"},
|
||||
{MSP430_OP_XORX, "XORX"},
|
||||
{MSP430_OP_ANDX, "ANDX"}
|
||||
{MSP430_OP_ANDX, "ANDX"},
|
||||
|
||||
/* MSP430X single operand (extension word) */
|
||||
{MSP430_OP_RRCX, "RRCX"},
|
||||
{MSP430_OP_RRUX, "RRUX"},
|
||||
{MSP430_OP_SWPBX, "SWPBX"},
|
||||
{MSP430_OP_RRAX, "RRAX"},
|
||||
{MSP430_OP_SXTX, "SXTX"},
|
||||
{MSP430_OP_PUSHX, "PUSHX"}
|
||||
};
|
||||
|
||||
/* Return the mnemonic for an operation, if possible. */
|
||||
|
|
11
dis.h
11
dis.h
|
@ -185,7 +185,15 @@ typedef enum {
|
|||
MSP430_OP_SETZ = 0x10016,
|
||||
MSP430_OP_TST = 0x10017,
|
||||
|
||||
/* MSP430X double operand */
|
||||
/* MSP430X single operand (extension word) */
|
||||
MSP430_OP_RRCX = 0x21000,
|
||||
MSP430_OP_RRUX = 0x21001, /* note: ZC = 1 */
|
||||
MSP430_OP_SWPBX = 0x21080,
|
||||
MSP430_OP_RRAX = 0x21100,
|
||||
MSP430_OP_SXTX = 0x21180,
|
||||
MSP430_OP_PUSHX = 0x21200,
|
||||
|
||||
/* MSP430X double operand (extension word) */
|
||||
MSP430_OP_MOVX = 0x24000,
|
||||
MSP430_OP_ADDX = 0x25000,
|
||||
MSP430_OP_ADDCX = 0x26000,
|
||||
|
@ -223,7 +231,6 @@ struct msp430_instruction {
|
|||
|
||||
int rep_index;
|
||||
int rep_register;
|
||||
int zero_carry;
|
||||
};
|
||||
|
||||
/* Decode a single instruction.
|
||||
|
|
Loading…
Reference in New Issue