24 memcpy(&opcode, insn->bytes, insn->size);
26 if (insn->size == 4) {
28 uint16_t opcode_high = opcode >> 16;
30 opcode = opcode & 0xffff;
33 "0x%08" PRIx64
" %04x %04x\t%s\t%s",
44 "0x%08" PRIx64
" %04x\t%s\t%s",
59 csret = cs_open(CS_ARCH_ARM64, CS_MODE_LITTLE_ENDIAN, &handle);
61 if (csret != CS_ERR_OK) {
63 LOG_ERROR(
"cs_open() failed: %s", cs_strerror(csret));
68 csret = cs_option(handle, CS_OPT_SKIPDATA, CS_OPT_ON);
70 if (csret != CS_ERR_OK) {
72 LOG_ERROR(
"cs_option() failed: %s", cs_strerror(csret));
78 cs_insn *insn = cs_malloc(handle);
80 if (csret != CS_ERR_OK) {
82 LOG_ERROR(
"cs_malloc() failed: %s", cs_strerror(csret));
101 const uint8_t *tmp =
buffer;
103 ret = cs_disasm_iter(handle, &tmp, &
size, &address, insn);
107 LOG_ERROR(
"cs_disasm_iter() failed: %s", cs_strerror(cs_errno(handle)));
114 print_opcode(
cmd, insn);
int a64_disassemble(struct command_invocation *cmd, struct target *target, target_addr_t address, size_t count)
void command_print(struct command_invocation *cmd, const char *format,...)
#define LOG_ERROR(expr ...)
size_t size
Size of the control block search area.
When run_command is called, a new instance will be created on the stack, filled with the proper value...
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)