-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathasm_u8.c
47 lines (40 loc) · 877 Bytes
/
asm_u8.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* radare nX-U8/100 asm plugin - LGPL - Copyright 2020 - cetus9 */
#include <stdio.h>
#include <string.h>
#include <r_types.h>
#include <r_lib.h>
#include <r_asm.h>
#include "u8_disas.h"
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len)
{
struct u8_cmd cmd =
{
.instr = "",
.operands = ""
};
if (len < 2) return -1;
int ret = u8_decode_opcode(buf, len, &cmd);
if (ret > 0)
{
r_strbuf_set(&op->buf_asm, sdb_fmt("%s %s", cmd.instr, cmd.operands));
}
return op->size = ret;
}
RAsmPlugin r_asm_plugin_u8 =
{
.name = "u8",
.license = "LGPL3",
.desc = "nX-U8/100 disassembly plugin",
.arch = "u8",
.bits = 8 | 16,
.endian = R_SYS_ENDIAN_LITTLE,
.disassemble = &disassemble
};
#ifndef R2_PLUGIN_INCORE
R_API RLibStruct radare_plugin =
{
.type = R_LIB_TYPE_ASM,
.data = &r_asm_plugin_u8,
.version = R2_VERSION
};
#endif