2014-01-15 00:56:28 +00:00
|
|
|
/* radare - LGPL - Copyright 2009-2014 - nibble */
|
2012-08-07 20:17:14 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <r_types.h>
|
|
|
|
#include <r_util.h>
|
|
|
|
#include <r_lib.h>
|
|
|
|
#include <r_asm.h>
|
|
|
|
#include "../arch/arm/winedbg/be_arm.h"
|
|
|
|
|
2013-04-09 20:54:04 +00:00
|
|
|
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
2013-09-14 12:04:08 +00:00
|
|
|
ut8 buf2[4];
|
2014-06-24 11:22:32 +00:00
|
|
|
struct winedbg_arm_insn *arminsn = arm_new();
|
2013-02-13 00:20:42 +00:00
|
|
|
arm_set_pc (arminsn, a->pc);
|
|
|
|
arm_set_thumb (arminsn, a->bits == 16);
|
|
|
|
if (a->big_endian && a->bits == 32) {
|
|
|
|
r_mem_copyendian (buf2, buf, 4, 0);
|
|
|
|
arm_set_input_buffer (arminsn, buf2);
|
|
|
|
} else {
|
|
|
|
arm_set_input_buffer (arminsn, buf);
|
|
|
|
}
|
2013-12-06 04:04:17 +00:00
|
|
|
op->size = arm_disasm_one_insn (arminsn);
|
2014-06-24 11:22:32 +00:00
|
|
|
strncpy (op->buf_asm, winedbg_arm_insn_asm (arminsn), R_ASM_BUFSIZE-1);
|
|
|
|
strncpy (op->buf_hex, winedbg_arm_insn_hex (arminsn), R_ASM_BUFSIZE-1);
|
2013-02-13 00:20:42 +00:00
|
|
|
arm_free (arminsn);
|
2013-12-06 04:04:17 +00:00
|
|
|
return op->size;
|
2012-08-07 20:17:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RAsmPlugin r_asm_plugin_arm_winedbg = {
|
2012-08-08 08:31:17 +00:00
|
|
|
.name = "arm.winedbg",
|
2012-08-07 20:17:14 +00:00
|
|
|
.arch = "arm",
|
2013-12-05 17:41:13 +00:00
|
|
|
.bits = 16|32,
|
2014-02-25 16:03:12 +00:00
|
|
|
.desc = "WineDBG's ARM disassembler",
|
2012-08-07 20:17:14 +00:00
|
|
|
.init = NULL,
|
|
|
|
.fini = NULL,
|
|
|
|
.disassemble = &disassemble,
|
2013-12-02 03:44:26 +00:00
|
|
|
.assemble = NULL,
|
|
|
|
.license = "LGPL2"
|
2012-08-07 20:17:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef CORELIB
|
|
|
|
struct r_lib_struct_t radare_plugin = {
|
|
|
|
.type = R_LIB_TYPE_ASM,
|
2015-07-12 14:04:10 +00:00
|
|
|
.data = &r_asm_plugin_arm_winedbg,
|
|
|
|
.version = R2_VERSION
|
2012-08-07 20:17:14 +00:00
|
|
|
};
|
|
|
|
#endif
|