Rizin
unix-like reverse engineering framework and cli tools
gbasm.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012-2020 condret <condr3t@protonmail.com>
2 // SPDX-FileCopyrightText: 2012-2020 pancake <pancake@nopcode.org>
3 // SPDX-License-Identifier: LGPL-3.0-only
4 
5 #include <rz_util.h>
6 #include <rz_types.h>
7 #include <rz_asm.h>
8 #include <string.h>
9 
10 static void str_op(char *c) {
11  if ((c[0] <= 'Z') && (c[0] >= 'A')) {
12  c[0] += 0x20;
13  }
14 }
15 
16 static int gb_reg_idx(char r) {
17  const char *rstr = "bcdehl a";
18  const char *ptr = strchr(rstr, r);
19  return ptr ? (int)(size_t)(ptr - rstr) : -1;
20 }
21 
22 static bool gb_parse_cb1(ut8 *buf, const int minlen, char *buf_asm, ut8 base) {
23  // minlen varries between 4 and 6
24  int i;
25  size_t j;
26  if (strlen(buf_asm) < minlen || minlen < 1) {
27  return false;
28  }
29  buf[0] = base;
30  char *ptr_asm = buf_asm + minlen - 1;
31  j = strlen(ptr_asm);
32  rz_str_replace_in(ptr_asm, (ut32)j, "[ ", "[", true);
33  rz_str_replace_in(ptr_asm, (ut32)j, " ]", "]", true);
34  rz_str_do_until_token(str_op, buf_asm, ' ');
35  i = gb_reg_idx(buf_asm[minlen - 1]);
36  if (i != (-1)) {
37  buf[0] |= (ut8)i;
38  return true;
39  }
40  if (!strncmp(&buf_asm[minlen - 1], "[hl]", 4)) {
41  buf[0] |= 6;
42  return true;
43  }
44  return false;
45 }
46 
47 static bool gb_parse_cb2(ut8 *buf, const int minlen, char *buf_asm, ut8 base) {
48  ut64 num;
49  int i;
50  char *p, *q;
51  if ((i = strlen(buf_asm)) < minlen) {
52  return false;
53  }
54  rz_str_replace_in(buf_asm, (ut32)i, "[ ", "[", true);
55  rz_str_replace_in(buf_asm, (ut32)i, " ]", "]", true);
56  rz_str_replace_in(buf_asm, (ut32)i, ", ", ",", true);
57  p = strchr(buf_asm, (int)' ');
58  if (!p) {
59  return false;
60  }
61  q = strchr(p, (int)',');
62  if (!q) {
63  return false;
64  }
65  q[0] = '\0';
66  if (p[1] == '\0' || q[1] == '\0') {
67  q[0] = ',';
68  return false;
69  }
70  num = rz_num_get(NULL, &p[1]);
71  q[0] = ',';
72  if (num > 7) {
73  return false;
74  }
75  buf[0] = base + (ut8)num * 8;
76  i = gb_reg_idx(q[1]);
77  if (i != -1) {
78  buf[0] |= (ut8)i;
79  return true;
80  }
81  if (strlen(q + 1) < 4) {
82  return false;
83  }
84  if (!strncmp(q + 1, "[hl]", 4)) {
85  buf[0] |= 6;
86  return true;
87  }
88  return false;
89 }
90 
91 static int gb_parse_arith1(ut8 *buf, const int minlen, char *buf_asm, ut8 base, ut8 alt) {
92  int i;
93  ut64 num;
94  if (strlen(buf_asm) < minlen) {
95  return 0;
96  }
97  buf[0] = base;
98  char *ptr_asm = buf_asm + minlen - 1;
99  i = strlen(ptr_asm);
100  rz_str_replace_in(ptr_asm, (ut32)i, "[ ", "[", true);
101  rz_str_replace_in(ptr_asm, (ut32)i, " ]", "]", true);
102  rz_str_do_until_token(str_op, buf_asm, ' ');
103  i = gb_reg_idx(buf_asm[minlen - 1]);
104  if (i != -1) {
105  buf[0] |= (ut8)i;
106  } else if (!strncmp(buf_asm + minlen - 1, "[hl]", 4)) {
107  buf[0] |= 6;
108  } else {
109  buf[0] = alt;
110  num = rz_num_get(NULL, buf_asm + minlen - 1);
111  buf[1] = (ut8)(num & 0xff);
112  return 2;
113  }
114  return 1;
115 }
116 
117 static bool gb_parse_ld1(ut8 *buf, const int minlen, char *buf_asm) {
118  int i;
119  rz_str_replace_in(buf_asm, strlen(buf_asm), ", ", ",", true);
120  if (strlen(buf_asm) < minlen) {
121  return false;
122  }
123  rz_str_do_until_token(str_op, buf_asm, '\0');
124  if (buf_asm[4] == ',') {
125  i = gb_reg_idx(buf_asm[3]);
126  if (i == (-1)) {
127  return false;
128  }
129  buf[0] = (ut8)(0x40 + (i * 8));
130  i = gb_reg_idx(buf_asm[5]);
131  if (i == -1) {
132  if (strncmp(buf_asm + 5, "[hl]", 4)) {
133  return false;
134  }
135  i = 6;
136  }
137  buf[0] |= (ut8)i;
138  return true;
139  }
140  if (!strncmp(buf_asm + 3, "[hl],", 5)) {
141  if ((i = gb_reg_idx(buf_asm[8])) == (-1)) {
142  //'ld [hl], [hl]' does not exist
143  return false;
144  }
145  buf[0] = 0x70 | (ut8)i;
146  return true;
147  }
148  return false;
149 }
150 
151 static bool gb_parse_ld2(ut8 *buf, char *buf_asm) {
152  int i;
153  ut64 num;
154  if (strlen(buf_asm) < 6) {
155  return false;
156  }
157  if (buf_asm[4] == ',') {
158  if ((i = gb_reg_idx(buf_asm[3])) == -1) {
159  return false;
160  }
161  buf[0] = 0x6 + (ut8)(i * 8);
162  num = rz_num_get(NULL, buf_asm + 5);
163  buf[1] = (ut8)(num & 0xff);
164  return true;
165  } else if (!strncmp(buf_asm + 3, "[hl],", 5)) {
166  buf[0] = 0x36;
167  num = rz_num_get(NULL, buf_asm + 8);
168  buf[1] = (ut8)(num & 0xff);
169  return true;
170  }
171  return false;
172 }
173 
174 static bool gb_parse_ld3(ut8 *buf, char *buf_asm) {
175  if (strlen(buf_asm) < 7) {
176  return false;
177  }
178  if (buf_asm[5] != ',') {
179  return false;
180  }
181 
182  const ut16 reg = (buf_asm[3] << 8) | buf_asm[4];
183  switch (reg) {
184  case 0x6263: // bc
185  buf[0] = 0x01;
186  break;
187  case 0x6465: // de
188  buf[0] = 0x11;
189  break;
190  case 0x686c: // hl
191  buf[0] = 0x21;
192  break;
193  case 0x7370: // sp
194  buf[0] = 0x31;
195  break;
196  default:
197  return false;
198  }
199 
200  const ut64 num = rz_num_get(NULL, buf_asm + 6);
201  buf[1] = num & 0xff;
202  buf[2] = (num & 0xff00) >> 8;
203  return true;
204 }
205 
206 static int gbAsm(RzAsm *a, RzAsmOp *op, const char *buf) {
207  int mn_len, j, len = 1;
208  ut32 mn = 0;
209  ut64 num;
210  size_t i;
211  if (!a || !op || !buf) {
212  return 0;
213  }
214  ut8 opbuf[4] = { 0 };
215  rz_strbuf_set(&op->buf_asm, buf);
216  char *buf_asm = rz_strbuf_get(&op->buf_asm);
217  ut32 buf_len = strlen(buf);
218  while (strstr(buf_asm, " ")) {
219  rz_str_replace_in(buf_asm, buf_len, " ", " ", true);
220  }
221  rz_str_replace_in(buf_asm, buf_len, " ,", ",", true);
222  mn_len = rz_str_do_until_token(str_op, buf_asm, ' ');
223  if (mn_len < 2 || mn_len > 4) {
224  return 0;
225  }
226  for (j = 0; j < mn_len; j++) {
227  mn = (mn << 8) | buf_asm[j];
228  }
229  switch (mn) {
230  case 0x6e6f70: // nop
231  opbuf[0] = 0x00;
232  break;
233  case 0x696e63: // inc
234  if ((i = strlen(buf_asm)) < 5) {
235  return op->size = 0;
236  }
237  rz_str_replace_in(buf_asm, (ut32)i, "[ ", "[", true);
238  rz_str_replace_in(buf_asm, (ut32)i, " ]", "]", true);
239  rz_str_do_until_token(str_op, buf_asm + 4, '\0');
240  if (buf_asm[4] == 'b') {
241  opbuf[0] = (buf_asm[5] == 'c') ? 3 : 4;
242  } else if (buf_asm[4] == 'c') {
243  opbuf[0] = 0x0c;
244  } else if (buf_asm[4] == 'd') {
245  opbuf[0] = (buf_asm[5] == 'e') ? 0x13 : 0x14;
246  } else if (buf_asm[4] == 'e') {
247  opbuf[0] = 0x1c;
248  } else if (buf_asm[4] == 'h') {
249  opbuf[0] = (buf_asm[5] == 'l') ? 0x23 : 0x24;
250  } else if (buf_asm[4] == 'l') {
251  opbuf[0] = 0x2c;
252  } else if (buf_asm[4] == 'a') {
253  opbuf[0] = 0x3c;
254  } else if (buf_asm[4] == 's' && buf_asm[5] == 'p') {
255  opbuf[0] = 0x33;
256  } else if (!strncmp(buf_asm + 4, "[hl]", 4)) {
257  opbuf[0] = 0x34;
258  } else {
259  len = 0;
260  }
261  break;
262  case 0x646563: // dec
263  if ((i = strlen(buf_asm)) < 5) {
264  return op->size = 0;
265  }
266  rz_str_replace_in(buf_asm, (ut32)i, "[ ", "[", true);
267  rz_str_replace_in(buf_asm, (ut32)i, " ]", "]", true);
268  rz_str_do_until_token(str_op, &buf_asm[4], '\0');
269  switch (buf_asm[4]) {
270  case 'b':
271  opbuf[0] = (buf_asm[5] == 'c') ? 0x0b : 0x05;
272  break;
273  case 'c':
274  opbuf[0] = 0x0d;
275  break;
276  case 'd':
277  opbuf[0] = (buf_asm[5] == 'e') ? 0x1b : 0x15;
278  break;
279  case 'e':
280  opbuf[0] = 0x1d;
281  break;
282  case 'h':
283  opbuf[0] = (buf_asm[5] == 'l') ? 0x2b : 0x25;
284  break;
285  case 'l':
286  opbuf[0] = 0x2d;
287  break;
288  case 'a':
289  opbuf[0] = 0x3d;
290  break;
291  default:
292  if (!strncmp(buf_asm + 4, "sp", 2)) {
293  opbuf[0] = 0x3b;
294  } else if (!strncmp(buf_asm, "[hl]", 4)) {
295  opbuf[0] = 0x35;
296  } else {
297  len = 0;
298  }
299  break;
300  }
301  break;
302  case 0x726c6361: // rlca
303  opbuf[0] = 0x07;
304  break;
305  case 0x72726361: // rrca
306  opbuf[0] = 0xf0;
307  break;
308  case 0x73746f70: // stop
309  opbuf[0] = 0x10;
310  break;
311  case 0x726c61: // rla
312  opbuf[0] = 0x17;
313  break;
314  case 0x727261: // rra
315  opbuf[0] = 0x1f;
316  break;
317  case 0x646161: // daa
318  opbuf[0] = 0x27;
319  break;
320  case 0x63706c: // cpl
321  opbuf[0] = 0x2f;
322  break;
323  case 0x616464: // add
324  rz_str_replace_in(buf_asm, strlen(buf_asm), ", ", ",", true);
325  if (strlen(buf_asm) < 5)
326  return op->size = 0;
327  if (buf_asm[4] == 's' && buf_asm[5] == 'p' && buf_asm[6] == ',' && buf_asm[7] != '\0') {
328  opbuf[0] = 0xe8;
329  num = rz_num_get(NULL, buf_asm + 7);
330  opbuf[1] = (ut8)(num & 0xff);
331  len = 2;
332  } else if (!strcmp(buf_asm, "hl,bc")) {
333  opbuf[0] = 0x09;
334  } else if (!strcmp(buf_asm + 4, "hl,de")) {
335  opbuf[0] = 0x19;
336  } else if (!strcmp(buf_asm + 4, "hl,hl")) {
337  opbuf[0] = 0x29;
338  } else if (!strcmp(buf_asm + 4, "hl,sp")) {
339  opbuf[0] = 0x39;
340  } else {
341  len = gb_parse_arith1(opbuf, 5, buf_asm, 0x80, 0xc6);
342  }
343  break;
344  case 0x616463: // adc
345  len = gb_parse_arith1(opbuf, 5, buf_asm, 0x88, 0xce);
346  break;
347  case 0x737562: // sub
348  len = gb_parse_arith1(opbuf, 5, buf_asm, 0x90, 0xd6);
349  break;
350  case 0x736263: // sbc
351  len = gb_parse_arith1(opbuf, 5, buf_asm, 0x98, 0xde);
352  break;
353  case 0x616e64: // and
354  len = gb_parse_arith1(opbuf, 5, buf_asm, 0xa0, 0xe6);
355  break;
356  case 0x786f72: // xor
357  len = gb_parse_arith1(opbuf, 5, buf_asm, 0xa8, 0xee);
358  break;
359  case 0x6f72: // or
360  len = gb_parse_arith1(opbuf, 4, buf_asm, 0xb0, 0xf6);
361  break;
362  case 0x6370: // cp
363  len = gb_parse_arith1(opbuf, 4, buf_asm, 0xb8, 0xfe);
364  break;
365  case 0x736366: // scf
366  opbuf[0] = 0x37;
367  break;
368  case 0x636366: // ccf
369  opbuf[0] = 0x3f;
370  break;
371  case 0x68616c74: // halt
372  opbuf[0] = 0x76;
373  break;
374  case 0x726574: // ret
375  if (strlen(buf_asm) < 5) {
376  opbuf[0] = 0xc9;
377  } else if (strlen(buf_asm) < 6) {
378  // there is no way that there can be " " - we did rz_str_replace_in
379  str_op(buf_asm + 4);
380  if (buf_asm[4] == 'z') { // ret Z
381  opbuf[0] = 0xc8;
382  } else if (buf_asm[4] == 'c') { // ret C
383  opbuf[0] = 0xd8;
384  } else {
385  return op->size = 0;
386  }
387  } else {
388  str_op(&buf_asm[4]);
389  if (buf_asm[4] != 'n') {
390  return op->size = 0;
391  }
392  str_op(&buf_asm[5]); // if (!(strlen(buf_asm) < 6)) => must be 6 or greater
393  if (buf_asm[5] == 'z') { // ret nZ
394  opbuf[0] = 0xc0;
395  } else if (buf_asm[5] == 'c') { // ret nC
396  opbuf[0] = 0xd0;
397  } else {
398  return op->size = 0;
399  }
400  }
401  break;
402  case 0x72657469: // reti
403  opbuf[0] = 0xd9;
404  break;
405  case 0x6469: // di
406  opbuf[0] = 0xf3;
407  break;
408  case 0x6569: // ei
409  opbuf[0] = 0xfb;
410  break;
411  case 0x6c64: // ld
412  i = strlen(buf_asm);
413  rz_str_replace_in(buf_asm, (ut32)i, "[ ", "[", true);
414  rz_str_replace_in(buf_asm, (ut32)i, " ]", "]", true);
415  if (!gb_parse_ld1(opbuf, 6, buf_asm)) {
416  len++;
417  if (!gb_parse_ld2(opbuf, buf_asm)) {
418  len++;
419  if (!gb_parse_ld3(opbuf, buf_asm)) {
420  len = 0;
421  }
422  }
423  }
424  break;
425  case 0x727374: // rst
426  if (strlen(buf_asm) < 5) {
427  return op->size = 0;
428  }
429  num = rz_num_get(NULL, &buf_asm[4]);
430  if ((num & 7) || ((num / 8) > 7)) {
431  return op->size = 0;
432  }
433  opbuf[0] = (ut8)((num & 0xff) + 0xc7);
434  break;
435  case 0x70757368: // push
436  if (strlen(buf_asm) < 7) {
437  return op->size = 0;
438  }
439  str_op(buf_asm + 5);
440  str_op(buf_asm + 6);
441  if (buf_asm[5] == 'b' && buf_asm[6] == 'c') {
442  opbuf[0] = 0xc5;
443  } else if (buf_asm[5] == 'd' && buf_asm[6] == 'e') {
444  opbuf[0] = 0xd5;
445  } else if (buf_asm[5] == 'h' && buf_asm[6] == 'l') {
446  opbuf[0] = 0xe5;
447  } else if (buf_asm[5] == 'a' && buf_asm[6] == 'f') {
448  opbuf[0] = 0xf5;
449  } else {
450  len = 0;
451  }
452  break;
453  case 0x706f70: // pop
454  if (strlen(buf_asm) < 6)
455  return op->size = 0;
456  str_op(&buf_asm[4]);
457  str_op(&buf_asm[5]);
458  if (buf_asm[4] == 'b' && buf_asm[5] == 'c') {
459  opbuf[0] = 0xc1;
460  } else if (buf_asm[4] == 'd' && buf_asm[5] == 'e') {
461  opbuf[0] = 0xd1;
462  } else if (buf_asm[4] == 'h' && buf_asm[5] == 'l') {
463  opbuf[0] = 0xe1;
464  } else if (buf_asm[4] == 'a' && buf_asm[5] == 'f') {
465  opbuf[0] = 0xf1;
466  } else {
467  len = 0;
468  }
469  break;
470  case 0x6a70: // jp
471  if (strlen(buf_asm) < 4) {
472  return op->size = 0;
473  }
474  {
475  char *p = strchr(buf_asm, (int)',');
476  if (!p) {
477  str_op(&buf_asm[3]);
478  str_op(&buf_asm[4]);
479  if (buf_asm[3] == 'h' && buf_asm[4] == 'l')
480  opbuf[0] = 0xe9;
481  else {
482  num = rz_num_get(NULL, &buf_asm[3]);
483  len = 3;
484  opbuf[0] = 0xc3;
485  opbuf[1] = (ut8)(num & 0xff);
486  opbuf[2] = (ut8)((num & 0xff00) >> 8);
487  }
488  } else {
489  str_op(p - 2);
490  str_op(p - 1);
491  if (*(p - 2) == 'n') {
492  if (*(p - 1) == 'z') {
493  opbuf[0] = 0xc2;
494  } else if (*(p - 1) == 'c') {
495  opbuf[0] = 0xd2;
496  } else {
497  return op->size = 0;
498  }
499  } else if (*(p - 2) == ' ') {
500  if (*(p - 1) == 'z') {
501  opbuf[0] = 0xca;
502  } else if (*(p - 1) == 'c') {
503  opbuf[0] = 0xda;
504  } else {
505  return op->size = 0;
506  }
507  } else {
508  return op->size = 0;
509  }
510  rz_str_replace_in(p, strlen(p), ", ", ",", true);
511  if (!p[0] || !p[1]) {
512  return op->size = 0;
513  }
514  num = rz_num_get(NULL, p + 1);
515  opbuf[1] = (ut8)(num & 0xff);
516  opbuf[2] = (ut8)((num & 0xff00) >> 8);
517  len = 3;
518  }
519  }
520  break;
521  case 0x6a72: // jr
522  if (strlen(buf_asm) < 4)
523  return op->size = 0;
524  {
525  char *p = strchr(buf_asm, (int)',');
526  if (!p) {
527  num = rz_num_get(NULL, &buf_asm[3]);
528  len = 2;
529  opbuf[0] = 0x18;
530  opbuf[1] = (ut8)(num & 0xff);
531  } else {
532  str_op(p - 2);
533  str_op(p - 1);
534  if (*(p - 2) == 'n') {
535  if (*(p - 1) == 'z')
536  opbuf[0] = 0x20;
537  else if (*(p - 1) == 'c')
538  opbuf[0] = 0x30;
539  else
540  return op->size = 0;
541  } else if (*(p - 2) == ' ') {
542  if (*(p - 1) == 'z')
543  opbuf[0] = 0x28;
544  else if (*(p - 1) == 'c')
545  opbuf[0] = 0x38;
546  else
547  return op->size = 0;
548  } else {
549  return op->size = 0;
550  }
551  rz_str_replace_in(p, strlen(p), ", ", ",", true);
552  if (!p[1]) {
553  return op->size = 0;
554  }
555  num = rz_num_get(NULL, p + 1);
556  opbuf[1] = (ut8)(num & 0xff);
557  len = 2;
558  }
559  }
560  break;
561  case 0x63616c6c: // call
562  if (strlen(buf_asm) < 6) {
563  return op->size = 0;
564  }
565  {
566  char *p = strchr(buf_asm, (int)',');
567  if (!p) {
568  num = rz_num_get(NULL, buf_asm + 4);
569  len = 3;
570  opbuf[0] = 0xcd;
571  opbuf[1] = (ut8)(num & 0xff);
572  opbuf[2] = (ut8)((num & 0xff00) >> 8);
573  } else {
574  str_op(p - 2);
575  str_op(p - 1);
576  if (*(p - 2) == 'n') {
577  if (*(p - 1) == 'z') {
578  opbuf[0] = 0xc4;
579  } else if (*(p - 1) == 'c') {
580  opbuf[0] = 0xd4;
581  } else {
582  return op->size = 0;
583  }
584  } else if (*(p - 2) == ' ') {
585  if (*(p - 1) == 'z') {
586  opbuf[0] = 0xcc;
587  } else if (*(p - 1) == 'c') {
588  opbuf[0] = 0xdc;
589  } else {
590  return op->size = 0;
591  }
592  } else {
593  return op->size = 0;
594  }
595  rz_str_replace_in(p, strlen(p), ", ", ",", true);
596  if (!*p || !p[1]) {
597  return op->size = 0;
598  }
599  num = rz_num_get(NULL, p + 1);
600  opbuf[1] = (ut8)(num & 0xff);
601  opbuf[2] = (ut8)((num & 0xff00) >> 8);
602  len = 3;
603  }
604  }
605  break;
606  case 0x726c63:
607  opbuf[0] = 0xcb;
608  len = gb_parse_cb1(opbuf + 1, 5, buf_asm, 0x00) ? 2 : 0;
609  break;
610  case 0x727263:
611  opbuf[0] = 0xcb;
612  len = gb_parse_cb1(opbuf + 1, 5, buf_asm, 0x08) ? 2 : 0;
613  break;
614  case 0x726c:
615  opbuf[0] = 0xcb;
616  len = gb_parse_cb1(opbuf + 1, 4, buf_asm, 0x10) ? 2 : 0;
617  break;
618  case 0x7272:
619  opbuf[0] = 0xcb;
620  len = gb_parse_cb1(opbuf + 1, 4, buf_asm, 0x18) ? 2 : 0;
621  break;
622  case 0x736c61:
623  opbuf[0] = 0xcb;
624  len = gb_parse_cb1(opbuf + 1, 5, buf_asm, 0x20) ? 2 : 0;
625  break;
626  case 0x737261:
627  opbuf[0] = 0xcb;
628  len = gb_parse_cb1(opbuf + 1, 5, buf_asm, 0x28) ? 2 : 0;
629  break;
630  case 0x73776170:
631  opbuf[0] = 0xcb;
632  len = gb_parse_cb1(opbuf + 1, 6, buf_asm, 0x30) ? 2 : 0;
633  break;
634  case 0x73726c:
635  opbuf[0] = 0xcb;
636  len = gb_parse_cb1(opbuf + 1, 6, buf_asm, 0x38) ? 2 : 0;
637  break;
638  case 0x626974:
639  opbuf[0] = 0xcb;
640  len = gb_parse_cb2(opbuf + 1, 6, buf_asm, 0x40) ? 2 : 0;
641  break;
642  case 0x726573:
643  opbuf[0] = 0xcb;
644  len = gb_parse_cb2(opbuf + 1, 6, buf_asm, 0x80) ? 2 : 0;
645  break;
646  case 0x736574:
647  opbuf[0] = 0xcb;
648  len = gb_parse_cb2(opbuf + 1, 6, buf_asm, 0xc0) ? 2 : 0;
649  break;
650  default:
651  len = 0;
652  break;
653  }
654  memcpy(rz_strbuf_get(&op->buf), opbuf, sizeof(ut8) * len);
655  return op->size = len;
656 }
size_t len
Definition: 6502dis.c:15
lzma_index ** i
Definition: index.h:629
static int buf_len
Definition: asm_arc.c:22
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
#define ut8
Definition: dcpu16.h:8
uint16_t ut16
uint32_t ut32
static void str_op(char *c)
Definition: gbasm.c:10
static int gb_reg_idx(char r)
Definition: gbasm.c:16
static int gb_parse_arith1(ut8 *buf, const int minlen, char *buf_asm, ut8 base, ut8 alt)
Definition: gbasm.c:91
static bool gb_parse_cb2(ut8 *buf, const int minlen, char *buf_asm, ut8 base)
Definition: gbasm.c:47
static bool gb_parse_ld3(ut8 *buf, char *buf_asm)
Definition: gbasm.c:174
static bool gb_parse_ld1(ut8 *buf, const int minlen, char *buf_asm)
Definition: gbasm.c:117
static bool gb_parse_ld2(ut8 *buf, char *buf_asm)
Definition: gbasm.c:151
static bool gb_parse_cb1(ut8 *buf, const int minlen, char *buf_asm, ut8 base)
Definition: gbasm.c:22
static int gbAsm(RzAsm *a, RzAsmOp *op, const char *buf)
Definition: gbasm.c:206
voidpf void * buf
Definition: ioapi.h:138
#define reg(n)
uint8_t ut8
Definition: lh5801.h:11
void * p
Definition: libc.cpp:67
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
Definition: sflib.h:126
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
Definition: unum.c:172
RZ_API char * rz_str_replace_in(char *str, ut32 sz, const char *key, const char *val, int g)
Definition: str.c:1288
RZ_API int rz_str_do_until_token(str_operation op, char *str, const char tok)
Definition: str.c:3219
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
Definition: strbuf.c:153
RZ_API char * rz_strbuf_get(RzStrBuf *sb)
Definition: strbuf.c:321
static int
Definition: sfsocketcall.h:114
#define c(i)
Definition: sha256.c:43
#define a(i)
Definition: sha256.c:41
Definition: dis.c:32
ut64(WINAPI *w32_GetEnabledXStateFeatures)()