Rizin
unix-like reverse engineering framework and cli tools
asm_cil.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2022 wingdeans <wingdeans@protonmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_asm.h>
5 #include "cil/cil_dis.h"
6 
7 static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) {
8  CILOp cilop = { { { 0 } } };
9  if (cil_dis(&cilop, buf, len)) {
10  return 0;
11  }
12  rz_strbuf_copy(&op->buf_asm, &cilop.strbuf);
13  rz_strbuf_fini(&cilop.strbuf);
14  return op->size = cilop.size;
15 }
16 
18  .name = "cil",
19  .arch = "cil",
20  .desc = ".NET Common Intermediate Language",
21  .license = "LGPL3",
22  .bits = 16 | 32 | 64,
23  .disassemble = &disassemble,
24 };
25 
26 #ifndef RZ_PLUGIN_INCORE
29  .data = &rz_asm_plugin_cil,
31 };
32 #endif
size_t len
Definition: 6502dis.c:15
RzAsmPlugin rz_asm_plugin_cil
Definition: asm_cil.c:17
RZ_API RzLibStruct rizin_plugin
Definition: asm_cil.c:27
static int disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len)
Definition: asm_cil.c:7
int cil_dis(CILOp *op, const ut8 *buf, int len)
Disassemble a CIL buffer.
Definition: cil_dis.c:150
#define RZ_API
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
RZ_API bool rz_strbuf_copy(RzStrBuf *dst, RzStrBuf *src)
Definition: strbuf.c:48
RZ_API void rz_strbuf_fini(RzStrBuf *sb)
Definition: strbuf.c:365
#define RZ_VERSION
Definition: rz_version.h:8
#define a(i)
Definition: sha256.c:41
Definition: cil_dis.h:27
int size
Definition: cil_dis.h:29
RzStrBuf strbuf
Definition: cil_dis.h:28
const char * name
Definition: rz_asm.h:130
const char * version
Definition: rz_asm.h:133
Definition: dis.c:32