- Added arm plugin - Added bf plugin - Added csr plugin - Added m68k plugin - Added mips plugin - Added ppc plugin - Added sparc plugin - Removed deprecated test programs - Updated rasm2 (not working) * r_parse - Initial import --HG-- rename : libr/asm/arch/arm/asm.c => libr/asm/p/asm_arm.c rename : libr/asm/arch/bf/asm.c => libr/asm/p/asm_bf.c rename : libr/asm/arch/csr/asm.c => libr/asm/p/asm_csr.c rename : libr/asm/arch/m68k/asm.c => libr/asm/p/asm_m68k.c rename : libr/asm/arch/mips/asm.c => libr/asm/p/asm_mips.c rename : libr/asm/arch/ppc/asm.c => libr/asm/p/asm_ppc.c rename : libr/asm/arch/sparc/asm.c => libr/asm/p/asm_sparc.c rename : libr/asm/arch/x86/pseudo.c => libr/parse/pseudo.c
49 lines
1 KiB
C
49 lines
1 KiB
C
/* radare - LGPL - Copyright 2009 nibble<.ds@gmail.com> */
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include <r_types.h>
|
|
#include <r_lib.h>
|
|
#include <r_util.h>
|
|
#include <r_asm.h>
|
|
|
|
#include "m68k/m68k_disasm/m68k_disasm.h"
|
|
|
|
|
|
static int disassemble(struct r_asm_t *a, struct r_asm_aop_t *aop, u8 *buf, u64 len)
|
|
{
|
|
m68k_word bof[4];
|
|
m68k_word iaddr = (m68k_word)a->pc;
|
|
char opcode[256];
|
|
char operands[256];
|
|
|
|
struct DisasmPara_68k dp;
|
|
/* initialize DisasmPara */
|
|
memcpy(bof, buf, 4);
|
|
dp.opcode = opcode;
|
|
dp.operands = operands;
|
|
dp.iaddr = &iaddr;
|
|
dp.instr = bof;
|
|
M68k_Disassemble(&dp);
|
|
sprintf(aop->buf_asm, "%s %s", opcode, operands);
|
|
r_hex_bin2str((u8*)bof, 4, aop->buf_hex);
|
|
memcpy(aop->buf, bof, 4);
|
|
aop->inst_len = 4;
|
|
|
|
return aop->inst_len;
|
|
}
|
|
|
|
static struct r_asm_handle_t r_asm_plugin_m68k = {
|
|
.name = "asm_m68k",
|
|
.desc = "M68K disassembly plugin",
|
|
.init = NULL,
|
|
.fini = NULL,
|
|
.disassemble = &disassemble,
|
|
.assemble = NULL
|
|
};
|
|
|
|
struct r_lib_struct_t radare_plugin = {
|
|
.type = R_LIB_TYPE_ASM,
|
|
.data = &r_asm_plugin_m68k
|
|
};
|