Various fixes

* Fixed a break indentation
* Fixed incorrect enum value for M68K_GRP_IRET
* Fixed so groups_count is set to 0 at init
* Added group_count printing in python example
This commit is contained in:
Daniel Collin 2016-04-10 16:16:28 +02:00
parent d994c74b02
commit 0bcb2e546c
3 changed files with 9 additions and 6 deletions

View File

@ -2027,7 +2027,7 @@ static void d68020_cpgen(m68k_info *info)
case 0x38: MCInst_setOpcode(info->inst, M68K_INS_FCMP); supports_single_op = false; break;
case 0x3a: MCInst_setOpcode(info->inst, M68K_INS_FTST); break;
default:
break;
break;
}
// Some trickery here! It's not documented but if bit 6 is set this is a s/d opcode and then
@ -2347,15 +2347,15 @@ static void d68020_extb_32(m68k_info *info)
static void d68000_jmp(m68k_info *info)
{
set_insn_group(info, M68K_GRP_JUMP);
cs_m68k* ext = build_init_op(info, M68K_INS_JMP, 1, 0);
set_insn_group(info, M68K_GRP_JUMP);
get_ea_mode_op(info, &ext->operands[0], info->ir, 4);
}
static void d68000_jsr(m68k_info *info)
{
set_insn_group(info, M68K_GRP_JUMP);
cs_m68k* ext = build_init_op(info, M68K_INS_JSR, 1, 0);
set_insn_group(info, M68K_GRP_JUMP);
get_ea_mode_op(info, &ext->operands[0], info->ir, 4);
}
@ -3906,6 +3906,7 @@ bool M68K_getInstruction(csh ud, const uint8_t* code, size_t code_len, MCInst* i
cs_struct* handle = instr->csh;
m68k_info *info = (m68k_info*)handle->printer_info;
info->groups_count = 0;
info->code = code;
info->code_len = code_len;
info->baseAddress = address;

View File

@ -6,7 +6,7 @@ from capstone import *
from capstone.m68k import *
from xprint import to_hex, to_x
M68K_CODE = b"\xd4\x40\x87\x5a\x4e\x71\x02\xb4\xc0\xde\xc0\xde\x5c\x00\x1d\x80\x71\x12\x01\x23\xf2\x3c\x44\x22\x40\x49\x0e\x56\x54\xc5\xf2\x3c\x44\x00\x44\x7a\x00\x00\xf2\x00\x0a\x28"
M68K_CODE = b"\xd4\x40\x87\x5a\x4e\x71\x02\xb4\xc0\xde\xc0\xde\x5c\x00\x1d\x80\x71\x12\x01\x23\xf2\x3c\x44\x22\x40\x49\x0e\x56\x54\xc5\xf2\x3c\x44\x00\x44\x7a\x00\x00\xf2\x00\x0a\x28\x4E\xB9\x00\x00\x00\x12\x4E\x75"
all_tests = (
(CS_ARCH_M68K, CS_MODE_BIG_ENDIAN | CS_MODE_M68K_040, M68K_CODE, "M68K"),
@ -40,12 +40,14 @@ s_addressing_modes = {
16: "Absolute Data Addressing - Short",
17: "Absolute Data Addressing - Long",
18: "Immidate value",
}
}
def print_insn_detail(insn):
if len(insn.operands) > 0:
print("\top_count: %u" % (len(insn.operands)))
print("\tgroups_count: %u" % len(insn.groups))
for i, op in enumerate(insn.operands):
if op.type == M68K_OP_REG:
print("\t\toperands[%u].type: REG = %s" % (i, insn.reg_name(op.reg)))

View File

@ -574,7 +574,7 @@ typedef enum m68k_group_type {
M68K_GRP_INVALID = 0, // CS_GRUP_INVALID
M68K_GRP_JUMP, // = CS_GRP_JUMP
M68K_GRP_RET = 3, // = CS_GRP_RET
M68K_GRP_IRET, // = CS_GRP_IRET
M68K_GRP_IRET = 5, // = CS_GRP_IRET
M68K_GRP_ENDING,
} m68k_group_type;