mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-27 16:07:54 +00:00
cdd80105cb
- Managing breakpoints for the core - Initial work on the support for breakpoints for the r_debug plugins * Adding some dummy work for context support in r_anal * Make asm_set_bits check per-plugin supported bit sizes - Now asm plugins have 'arch' and 'bits' attributes - Used to setup default callbacks for undefined 'assemble' callback - Also used to avoid setting asm.bits eval variable to invalid values - We need a way to display all this data * Added DEFAULT_ARCH in config.h to setup default arch to asm and anal * Added r_config_set_i_cb() - Make r_config_set restore value when callback is called and fails - asm.bits now has a config callback * Added _LAST in some r_anal enums
55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
/* radare - GPL3 - 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 "ppc/ppc_disasm/ppc_disasm.h"
|
|
|
|
|
|
static int disassemble(struct r_asm_t *a, struct r_asm_aop_t *aop, u8 *buf, u64 len)
|
|
{
|
|
ppc_word iaddr = (ppc_word)a->pc;
|
|
ppc_word bof[4];
|
|
char opcode[128];
|
|
char operands[128];
|
|
|
|
static struct DisasmPara_PPC dp;
|
|
/* initialize DisasmPara */
|
|
memcpy(bof, buf, 4);
|
|
dp.opcode = opcode;
|
|
dp.operands = operands;
|
|
dp.iaddr = &iaddr;
|
|
dp.instr = bof;
|
|
PPC_Disassemble(&dp, a->big_endian);
|
|
aop->disasm_obj = &dp;
|
|
r_hex_bin2str((u8*)bof, 4, aop->buf_hex);
|
|
sprintf(aop->buf_asm, "%s %s", opcode, operands);
|
|
memcpy(aop->buf, bof, 4);
|
|
aop->inst_len = 4;
|
|
|
|
return aop->inst_len;
|
|
}
|
|
|
|
struct r_asm_handle_t r_asm_plugin_ppc = {
|
|
.name = "asm_ppc",
|
|
.arch = "powepc",
|
|
.bits = (int[]){ 32, 0 },
|
|
.desc = "PPC disassembly plugin",
|
|
.init = NULL,
|
|
.fini = NULL,
|
|
.disassemble = &disassemble,
|
|
.assemble = NULL
|
|
};
|
|
|
|
#ifndef CORELIB
|
|
struct r_lib_struct_t radare_plugin = {
|
|
.type = R_LIB_TYPE_ASM,
|
|
.data = &r_asm_plugin_ppc
|
|
};
|
|
#endif
|