Rizin
unix-like reverse engineering framework and cli tools
analysis_vax.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2015 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <string.h>
5 #include <rz_types.h>
6 #include <rz_util.h>
7 #include <rz_lib.h>
8 #include <rz_asm.h>
9 #include <rz_analysis.h>
10 
11 // XXX: this is just a PoC
12 // XXX: do not hardcode size/type here, use proper decoding table
13 // http://hotkosc.ru:8080/method-vax.doc
14 
15 static int vax_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask) {
16  op->size = 1;
17  if (len < 1) {
18  return -1;
19  }
21  switch (buf[0]) {
22  case 0xd0:
23  case 0x2e:
25  op->size = 8;
26  break;
27  case 0x78:
29  op->size = 8;
30  break;
31  case 0xc0:
32  case 0xd8:
34  op->size = 8;
35  break;
36  case 0x00:
37  op->type = RZ_ANALYSIS_OP_TYPE_TRAP; // HALT
38  break;
39  case 0x01:
41  break;
42  case 0x51:
43  case 0x73:
45  break;
46  case 0xac:
48  op->size = 4;
49  break;
50  case 0x5a:
51  op->size = 2;
52  break;
53  case 0x11:
54  case 0x18:
55  op->size = 2;
57  break;
58  case 0x31:
59  case 0xe9:
60  op->size = 3;
62  break;
63  case 0xc6:
64  case 0xc7:
65  op->size = 8;
67  break;
68  case 0xd6:
69  case 0x61:
70  op->size = 2;
72  break;
73  case 0x62:
75  break;
76  case 0xff:
77  op->size = 2;
78  break;
79  }
80  return op->size;
81 }
82 
84  .name = "vax",
85  .desc = "VAX code analysis plugin",
86  .license = "LGPL3",
87  .arch = "vax",
88  .esil = false,
89  .bits = 8 | 32,
90  .op = &vax_op,
91 };
92 
93 #ifndef RZ_PLUGIN_INCORE
96  .data = &rz_analysis_plugin_vax,
98 };
99 #endif
size_t len
Definition: 6502dis.c:15
#define mask()
RZ_API RzLibStruct rizin_plugin
Definition: analysis_vax.c:94
static int vax_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask)
Definition: analysis_vax.c:15
RzAnalysisPlugin rz_analysis_plugin_vax
Definition: analysis_vax.c:83
#define RZ_API
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
RzAnalysisOpMask
Definition: rz_analysis.h:439
@ RZ_ANALYSIS_OP_TYPE_CMP
Definition: rz_analysis.h:399
@ RZ_ANALYSIS_OP_TYPE_SUB
Definition: rz_analysis.h:402
@ RZ_ANALYSIS_OP_TYPE_UNK
Definition: rz_analysis.h:388
@ RZ_ANALYSIS_OP_TYPE_TRAP
Definition: rz_analysis.h:392
@ RZ_ANALYSIS_OP_TYPE_ADD
Definition: rz_analysis.h:401
@ RZ_ANALYSIS_OP_TYPE_CJMP
Definition: rz_analysis.h:373
@ RZ_ANALYSIS_OP_TYPE_DIV
Definition: rz_analysis.h:405
@ RZ_ANALYSIS_OP_TYPE_MOV
Definition: rz_analysis.h:390
@ RZ_ANALYSIS_OP_TYPE_SHL
Definition: rz_analysis.h:407
@ RZ_ANALYSIS_OP_TYPE_NOP
Definition: rz_analysis.h:389
@ RZ_ANALYSIS_OP_TYPE_XOR
Definition: rz_analysis.h:412
@ RZ_LIB_TYPE_ANALYSIS
Definition: rz_lib.h:73
#define RZ_VERSION
Definition: rz_version.h:8
const char * version
Definition: rz_analysis.h:1239
Definition: dis.c:32
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58