diff --git a/arch/M68K/M68KDisassembler.c b/arch/M68K/M68KDisassembler.c index 9582befdb..1ee752875 100644 --- a/arch/M68K/M68KDisassembler.c +++ b/arch/M68K/M68KDisassembler.c @@ -979,19 +979,21 @@ static void build_cas2(m68k_info *info, int size) op0->address_mode = M68K_AM_NONE; op0->type = M68K_OP_REG_PAIR; - op0->register_bits = (((extension >> 16) & 7) << 4) | (extension & 7); + op0->reg_pair.reg_0 = (extension >> 16) & 7; + op0->reg_pair.reg_1 = extension & 7; op1->address_mode = M68K_AM_NONE; op1->type = M68K_OP_REG_PAIR; - op1->register_bits = (((extension >> 22) & 7) << 4) | ((extension >> 6) & 7); + op1->reg_pair.reg_0 = (extension >> 22) & 7; + op1->reg_pair.reg_1 = (extension >> 6) & 7; reg_0 = (extension >> 28) & 7; reg_1 = (extension >> 12) & 7; op2->address_mode = M68K_AM_NONE; op2->type = M68K_OP_REG_PAIR; - op2->register_bits = ((reg_0 + (BIT_1F(extension) ? 8 : 0)) << 4) | - (reg_1 + (BIT_F(extension) ? 8 : 0)); + op2->reg_pair.reg_0 = reg_0 + (BIT_1F(extension) ? 8 : 0); + op2->reg_pair.reg_1 = reg_1 + (BIT_F(extension) ? 8 : 0); } static void build_chk2_cmp2(m68k_info *info, int size) @@ -2244,7 +2246,8 @@ static void d68020_divl(m68k_info *info) op1->address_mode = M68K_AM_NONE; op1->type = M68K_OP_REG_PAIR; - op1->register_bits = (reg_0 << 4) | reg_1; + op1->reg_pair.reg_0 = reg_0; + op1->reg_pair.reg_1 = reg_1; if ((reg_0 == reg_1) || !BIT_A(extension)) { op1->type = M68K_OP_REG; @@ -2789,7 +2792,8 @@ static void d68020_mull(m68k_info *info) op1->address_mode = M68K_AM_NONE; op1->type = M68K_OP_REG_PAIR; - op1->register_bits = (reg_0 << 4) | reg_1; + op1->reg_pair.reg_0 = reg_0; + op1->reg_pair.reg_1 = reg_1; if (!BIT_A(extension)) { op1->type = M68K_OP_REG; diff --git a/include/capstone/m68k.h b/include/capstone/m68k.h index 91f69e56e..c5811cee4 100644 --- a/include/capstone/m68k.h +++ b/include/capstone/m68k.h @@ -112,7 +112,8 @@ typedef enum m68k_op_type { M68K_OP_REG, // = CS_OP_REG (Register operand). M68K_OP_IMM, // = CS_OP_IMM (Immediate operand). M68K_OP_MEM, // = CS_OP_MEM (Memory operand). - M68K_OP_FP, // = CS_OP_FP (Floating-Point operand) + M68K_OP_FP_SINGLE, // single precision Floating-Point operand + M68K_OP_FP_DOUBLE, // double precision Floating-Point operand M68K_OP_REG_BITS, // Register bits move M68K_OP_REG_PAIR, // Register pair in the same op (upper 4 bits for first reg, lower for second) } m68k_op_type; @@ -136,12 +137,16 @@ typedef struct m68k_op_mem { // Instruction operand typedef struct cs_m68k_op { union { - uint64_t imm; // immediate value for IMM operand + uint64_t imm; // immediate value for IMM operand double dimm; // double imm float simm; // float imm m68k_reg reg; // register value for REG operand + struct { // register pair in one operand + m68k_reg reg_0; + m68k_reg reg_1; + } reg_pair; m68k_op_mem mem; // data when operand is targeting memory - uint32_t register_bits; // register bits for movem/cas2/etc (always in d0-d7, a0-a7, fp0 - fp7 order) + uint32_t register_bits; // register bits for movem etc. (always in d0-d7, a0-a7, fp0 - fp7 order) }; m68k_op_type type; m68k_address_mode address_mode; // M68K addressing mode for this op