mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-27 08:12:44 +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
926 B
C
46 lines
926 B
C
/* radare - LGPL - Copyright 2012-2013 - pancake
|
|
2013 - Fedor Sakharov <fedor.sakharov@gmail.com> */
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <r_types.h>
|
|
#include <r_lib.h>
|
|
#include <r_asm.h>
|
|
|
|
#include <ebc_disas.h>
|
|
|
|
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
|
int ret = 1;
|
|
ebc_command_t cmd = { {0}, {0} };
|
|
|
|
ret = ebc_decode_command(buf, &cmd);
|
|
|
|
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 = ret;
|
|
return ret;
|
|
}
|
|
|
|
RAsmPlugin r_asm_plugin_ebc = {
|
|
.name = "ebc",
|
|
.license = "LGPL3",
|
|
.desc = "EFI Bytecode",
|
|
.arch = "ebc",
|
|
.bits = 32|64,
|
|
.endian = R_SYS_ENDIAN_LITTLE,
|
|
.disassemble = &disassemble,
|
|
};
|
|
|
|
#ifndef CORELIB
|
|
struct r_lib_struct_t radare_plugin = {
|
|
.type = R_LIB_TYPE_ASM,
|
|
.data = &r_asm_plugin_ebc,
|
|
.version = R2_VERSION
|
|
};
|
|
#endif
|