Rizin
unix-like reverse engineering framework and cli tools
analysis_nios2.c File Reference
#include <string.h>
#include <rz_types.h>
#include <rz_lib.h>
#include <rz_asm.h>
#include <rz_analysis.h>

Go to the source code of this file.

Functions

static int nios2_op (RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b, int len, RzAnalysisOpMask mask)
 

Variables

RzAnalysisPlugin rz_analysis_plugin_nios2
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ nios2_op()

static int nios2_op ( RzAnalysis analysis,
RzAnalysisOp op,
ut64  addr,
const ut8 b,
int  len,
RzAnalysisOpMask  mask 
)
static

Definition at line 10 of file analysis_nios2.c.

10  {
11  if (!op) {
12  return 1;
13  }
14  op->size = 4;
15 
16  if ((b[0] & 0xff) == 0x3a) {
17  // XXX
19  } else if ((b[0] & 0xf) == 0xa) {
21  } else if ((b[0] & 0xf) == 4) {
23  } else if ((b[0] & 0xf) == 5) {
25  } else if ((b[0] & 0xf) == 6) {
26  // blt, r19, r5, 0x8023480
28  // TODO: address
29  } else if ((b[0] & 0xf) == 7) {
30  // blt, r19, r5, 0x8023480
32  // TODO: address
33  } else {
34  switch (b[0]) {
35  case 0x3a:
36  if (b[1] >= 0xa0 && b[1] <= 0xaf && b[3] == 0x3d) {
38  } else if ((b[1] >= 0xe0 && b[1] <= 0xe7) && b[2] == 0x3e && !b[3]) {
39  // nextpc ra
41  }
42  break;
43  case 0x01:
44  // jmpi
46  break;
47  case 0x00:
48  case 0x20:
49  case 0x40:
50  case 0x80:
51  case 0xc0:
52  //
54  break;
55  case 0x26:
56  // beq
57  break;
58  case 0x07:
59  case 0x47:
60  case 0x87:
61  case 0xc7:
62  // ldb
64  break;
65  case 0x0d:
66  case 0x2d:
67  case 0x4d:
68  case 0x8d:
69  case 0xcd:
70  // sth && sthio
72  break;
73  case 0x06:
74  case 0x46:
75  case 0x86:
76  case 0xc6:
77  // br
79  break;
80  }
81  }
82  return op->size;
83 }
@ RZ_ANALYSIS_OP_TYPE_LOAD
Definition: rz_analysis.h:416
@ RZ_ANALYSIS_OP_TYPE_JMP
Definition: rz_analysis.h:368
@ RZ_ANALYSIS_OP_TYPE_TRAP
Definition: rz_analysis.h:392
@ RZ_ANALYSIS_OP_TYPE_CALL
Definition: rz_analysis.h:378
@ RZ_ANALYSIS_OP_TYPE_ADD
Definition: rz_analysis.h:401
@ RZ_ANALYSIS_OP_TYPE_STORE
Definition: rz_analysis.h:415
@ RZ_ANALYSIS_OP_TYPE_CJMP
Definition: rz_analysis.h:373
@ RZ_ANALYSIS_OP_TYPE_RET
Definition: rz_analysis.h:385
#define b(i)
Definition: sha256.c:42
Definition: dis.c:32

References b, RZ_ANALYSIS_OP_TYPE_ADD, RZ_ANALYSIS_OP_TYPE_CALL, RZ_ANALYSIS_OP_TYPE_CJMP, RZ_ANALYSIS_OP_TYPE_JMP, RZ_ANALYSIS_OP_TYPE_LOAD, RZ_ANALYSIS_OP_TYPE_RET, RZ_ANALYSIS_OP_TYPE_STORE, and RZ_ANALYSIS_OP_TYPE_TRAP.

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
}
RzAnalysisPlugin rz_analysis_plugin_nios2
@ 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 at line 96 of file analysis_nios2.c.

◆ rz_analysis_plugin_nios2

RzAnalysisPlugin rz_analysis_plugin_nios2
Initial value:
= {
.name = "nios2",
.desc = "NIOS II code analysis plugin",
.license = "LGPL3",
.arch = "nios2",
.esil = false,
.bits = 32,
.op = &nios2_op,
}
static int nios2_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b, int len, RzAnalysisOpMask mask)

Definition at line 85 of file analysis_nios2.c.