mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-13 01:00:37 +00:00
af0a865d9f
- Adds endian aware functions - Removes references to host endian - Uses binary detected endianness else tries LE and restricts by RAsmPlugin - Fixes gdb debugger endianness when debugging BE qemu gdbserver Signed-off-by: Damien Zammit <damien@zamaudio.com>
46 lines
992 B
C
46 lines
992 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <r_types.h>
|
|
#include <r_lib.h>
|
|
#include <r_asm.h>
|
|
|
|
#include <propeller_disas.h>
|
|
|
|
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len)
|
|
{
|
|
int ret;
|
|
struct propeller_cmd cmd;
|
|
|
|
ret = propeller_decode_command (buf, &cmd);
|
|
|
|
if (cmd.prefix[0] && cmd.operands[0]) {
|
|
snprintf (op->buf_asm, R_ASM_BUFSIZE, "%s %s %s", cmd.prefix, cmd.instr, cmd.operands);
|
|
} else if (cmd.operands[0]) {
|
|
snprintf (op->buf_asm, R_ASM_BUFSIZE, "%s %s", cmd.instr, cmd.operands);
|
|
} else {
|
|
snprintf (op->buf_asm, R_ASM_BUFSIZE, "%s", cmd.instr);
|
|
}
|
|
|
|
op->size = 4;
|
|
|
|
return ret;
|
|
}
|
|
|
|
RAsmPlugin r_asm_plugin_propeller = {
|
|
.name = "propeller",
|
|
.license = "LGPL3",
|
|
.desc = "propeller disassembly plugin",
|
|
.arch = "propeller",
|
|
.bits = 32,
|
|
.endian = R_SYS_ENDIAN_BIG,
|
|
.disassemble = &disassemble
|
|
};
|
|
|
|
#ifndef CORELIB
|
|
struct r_lib_struct_t radare_plugin = {
|
|
.type = R_LIB_TYPE_ASM,
|
|
.data = &r_asm_plugin_propeller,
|
|
.version = R2_VERSION
|
|
};
|
|
#endif
|