Rizin
unix-like reverse engineering framework and cli tools
asm_pic.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2018 thestr4ng3r <info@florianmaerkl.de>
2 // SPDX-FileCopyrightText: 2018 courk <courk@courk.cc>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #include <rz_asm.h>
6 #include <rz_lib.h>
7 
8 #include "../arch/pic/pic_baseline.h"
9 #include "../arch/pic/pic_pic18.h"
10 #include "../arch/pic/pic_midrange.h"
11 
12 static int asm_pic_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *b, int l) {
13  int res = -1;
14  char opbuf[128];
15  const char *opstr = opbuf;
16  strcpy(opbuf, "invalid");
17  if (a->cpu && strcasecmp(a->cpu, "baseline") == 0) {
18  res = pic_baseline_disassemble(op, opbuf, b, l);
19  } else if (a->cpu && strcasecmp(a->cpu, "midrange") == 0) {
20  res = pic_midrange_disassemble(op, opbuf, b, l);
21  } else if (a->cpu && strcasecmp(a->cpu, "pic18") == 0) {
22  res = pic_pic18_disassemble(op, opbuf, b, l);
23  }
25  return op->size = res;
26 }
27 
29  .name = "pic",
30  .arch = "pic",
31  .cpus = "baseline,midrange,pic18",
32  .bits = 8,
33  .license = "LGPL3",
34  .desc = "PIC disassembler",
35  .disassemble = &asm_pic_disassemble
36 };
37 
38 #ifndef RZ_PLUGIN_INCORE
41  .data = &rz_asm_plugin_pic
42 };
43 #endif
RZ_API void rz_asm_op_set_asm(RzAsmOp *op, const char *str)
Definition: aop.c:53
static int asm_pic_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *b, int l)
Definition: asm_pic.c:12
RZ_API RzLibStruct rizin_plugin
Definition: asm_pic.c:39
RzAsmPlugin rz_asm_plugin_pic
Definition: asm_pic.c:28
static int opstr(RzAsm *a, ut8 *data, const Opcode *op)
Definition: asm_x86_nz.c:4054
#define RZ_API
uint8_t ut8
Definition: lh5801.h:11
int pic_baseline_disassemble(RzAsmOp *op, char *opbuf, const ut8 *b, int l)
Definition: pic_baseline.c:193
int pic_midrange_disassemble(RzAsmOp *op, char *opbuf, const ut8 *b, int l)
Definition: pic_midrange.c:159
int pic_pic18_disassemble(RzAsmOp *op, char *opbuf, const ut8 *b, int blen)
Definition: pic_pic18.c:114
@ RZ_LIB_TYPE_ASM
Definition: rz_lib.h:72
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41
const char * name
Definition: rz_asm.h:130
Definition: dis.c:32