Rizin
unix-like reverse engineering framework and cli tools
analysis_amd29k.c File Reference
#include <rz_analysis.h>
#include <rz_lib.h>
#include "../../asm/arch/amd29k/amd29k.h"

Go to the source code of this file.

Functions

static char * get_reg_profile (RzAnalysis *analysis)
 
static int archinfo (RzAnalysis *a, int q)
 
static int analop (RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask)
 

Variables

RzAnalysisPlugin rz_analysis_plugin_amd29k
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ analop()

static int analop ( RzAnalysis a,
RzAnalysisOp op,
ut64  addr,
const ut8 buf,
int  len,
RzAnalysisOpMask  mask 
)
static

Definition at line 285 of file analysis_amd29k.c.

285  {
286  op->size = 4;
287  op->eob = false;
288 
289  // delayed branch is bugged as hell. disabled for now.
290 
291  amd29k_instr_t instruction = { 0 };
292  if (amd29k_instr_decode(buf, len, &instruction, a->cpu)) {
293  op->type = instruction.op_type;
294  switch (op->type) {
297  // op->delay = 1;
298  break;
301  op->fail = addr + 4;
302  // op->delay = 1;
303  break;
306  op->type = RZ_ANALYSIS_OP_TYPE_RET;
307  op->eob = true;
308  }
309  // op->delay = 1;
310  break;
312  op->eob = true;
313  // op->delay = 1;
314  break;
315  default:
316  op->delay = 0;
317  break;
318  }
319  }
320 
321  return op->size;
322 }
size_t len
Definition: 6502dis.c:15
bool amd29k_instr_decode(const ut8 *buffer, const ut32 buffer_size, amd29k_instr_t *instruction, const char *cpu)
Definition: amd29k.c:435
bool amd29k_instr_is_ret(amd29k_instr_t *instruction)
Definition: amd29k.c:473
ut64 amd29k_instr_jump(ut64 address, amd29k_instr_t *instruction)
Definition: amd29k.c:480
voidpf void * buf
Definition: ioapi.h:138
@ RZ_ANALYSIS_OP_TYPE_ICALL
Definition: rz_analysis.h:381
@ RZ_ANALYSIS_OP_TYPE_JMP
Definition: rz_analysis.h:368
@ RZ_ANALYSIS_OP_TYPE_CJMP
Definition: rz_analysis.h:373
@ RZ_ANALYSIS_OP_TYPE_RET
Definition: rz_analysis.h:385
#define a(i)
Definition: sha256.c:41
Definition: dis.c:32
static int addr
Definition: z80asm.c:58

References a, addr, amd29k_instr_decode(), amd29k_instr_is_ret(), amd29k_instr_jump(), len, RZ_ANALYSIS_OP_TYPE_CJMP, RZ_ANALYSIS_OP_TYPE_ICALL, RZ_ANALYSIS_OP_TYPE_JMP, and RZ_ANALYSIS_OP_TYPE_RET.

Referenced by __core_cmd_search_asm_infinite(), cmd_debug_backtrace(), print_rop(), rz_core_asm_strsearch(), rz_core_hack(), rz_core_hack_arm(), rz_core_hack_x86(), rz_core_visual_bit_editor(), rz_core_visual_esil(), and vtable_is_addr_vtable_start_msvc().

◆ archinfo()

static int archinfo ( RzAnalysis a,
int  q 
)
static

Definition at line 281 of file analysis_amd29k.c.

281  {
282  return 4;
283 }

◆ get_reg_profile()

static char* get_reg_profile ( RzAnalysis analysis)
static

Definition at line 8 of file analysis_amd29k.c.

8  {
9  const char *p =
10  "=PC pc\n"
11  "=SP gp1\n"
12  "=BP gp2\n"
13  "=SR gp3\n" // status register ??
14  "=SN gp4\n" // also for ret
15  "=A0 lr1\n" // also for ret
16  "=A1 lr2\n"
17  "=A2 lr3\n"
18  "=A3 lr4\n"
19  "=A4 lr5\n"
20  "=A5 lr6\n"
21  "=A6 lr7\n"
22  "gpr gp0 .32 0 0\n"
23  "gpr gp1 .32 8 0\n"
24  "gpr gp2 .32 16 0\n"
25  "gpr gp3 .32 24 0\n"
26  "gpr gp4 .32 32 0\n"
27  "gpr gp5 .32 40 0\n"
28  "gpr gp6 .32 48 0\n"
29  "gpr gp7 .32 56 0\n"
30  "gpr gp8 .32 64 0\n"
31  "gpr gp9 .32 72 0\n"
32  "gpr gp10 .32 80 0\n"
33  "gpr gp11 .32 88 0\n"
34  "gpr gp12 .32 96 0\n"
35  "gpr gp13 .32 104 0\n"
36  "gpr gp14 .32 112 0\n"
37  "gpr gp15 .32 120 0\n"
38  "gpr gp16 .32 128 0\n"
39  "gpr gp17 .32 136 0\n"
40  "gpr gp18 .32 144 0\n"
41  "gpr gp19 .32 152 0\n"
42  "gpr gp20 .32 160 0\n"
43  "gpr gp21 .32 168 0\n"
44  "gpr gp22 .32 176 0\n"
45  "gpr gp23 .32 184 0\n"
46  "gpr gp24 .32 192 0\n"
47  "gpr gp25 .32 200 0\n"
48  "gpr gp26 .32 208 0\n"
49  "gpr gp27 .32 216 0\n"
50  "gpr gp28 .32 224 0\n"
51  "gpr gp29 .32 232 0\n"
52  "gpr gp30 .32 240 0\n"
53  "gpr gp31 .32 248 0\n"
54  "gpr gp32 .32 256 0\n"
55  "gpr gp33 .32 264 0\n"
56  "gpr gp34 .32 272 0\n"
57  "gpr gp35 .32 280 0\n"
58  "gpr gp36 .32 288 0\n"
59  "gpr gp37 .32 296 0\n"
60  "gpr gp38 .32 304 0\n"
61  "gpr gp39 .32 312 0\n"
62  "gpr gp40 .32 320 0\n"
63  "gpr gp41 .32 328 0\n"
64  "gpr gp42 .32 336 0\n"
65  "gpr gp43 .32 344 0\n"
66  "gpr gp44 .32 352 0\n"
67  "gpr gp45 .32 360 0\n"
68  "gpr gp46 .32 368 0\n"
69  "gpr gp47 .32 376 0\n"
70  "gpr gp48 .32 384 0\n"
71  "gpr gp49 .32 392 0\n"
72  "gpr gp50 .32 400 0\n"
73  "gpr gp51 .32 408 0\n"
74  "gpr gp52 .32 416 0\n"
75  "gpr gp53 .32 424 0\n"
76  "gpr gp54 .32 432 0\n"
77  "gpr gp55 .32 440 0\n"
78  "gpr gp56 .32 448 0\n"
79  "gpr gp57 .32 456 0\n"
80  "gpr gp58 .32 464 0\n"
81  "gpr gp59 .32 472 0\n"
82  "gpr gp60 .32 480 0\n"
83  "gpr gp61 .32 488 0\n"
84  "gpr gp62 .32 496 0\n"
85  "gpr gp63 .32 504 0\n"
86  "gpr gp64 .32 512 0\n"
87  "gpr gp65 .32 520 0\n"
88  "gpr gp66 .32 528 0\n"
89  "gpr gp67 .32 536 0\n"
90  "gpr gp68 .32 544 0\n"
91  "gpr gp69 .32 552 0\n"
92  "gpr gp70 .32 560 0\n"
93  "gpr gp71 .32 568 0\n"
94  "gpr gp72 .32 576 0\n"
95  "gpr gp73 .32 584 0\n"
96  "gpr gp74 .32 592 0\n"
97  "gpr gp75 .32 600 0\n"
98  "gpr gp76 .32 608 0\n"
99  "gpr gp77 .32 616 0\n"
100  "gpr gp78 .32 624 0\n"
101  "gpr gp79 .32 632 0\n"
102  "gpr gp80 .32 640 0\n"
103  "gpr gp81 .32 648 0\n"
104  "gpr gp82 .32 656 0\n"
105  "gpr gp83 .32 664 0\n"
106  "gpr gp84 .32 672 0\n"
107  "gpr gp85 .32 680 0\n"
108  "gpr gp86 .32 688 0\n"
109  "gpr gp87 .32 696 0\n"
110  "gpr gp88 .32 704 0\n"
111  "gpr gp89 .32 712 0\n"
112  "gpr gp90 .32 720 0\n"
113  "gpr gp91 .32 728 0\n"
114  "gpr gp92 .32 736 0\n"
115  "gpr gp93 .32 744 0\n"
116  "gpr gp94 .32 752 0\n"
117  "gpr gp95 .32 760 0\n"
118  "gpr gp96 .32 768 0\n"
119  "gpr gp97 .32 776 0\n"
120  "gpr gp98 .32 784 0\n"
121  "gpr gp99 .32 792 0\n"
122  "gpr gp100 .32 800 0\n"
123  "gpr gp101 .32 808 0\n"
124  "gpr gp102 .32 816 0\n"
125  "gpr gp103 .32 824 0\n"
126  "gpr gp104 .32 832 0\n"
127  "gpr gp105 .32 840 0\n"
128  "gpr gp106 .32 848 0\n"
129  "gpr gp107 .32 856 0\n"
130  "gpr gp108 .32 864 0\n"
131  "gpr gp109 .32 872 0\n"
132  "gpr gp110 .32 880 0\n"
133  "gpr gp111 .32 888 0\n"
134  "gpr gp112 .32 896 0\n"
135  "gpr gp113 .32 904 0\n"
136  "gpr gp114 .32 912 0\n"
137  "gpr gp115 .32 920 0\n"
138  "gpr gp116 .32 928 0\n"
139  "gpr gp117 .32 936 0\n"
140  "gpr gp118 .32 944 0\n"
141  "gpr gp119 .32 952 0\n"
142  "gpr gp120 .32 960 0\n"
143  "gpr gp121 .32 968 0\n"
144  "gpr gp122 .32 976 0\n"
145  "gpr gp123 .32 984 0\n"
146  "gpr gp124 .32 992 0\n"
147  "gpr gp125 .32 1000 0\n"
148  "gpr gp126 .32 1008 0\n"
149  "gpr gp127 .32 1016 0\n"
150  "gpr lr1 .32 1024 0\n"
151  "gpr lr2 .32 1032 0\n"
152  "gpr lr3 .32 1040 0\n"
153  "gpr lr4 .32 1048 0\n"
154  "gpr lr5 .32 1056 0\n"
155  "gpr lr6 .32 1064 0\n"
156  "gpr lr7 .32 1072 0\n"
157  "gpr lr8 .32 1080 0\n"
158  "gpr lr9 .32 1088 0\n"
159  "gpr lr10 .32 1096 0\n"
160  "gpr lr11 .32 1104 0\n"
161  "gpr lr12 .32 1112 0\n"
162  "gpr lr13 .32 1120 0\n"
163  "gpr lr14 .32 1128 0\n"
164  "gpr lr15 .32 1136 0\n"
165  "gpr lr16 .32 1144 0\n"
166  "gpr lr17 .32 1152 0\n"
167  "gpr lr18 .32 1160 0\n"
168  "gpr lr19 .32 1168 0\n"
169  "gpr lr20 .32 1176 0\n"
170  "gpr lr21 .32 1184 0\n"
171  "gpr lr22 .32 1192 0\n"
172  "gpr lr23 .32 1200 0\n"
173  "gpr lr24 .32 1208 0\n"
174  "gpr lr25 .32 1216 0\n"
175  "gpr lr26 .32 1224 0\n"
176  "gpr lr27 .32 1232 0\n"
177  "gpr lr28 .32 1240 0\n"
178  "gpr lr29 .32 1248 0\n"
179  "gpr lr30 .32 1256 0\n"
180  "gpr lr31 .32 1264 0\n"
181  "gpr lr32 .32 1272 0\n"
182  "gpr lr33 .32 1280 0\n"
183  "gpr lr34 .32 1288 0\n"
184  "gpr lr35 .32 1296 0\n"
185  "gpr lr36 .32 1304 0\n"
186  "gpr lr37 .32 1312 0\n"
187  "gpr lr38 .32 1320 0\n"
188  "gpr lr39 .32 1328 0\n"
189  "gpr lr40 .32 1336 0\n"
190  "gpr lr41 .32 1344 0\n"
191  "gpr lr42 .32 1352 0\n"
192  "gpr lr43 .32 1360 0\n"
193  "gpr lr44 .32 1368 0\n"
194  "gpr lr45 .32 1376 0\n"
195  "gpr lr46 .32 1384 0\n"
196  "gpr lr47 .32 1392 0\n"
197  "gpr lr48 .32 1400 0\n"
198  "gpr lr49 .32 1408 0\n"
199  "gpr lr50 .32 1416 0\n"
200  "gpr lr51 .32 1424 0\n"
201  "gpr lr52 .32 1432 0\n"
202  "gpr lr53 .32 1440 0\n"
203  "gpr lr54 .32 1448 0\n"
204  "gpr lr55 .32 1456 0\n"
205  "gpr lr56 .32 1464 0\n"
206  "gpr lr57 .32 1472 0\n"
207  "gpr lr58 .32 1480 0\n"
208  "gpr lr59 .32 1488 0\n"
209  "gpr lr60 .32 1496 0\n"
210  "gpr lr61 .32 1504 0\n"
211  "gpr lr62 .32 1512 0\n"
212  "gpr lr63 .32 1520 0\n"
213  "gpr lr64 .32 1528 0\n"
214  "gpr lr65 .32 1536 0\n"
215  "gpr lr66 .32 1544 0\n"
216  "gpr lr67 .32 1552 0\n"
217  "gpr lr68 .32 1560 0\n"
218  "gpr lr69 .32 1568 0\n"
219  "gpr lr70 .32 1576 0\n"
220  "gpr lr71 .32 1584 0\n"
221  "gpr lr72 .32 1592 0\n"
222  "gpr lr73 .32 1600 0\n"
223  "gpr lr74 .32 1608 0\n"
224  "gpr lr75 .32 1616 0\n"
225  "gpr lr76 .32 1624 0\n"
226  "gpr lr77 .32 1632 0\n"
227  "gpr lr78 .32 1640 0\n"
228  "gpr lr79 .32 1648 0\n"
229  "gpr lr80 .32 1656 0\n"
230  "gpr lr81 .32 1664 0\n"
231  "gpr lr82 .32 1672 0\n"
232  "gpr lr83 .32 1680 0\n"
233  "gpr lr84 .32 1688 0\n"
234  "gpr lr85 .32 1696 0\n"
235  "gpr lr86 .32 1704 0\n"
236  "gpr lr87 .32 1712 0\n"
237  "gpr lr88 .32 1720 0\n"
238  "gpr lr89 .32 1728 0\n"
239  "gpr lr90 .32 1736 0\n"
240  "gpr lr91 .32 1744 0\n"
241  "gpr lr92 .32 1752 0\n"
242  "gpr lr93 .32 1760 0\n"
243  "gpr lr94 .32 1768 0\n"
244  "gpr lr95 .32 1776 0\n"
245  "gpr lr96 .32 1784 0\n"
246  "gpr lr97 .32 1792 0\n"
247  "gpr lr98 .32 1800 0\n"
248  "gpr lr99 .32 1808 0\n"
249  "gpr lr100 .32 1816 0\n"
250  "gpr lr101 .32 1824 0\n"
251  "gpr lr102 .32 1832 0\n"
252  "gpr lr103 .32 1840 0\n"
253  "gpr lr104 .32 1848 0\n"
254  "gpr lr105 .32 1856 0\n"
255  "gpr lr106 .32 1864 0\n"
256  "gpr lr107 .32 1872 0\n"
257  "gpr lr108 .32 1880 0\n"
258  "gpr lr109 .32 1888 0\n"
259  "gpr lr110 .32 1896 0\n"
260  "gpr lr111 .32 1904 0\n"
261  "gpr lr112 .32 1912 0\n"
262  "gpr lr113 .32 1920 0\n"
263  "gpr lr114 .32 1928 0\n"
264  "gpr lr115 .32 1936 0\n"
265  "gpr lr116 .32 1944 0\n"
266  "gpr lr117 .32 1952 0\n"
267  "gpr lr118 .32 1960 0\n"
268  "gpr lr119 .32 1968 0\n"
269  "gpr lr120 .32 1976 0\n"
270  "gpr lr121 .32 1984 0\n"
271  "gpr lr122 .32 1992 0\n"
272  "gpr lr123 .32 2000 0\n"
273  "gpr lr124 .32 2008 0\n"
274  "gpr lr125 .32 2016 0\n"
275  "gpr lr126 .32 2024 0\n"
276  "gpr lr127 .32 2032 0\n"
277  "gpr lr128 .32 2040 0\n";
278  return strdup(p);
279 }
void * p
Definition: libc.cpp:67
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")

References p, and strdup().

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
}
RzAnalysisPlugin rz_analysis_plugin_amd29k
@ 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 337 of file analysis_amd29k.c.

◆ rz_analysis_plugin_amd29k

RzAnalysisPlugin rz_analysis_plugin_amd29k
Initial value:
= {
.name = "amd29k",
.desc = "AMD 29k analysis",
.license = "BSD",
.esil = false,
.arch = "amd29k",
.bits = 32,
.archinfo = archinfo,
.op = &analop,
.get_reg_profile = &get_reg_profile,
}
static char * get_reg_profile(RzAnalysis *analysis)
static int archinfo(RzAnalysis *a, int q)
static int analop(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf, int len, RzAnalysisOpMask mask)

Definition at line 324 of file analysis_amd29k.c.