mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-26 07:17:01 +00:00
65da25d4c0
- Use the new 'asm-like' build system for r_parse plugins - Added new callback to 'assemble' parseable expressions into compilable asm code - Refactorize and remove warnings in parse_mreplace * Added r_str_char_count() in r_util * Some fixups in the fastcall code in r_asm --HG-- rename : libr/parse/p/mreplace/mmemory.c => libr/parse/p/parse_mreplace/mmemory.c rename : libr/parse/p/mreplace/mmemory.h => libr/parse/p/parse_mreplace/mmemory.h rename : libr/parse/p/mreplace/mreplace.c => libr/parse/p/parse_mreplace/mreplace.c rename : libr/parse/p/mreplace/mreplace.h => libr/parse/p/parse_mreplace/mreplace.h
55 lines
1.2 KiB
C
55 lines
1.2 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 "x86/bea/BeaEngine.h"
|
|
|
|
#include "fastcall_x86.h"
|
|
|
|
|
|
static int disassemble(struct r_asm_t *a, struct r_asm_aop_t *aop, ut8 *buf, ut64 len)
|
|
{
|
|
static DISASM disasm_obj;
|
|
|
|
memset(&disasm_obj, '\0', sizeof(DISASM));
|
|
disasm_obj.EIP = (long long)buf;
|
|
disasm_obj.VirtualAddr = a->pc;
|
|
disasm_obj.Archi = ((a->bits == 64) ? 64 : 0);
|
|
disasm_obj.SecurityBlock = len;
|
|
if (a->syntax == R_ASM_SYN_ATT)
|
|
disasm_obj.Options = 0x400;
|
|
else disasm_obj.Options = 0;
|
|
|
|
aop->inst_len = Disasm(&disasm_obj);
|
|
aop->disasm_obj = &disasm_obj;
|
|
|
|
snprintf(aop->buf_asm, R_ASM_BUFSIZE, disasm_obj.CompleteInstr);
|
|
|
|
return aop->inst_len;
|
|
}
|
|
|
|
struct r_asm_handle_t r_asm_plugin_x86_bea = {
|
|
.name = "asm_x86_bea",
|
|
.desc = "X86 disassembly plugin (bea engine)",
|
|
.arch = "x86",
|
|
.bits = (int[]){ 32, 64, 0 }, /* also 16 ? */
|
|
.init = NULL,
|
|
.fini = NULL,
|
|
.disassemble = &disassemble,
|
|
.assemble = NULL,
|
|
.fastcall = fastcall,
|
|
};
|
|
|
|
#ifndef CORELIB
|
|
struct r_lib_struct_t radare_plugin = {
|
|
.type = R_LIB_TYPE_ASM,
|
|
.data = &r_asm_plugin_x86_bea
|
|
};
|
|
#endif
|