Rizin
unix-like reverse engineering framework and cli tools
asm_ebc.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012-2018 pancake <pancake@nopcode.org>
2 // SPDX-FileCopyrightText: 2012-2018 fedor sakharov <fedor.sakharov@gmail.com>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #include <stdio.h>
6 #include <string.h>
7 #include <rz_types.h>
8 #include <rz_lib.h>
9 #include <rz_asm.h>
10 #include <ebc_disas.h>
11 
12 static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) {
13  ebc_command_t cmd = { { 0 }, { 0 } };
14  int ret = ebc_decode_command(buf, &cmd);
15  const char *buf_asm = (cmd.operands[0])
16  ? sdb_fmt("%s %s", cmd.instr, cmd.operands)
17  : cmd.instr;
18  rz_asm_op_set_asm(op, buf_asm);
19  return op->size = ret;
20 }
21 
23  .name = "ebc",
24  .license = "LGPL3",
25  .desc = "EFI Bytecode",
26  .author = "Fedor Sakharov",
27  .arch = "ebc",
28  .bits = 32 | 64,
29  .endian = RZ_SYS_ENDIAN_LITTLE,
30  .disassemble = &disassemble,
31 };
32 
33 #ifndef RZ_PLUGIN_INCORE
36  .data = &rz_asm_plugin_ebc,
38 };
39 #endif
size_t len
Definition: 6502dis.c:15
RZ_API void rz_asm_op_set_asm(RzAsmOp *op, const char *str)
Definition: aop.c:53
RzAsmPlugin rz_asm_plugin_ebc
Definition: asm_ebc.c:22
RZ_API RzLibStruct rizin_plugin
Definition: asm_ebc.c:34
static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
Definition: asm_ebc.c:12
#define RZ_API
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
Definition: sflib.h:79
int ebc_decode_command(const ut8 *instr, ebc_command_t *cmd)
Definition: ebc_disas.c:986
RZ_API char * sdb_fmt(const char *fmt,...)
Definition: fmt.c:26
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
#define RZ_SYS_ENDIAN_LITTLE
Definition: rz_types.h:526
#define RZ_VERSION
Definition: rz_version.h:8
#define a(i)
Definition: sha256.c:41
const char * name
Definition: rz_asm.h:130
const char * version
Definition: rz_asm.h:133
Definition: dis.c:32