Rizin
unix-like reverse engineering framework and cli tools
tms320_dasm.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2014 Ilya V. Matveychikov <i.matveychikov@milabs.ru>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <stdio.h>
5 #include <string.h>
6 
7 /* public headers */
8 #include <rz_util.h>
9 #include <rz_types.h>
10 #include <sdb.h>
11 
12 /* private headers */
13 #include "tms320_dasm.h"
14 
15 #include "c55x_plus/c55plus.h"
16 
17 #ifndef get_bits
18 #define get_bits(av, af, an) (((av) >> (af)) & ((2 << (an - 1)) - 1))
19 #endif
20 
21 static inline ut16 be16(ut16 v) {
22  ut16 value = v;
23 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
24  ut8 *pv = (void *)&v;
25  value = (pv[0] << 8) | pv[1];
26 #endif
27  return value;
28 }
29 
30 static inline ut32 be24(ut32 v) {
31  ut32 value = v;
32 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
33  ut8 *pv = (void *)&v;
34  value = (pv[0] << 16) | (pv[1] << 8) | pv[2];
35 #endif
36  return value;
37 }
38 
39 /*
40  * TMS320 disassembly engine implementation
41  */
42 
44  ut32 temp;
45  insn_flag_t *flag;
46 
47  if (!dasm->insn->f_list) {
48  return 1;
49  }
50 
51  for (flag = dasm->insn->f_list; !f_list_last(flag); flag++) {
52  switch (flag->v) {
53  case TMS320_FLAG_E:
54  temp = get_bits(dasm->opcode64, flag->f, 1);
55  set_field_value(dasm, E, temp);
56  break;
57  case TMS320_FLAG_R:
58  temp = get_bits(dasm->opcode64, flag->f, 1);
59  set_field_value(dasm, R, temp);
60  break;
61  case TMS320_FLAG_U:
62  temp = get_bits(dasm->opcode64, flag->f, 1);
63  set_field_value(dasm, U, temp);
64  break;
65  case TMS320_FLAG_u:
66  temp = get_bits(dasm->opcode64, flag->f, 1);
67  set_field_value(dasm, u, temp);
68  break;
69  case TMS320_FLAG_g:
70  temp = get_bits(dasm->opcode64, flag->f, 1);
71  set_field_value(dasm, g, temp);
72  break;
73  case TMS320_FLAG_r:
74  temp = get_bits(dasm->opcode64, flag->f, 1);
75  set_field_value(dasm, r, temp);
76  break;
77  case TMS320_FLAG_t:
78  temp = get_bits(dasm->opcode64, flag->f, 1);
79  set_field_value(dasm, t, temp);
80  break;
81 
82  case TMS320_FLAG_k3:
83  temp = get_bits(dasm->opcode64, flag->f, 3);
84  set_field_value(dasm, k3, temp);
85  break;
86  case TMS320_FLAG_k4:
87  temp = get_bits(dasm->opcode64, flag->f, 4);
88  set_field_value(dasm, k4, temp);
89  break;
90  case TMS320_FLAG_k5:
91  temp = get_bits(dasm->opcode64, flag->f, 5);
92  set_field_value(dasm, k5, temp);
93  break;
94  case TMS320_FLAG_k6:
95  temp = get_bits(dasm->opcode64, flag->f, 6);
96  set_field_value(dasm, k6, temp);
97  break;
98  case TMS320_FLAG_k8:
99  temp = get_bits(dasm->opcode64, flag->f, 8);
100  set_field_value(dasm, k8, temp);
101  break;
102  case TMS320_FLAG_k12:
103  temp = get_bits(dasm->opcode64, flag->f, 12);
104  set_field_value(dasm, k12, temp);
105  break;
106  case TMS320_FLAG_k16:
107  temp = get_bits(dasm->opcode64, flag->f, 16);
108  set_field_value(dasm, k16, temp);
109  break;
110 
111  case TMS320_FLAG_l1:
112  temp = get_bits(dasm->opcode64, flag->f, 1);
113  set_field_value(dasm, l1, temp);
114  break;
115  case TMS320_FLAG_l3:
116  temp = get_bits(dasm->opcode64, flag->f, 3);
117  set_field_value(dasm, l3, temp);
118  break;
119  case TMS320_FLAG_l7:
120  temp = get_bits(dasm->opcode64, flag->f, 7);
121  set_field_value(dasm, l7, temp);
122  break;
123  case TMS320_FLAG_l16:
124  temp = get_bits(dasm->opcode64, flag->f, 16);
125  set_field_value(dasm, l16, temp);
126  break;
127 
128  case TMS320_FLAG_K8:
129  temp = get_bits(dasm->opcode64, flag->f, 8);
130  set_field_value(dasm, K8, temp);
131  break;
132  case TMS320_FLAG_K16:
133  temp = get_bits(dasm->opcode64, flag->f, 16);
134  set_field_value(dasm, K16, temp);
135  break;
136 
137  case TMS320_FLAG_L7:
138  temp = get_bits(dasm->opcode64, flag->f, 7);
139  set_field_value(dasm, L7, temp);
140  break;
141  case TMS320_FLAG_L8:
142  temp = get_bits(dasm->opcode64, flag->f, 8);
143  set_field_value(dasm, L8, temp);
144  break;
145  case TMS320_FLAG_L16:
146  temp = get_bits(dasm->opcode64, flag->f, 16);
147  set_field_value(dasm, L16, temp);
148  break;
149 
150  case TMS320_FLAG_P8:
151  temp = get_bits(dasm->opcode64, flag->f, 8);
152  set_field_value(dasm, P8, temp);
153  break;
154  case TMS320_FLAG_P24:
155  temp = get_bits(dasm->opcode64, flag->f, 24);
156  set_field_value(dasm, P24, temp);
157  break;
158 
159  case TMS320_FLAG_D16:
160  temp = get_bits(dasm->opcode64, flag->f, 16);
161  set_field_value(dasm, D16, temp);
162  break;
163 
164  case TMS320_FLAG_SHFT:
165  temp = get_bits(dasm->opcode64, flag->f, 4);
166  set_field_value(dasm, SHFT, temp);
167  break;
168  case TMS320_FLAG_SHIFTW:
169  temp = get_bits(dasm->opcode64, flag->f, 6);
170  set_field_value(dasm, SHIFTW, temp);
171  break;
172 
173  case TMS320_FLAG_CCCCCCC:
174  temp = get_bits(dasm->opcode64, flag->f, 7);
175  set_field_value(dasm, CCCCCCC, temp);
176  break;
178  temp = get_bits(dasm->opcode64, flag->f, 8);
179  set_field_value(dasm, AAAAAAAI, temp);
180  break;
181 
182  case TMS320_FLAG_uu:
183  temp = get_bits(dasm->opcode64, flag->f, 2);
184  set_field_value(dasm, uu, temp);
185  break;
186  case TMS320_FLAG_cc:
187  temp = get_bits(dasm->opcode64, flag->f, 2);
188  set_field_value(dasm, cc, temp);
189  break;
190  case TMS320_FLAG_ss:
191  temp = get_bits(dasm->opcode64, flag->f, 2);
192  set_field_value(dasm, ss, temp);
193  break;
194  case TMS320_FLAG_dd:
195  temp = get_bits(dasm->opcode64, flag->f, 2);
196  set_field_value(dasm, dd, temp);
197  break;
198  case TMS320_FLAG_mm:
199  temp = get_bits(dasm->opcode64, flag->f, 2);
200  set_field_value(dasm, mm, temp);
201  break;
202  case TMS320_FLAG_vv:
203  temp = get_bits(dasm->opcode64, flag->f, 2);
204  set_field_value(dasm, vv, temp);
205  break;
206  case TMS320_FLAG_tt:
207  temp = get_bits(dasm->opcode64, flag->f, 2);
208  set_field_value(dasm, tt, temp);
209  break;
210 
211  case TMS320_FLAG_XSSS:
212  temp = get_bits(dasm->opcode64, flag->f, 4);
213  set_field_value(dasm, XSSS, temp);
214  break;
215  case TMS320_FLAG_XDDD:
216  temp = get_bits(dasm->opcode64, flag->f, 4);
217  set_field_value(dasm, XDDD, temp);
218  break;
219  case TMS320_FLAG_FSSS:
220  temp = get_bits(dasm->opcode64, flag->f, 4);
221  set_field_value(dasm, FSSS, temp);
222  break;
223  case TMS320_FLAG_FDDD:
224  temp = get_bits(dasm->opcode64, flag->f, 4);
225  set_field_value(dasm, FDDD, temp);
226  break;
227  case TMS320_FLAG_XACS:
228  temp = get_bits(dasm->opcode64, flag->f, 4);
229  set_field_value(dasm, XACS, temp);
230  break;
231  case TMS320_FLAG_XACD:
232  temp = get_bits(dasm->opcode64, flag->f, 4);
233  set_field_value(dasm, XACD, temp);
234  break;
235 
236  case TMS320_FLAG_SS:
237  temp = get_bits(dasm->opcode64, flag->f, 2);
238  if (!field_valid(dasm, SS)) {
239  set_field_value(dasm, SS, temp);
240  } else {
241  set_field_value(dasm, SS2, temp);
242  }
243  break;
244  case TMS320_FLAG_DD:
245  temp = get_bits(dasm->opcode64, flag->f, 2);
246  if (!field_valid(dasm, DD)) {
247  set_field_value(dasm, DD, temp);
248  } else {
249  set_field_value(dasm, DD2, temp);
250  }
251  break;
252 
253  case TMS320_FLAG_XXX:
254  temp = get_bits(dasm->opcode64, flag->f, 3);
255  set_field_value(dasm, Xmem_reg, temp);
256  break;
257  case TMS320_FLAG_MMM:
258  temp = get_bits(dasm->opcode64, flag->f, 3);
259  if (!field_valid(dasm, Xmem_mmm)) {
260  set_field_value(dasm, Xmem_mmm, temp);
261  } else {
262  set_field_value(dasm, Ymem_mmm, temp);
263  }
264  break;
265  case TMS320_FLAG_Y:
266  temp = get_bits(dasm->opcode64, flag->f, 1) << 0;
267  if (!field_valid(dasm, Ymem_reg)) {
268  set_field_value(dasm, Ymem_reg, temp);
269  } else {
270  field_value(dasm, Ymem_reg) |= temp;
271  }
272  break;
273  case TMS320_FLAG_YY:
274  temp = get_bits(dasm->opcode64, flag->f, 2) << 1;
275  if (!field_valid(dasm, Ymem_reg)) {
276  set_field_value(dasm, Ymem_reg, temp);
277  } else {
278  field_value(dasm, Ymem_reg) |= temp;
279  }
280  break;
281 
282  default:
283  printf("TODO: unknown opcode flag %02x\n", flag->v);
284  return 0;
285  }
286  }
287 
288  return 1;
289 }
290 
292  insn_mask_t *mask;
293 
294  if (!dasm->insn->m_list) {
295  return 1;
296  }
297 
298  for (mask = dasm->insn->m_list; !m_list_last(mask); mask++) {
299  /* match bits in range [f, f + n] with mask's value */
300  if (get_bits(dasm->opcode64, mask->f, mask->n) != mask->v) {
301  return 0;
302  }
303  }
304 
305  return 1;
306 }
307 
308 int vreplace(char *string, const char *token, const char *fmt, va_list args) {
309  char data[64];
310  char *pos;
311 
312  pos = strstr(string, token);
313  if (!pos) {
314  return 0;
315  }
316 
317  vsnprintf(data, sizeof(data), fmt, args);
318 
319  memmove(pos + strlen(data), pos + strlen(token), strlen(pos + strlen(token)) + 1);
320  memmove(pos, data, strlen(data));
321 
322  return 1;
323 }
324 
325 int replace(char *string, const char *token, const char *fmt, ...) {
326  int result;
327  va_list args;
328 
329  va_start(args, fmt);
330  result = vreplace(string, token, fmt, args);
331  va_end(args);
332 
333  return result;
334 }
335 
336 void substitute(char *string, const char *token, const char *fmt, ...) {
337  int result;
338  va_list args;
339 
340  do {
341  va_start(args, fmt);
342  result = vreplace(string, token, fmt, args);
343  va_end(args);
344  } while (result);
345 }
346 
347 const char *get_xreg_str(ut8 key, char *str) {
348  static const char *table[16] = {
349  "ac0",
350  "ac1",
351  "ac2",
352  "ac3",
353  "xsp",
354  "xssp",
355  "xdp",
356  "xcdp",
357  "xar0",
358  "xar1",
359  "xar2",
360  "xar3",
361  "xar4",
362  "xar5",
363  "xar6",
364  "xar7",
365  };
366 
367  return table[key & 15];
368 }
369 
370 const char *get_freg_str(ut8 key, char *str) {
371  static const char *table[16] = {
372  "ac0",
373  "ac1",
374  "ac2",
375  "ac3",
376  "t0",
377  "t1",
378  "t2",
379  "t3",
380  "ar0",
381  "ar1",
382  "ar2",
383  "ar3",
384  "ar4",
385  "ar5",
386  "ar6",
387  "ar7",
388  };
389 
390  return table[key & 15];
391 }
392 
393 const char *get_swap_str(ut8 key, char *str) {
394  switch (key) {
395  case 0: return "swap ac0, ac2";
396  case 1: return "swap ac1, ac3";
397  case 4: return "swap t0, t2";
398  case 5: return "swap t1, t3";
399  case 8: return "swap ar0, ar2";
400  case 9: return "swap ar1, ar3";
401  case 12: return "swap ar4, t0";
402  case 13: return "swap ar5, t1";
403  case 14: return "swap ar6, t2";
404  case 15: return "swap ar7, t3";
405  case 16: return "swapp ac0, ac2";
406  case 20: return "swapp t0, t2";
407  case 24: return "swapp ar0, ar2";
408  case 28: return "swapp ar4, t0";
409  case 30: return "swapp ar6, t2";
410  case 44: return "swap4 ar4, t0";
411  case 56: return "swap ar0, ar1";
412  }
413 
414  return "invalid";
415 }
416 
417 const char *get_relop_str(ut8 key, char *str) {
418  static const char *table[] = {
419  "==", "<", ">=", "!="
420  };
421 
422  return table[key & 3];
423 }
424 
425 const char *get_cond_str(ut8 key, char *str) {
426  /* 000 FSSS ... 101 FSSS */
427  if ((key >> 4) <= 5) {
428  static const char *op[6] = { "==", "!=", "<", "<=", ">", ">=" };
429  sprintf(str, "%s %s 0", get_freg_str(key & 15, NULL), op[(key >> 4) & 7]);
430  return str;
431  }
432 
433  /* 110 00SS */
434  if ((key >> 2) == 0x18) {
435  sprintf(str, "overflow(ac%d)", key & 3);
436  return str;
437  }
438 
439  /* 111 00SS */
440  if ((key >> 2) == 0x1C) {
441  sprintf(str, "!overflow(ac%d)", key & 3);
442  return str;
443  }
444 
445  switch (key) {
446  case 0x64: return "tc1";
447  case 0x65: return "tc2";
448  case 0x66: return "carry";
449  case 0x74: return "!tc1";
450  case 0x75: return "!tc2";
451  case 0x76:
452  return "!carry";
453  /* "&" operation */
454  case 0x68: return "tc1 & tc2";
455  case 0x69: return "tc1 & !tc2";
456  case 0x6A: return "!tc1 & tc2";
457  case 0x6B:
458  return "!tc1 & !tc2";
459  /* "|" operation */
460  case 0x78: return "tc1 | tc2";
461  case 0x79: return "tc1 | !tc2";
462  case 0x7A: return "!tc1 | tc2";
463  case 0x7B:
464  return "!tc1 | !tc2";
465  /* "^" operation */
466  case 0x7C: return "tc1 ^ tc2";
467  case 0x7D: return "tc1 ^ !tc2";
468  case 0x7E: return "!tc1 ^ tc2";
469  case 0x7F: return "!tc1 ^ !tc2";
470  }
471 
472  return "invalid";
473 }
474 
475 const char *get_v_str(ut8 key, char *str) {
476  static const char *table[2] = {
477  "carry",
478  "tc2",
479  };
480 
481  return table[key & 1];
482 }
483 
484 const char *get_t_str(ut8 key, char *str) {
485  static const char *table[2] = {
486  "tc1",
487  "tc2",
488  };
489 
490  return table[key & 1];
491 }
492 
493 const char *get_cmem_str(ut8 key, char *str) {
494  static const char *table[4] = {
495  "*cdp",
496  "*cdp+",
497  "*cdp-",
498  "*(cdp+t0)",
499  };
500 
501  return table[key & 3];
502 }
503 
504 const char *get_smem_str(ut8 key, char *str) {
505  // direct memory
506 
507  if ((key & 0x01) == 0) {
508 #ifdef IDA_COMPATIBLE_MODE
509  sprintf(str, "*sp(#%Xh)", key >> 1);
510 #else
511  sprintf(str, "@0x%02X", key >> 1);
512 #endif
513  return str;
514  }
515 
516  // indirect memory
517 
518  switch (key) {
519  case 0x11: return "abs16(k16)";
520  case 0x31: return "*(k23)";
521  case 0x51: return "port(k16)";
522  case 0x71: return "*cdp";
523  case 0x91: return "*cdp+";
524  case 0xB1: return "*cdp-";
525  case 0xD1: return "*cdp(K16)";
526  case 0xF1: return "*+cdp(K16)";
527  }
528 
529  switch (key & 0x1F) {
530  case 0x01: return "*ARn";
531  case 0x03: return "*ARn+";
532  case 0x05:
533  return "*ARn-";
534  // TODO:
535  // C54CM:0 => *(ARn + T0)
536  // C54CM:1 => *(ARn + AR0)
537  case 0x07:
538  return "*(ARn + t0)";
539  // TODO:
540  // C54CM:0 => *(ARn - t0)
541  // C54CM:1 => *(ARn - AR0)
542  case 0x09:
543  return "*(ARn - t0)";
544  // TODO:
545  // C54CM:0 => *ARn(t0)
546  // C54CM:1 => *ARn(AR0)
547  case 0x0B: return "*ARn(t0)";
548  case 0x0D: return "*ARn(k16)";
549  case 0x0F:
550  return "*+ARn(k16)";
551  // TODO:
552  // ARMS:0 => *(ARn + T1)
553  // ARMS:1 => *ARn(short(1))
554  case 0x13:
555  return "*(ARn + t1)";
556  // TODO:
557  // ARMS:0 => *(ARn - T1)
558  // ARMS:1 => *ARn(short(2))
559  case 0x15:
560  return "*(ARn - t1)";
561  // TODO:
562  // ARMS:0 => *ARn(T1)
563  // ARMS:1 => *ARn(short(3))
564  case 0x17:
565  return "*ARn(t1)";
566  // TODO:
567  // ARMS:0 => *+ARn
568  // ARMS:1 => *ARn(short(4))
569  case 0x19:
570  return "*+ARn";
571  // TODO:
572  // ARMS:0 => *-ARn
573  // ARMS:1 => *ARn(short(5))
574  case 0x1B:
575  return "*-ARn";
576  // TODO:
577  // ARMS:0 => *(ARn + t0b)
578  // ARMS:1 => *ARn(short(6))
579  case 0x1D:
580  return "*(ARn + t0b)";
581  // TODO:
582  // ARMS:0 => *(arn - t0b)
583  // ARMS:1 => *arn(short(7))
584  case 0x1F: return "*(ARn - t0b)";
585  }
586 
587  return "invalid";
588 }
589 
590 const char *get_mmm_str(ut8 key, char *str) {
591  switch (key & 7) {
592  default:
593  case 0x00: return "*ARn";
594  case 0x01: return "*ARn+";
595  case 0x02:
596  return "*ARn-";
597  // TODO:
598  // C54CM:0 => *(ARn + T0)
599  // C54CM:1 => *(ARn + AR0)
600  case 0x03: return "*(ARn + t0)";
601  case 0x04:
602  return "*(ARn + t1)";
603  // TODO:
604  // C54CM:0 => *(ARn - t0)
605  // C54CM:1 => *(ARn - AR0)
606  case 0x05: return "*(ARn - t0)";
607  case 0x06:
608  return "*(ARn - t1)";
609  // TODO:
610  // C54CM:0 => *ARn(T0)
611  // C54CM:1 => *ARn(AR0)
612  case 0x07: return "*ARn(t0)";
613  };
614 }
615 
616 /*
617  * syntax decoders
618  */
619 
621  // rounding
622  if (field_valid(dasm, R)) {
623  substitute(dasm->syntax, "[r]", "%s", field_value(dasm, R) ? "r" : "");
624  }
625 
626  // unsigned
627  if (field_valid(dasm, u)) {
628  substitute(dasm->syntax, "[u]", "%s", field_value(dasm, u) ? "u" : "");
629  }
630 
631  // 40 keyword
632  if (field_valid(dasm, g)) {
633  substitute(dasm->syntax, "[40]", "%s", field_value(dasm, g) ? "40" : "");
634  }
635 
636  // T3 update
637  if (field_valid(dasm, U)) {
638  substitute(dasm->syntax, "[T3 = ]", "%s", field_value(dasm, U) ? "t3=" : "");
639  }
640 }
641 
643  char *pos;
644 
645  pos = strstr(dasm->syntax, "[(saturate]");
646  if (pos) {
647  replace(pos, "[)", ")[");
648  replace(dasm->syntax, "[(saturate]", "%s", "(saturate");
649  }
650 
651  if (field_valid(dasm, R)) {
652  pos = strstr(dasm->syntax, "[rnd(]");
653  if (pos) {
654  replace(pos, "[)", "%s", field_value(dasm, R) ? ")[" : "[");
655  replace(dasm->syntax, "[rnd(]", "%s", field_value(dasm, R) ? "rnd(" : "");
656  }
657  }
658 
659  if (field_valid(dasm, u)) {
660  pos = strstr(dasm->syntax, "[uns(]");
661  if (pos) {
662  replace(pos, "[)", "%s", field_value(dasm, u) ? ")[" : "[");
663  replace(dasm->syntax, "[uns(]", "%s", field_value(dasm, u) ? "uns(" : "");
664  }
665  }
666 
667  if (field_valid(dasm, uu)) {
668  bool parallel = !!strstr(dasm->syntax, "::");
669 
670  // first
671  replace(dasm->syntax, "[uns(]", "%s", field_value(dasm, uu) & 2 ? "uns(" : "");
672  replace(dasm->syntax, "[)]", "%s", field_value(dasm, uu) & 2 ? ")" : "");
673 
674  if (parallel) {
675  replace(dasm->syntax, "[uns(]", "%s", field_value(dasm, uu) & 2 ? "uns(" : "");
676  replace(dasm->syntax, "[)]", "%s", field_value(dasm, uu) & 2 ? ")" : "");
677  }
678 
679  // second
680  replace(dasm->syntax, "[uns(]", "%s", field_value(dasm, uu) & 1 ? "uns(" : "");
681  replace(dasm->syntax, "[)]", "%s", field_value(dasm, uu) & 1 ? ")" : "");
682 
683  if (parallel) {
684  replace(dasm->syntax, "[uns(]", "%s", field_value(dasm, uu) & 1 ? "uns(" : "");
685  replace(dasm->syntax, "[)]", "%s", field_value(dasm, uu) & 1 ? ")" : "");
686  }
687  }
688 
689  // remove rudiments
690 
691  substitute(dasm->syntax, "[]", "%s", "");
692 }
693 
695  // signed constant
696 
697  if (field_valid(dasm, K8)) {
698  substitute(dasm->syntax, "K8", "0x%02X", field_value(dasm, K8));
699  }
700  if (field_valid(dasm, K16)) {
701  substitute(dasm->syntax, "K16", "0x%04X", be16(field_value(dasm, K16)));
702  }
703 
704  // unsigned constant
705 
706  if (field_valid(dasm, k4)) {
707  substitute(dasm->syntax, "K4", "0x%01X", field_value(dasm, k4));
708  }
709  if (field_valid(dasm, k5)) {
710  substitute(dasm->syntax, "k5", "0x%02X", field_value(dasm, k5));
711  }
712  if (field_valid(dasm, k8)) {
713  substitute(dasm->syntax, "k8", "0x%02X", field_value(dasm, k8));
714  }
715 
716  if (field_valid(dasm, k12)) {
717  substitute(dasm->syntax, "k12", "0x%03X", be16(field_value(dasm, k12)));
718  }
719  if (field_valid(dasm, k16)) {
720  substitute(dasm->syntax, "k16", "0x%04X", be16(field_value(dasm, k16)));
721  }
722 
723  if (field_valid(dasm, k4) && field_valid(dasm, k3)) {
724  substitute(dasm->syntax, "k7", "0x%02X", (field_value(dasm, k3) << 4) | field_value(dasm, k4));
725  }
726  if (field_valid(dasm, k4) && field_valid(dasm, k5)) {
727  substitute(dasm->syntax, "k9", "0x%03X", (field_value(dasm, k5) << 4) | field_value(dasm, k4));
728  }
729  if (field_valid(dasm, k4) && field_valid(dasm, k8)) {
730  substitute(dasm->syntax, "k12", "0x%03X", (field_value(dasm, k8) << 4) | field_value(dasm, k4));
731  }
732 
733  // dasm address label
734 
735  if (field_valid(dasm, D16)) {
736  substitute(dasm->syntax, "D16", "0x%04X", be16(field_value(dasm, D16)));
737  }
738 
739  // immediate shift value
740 
741  if (field_valid(dasm, SHFT)) {
742  substitute(dasm->syntax, "#SHFT", "0x%01X", field_value(dasm, SHFT));
743  }
744  if (field_valid(dasm, SHIFTW)) {
745  substitute(dasm->syntax, "#SHIFTW", "0x%02X", field_value(dasm, SHIFTW));
746  }
747 }
748 
750  // program address label
751 
752  if (field_valid(dasm, L7)) {
753  substitute(dasm->syntax, "L7", "0x%02X", field_value(dasm, L7));
754  }
755  if (field_valid(dasm, L8)) {
756  substitute(dasm->syntax, "L8", "0x%02X", field_value(dasm, L8));
757  }
758  if (field_valid(dasm, L16)) {
759  substitute(dasm->syntax, "L16", "0x%04X", be16(field_value(dasm, L16)));
760  }
761 
762  // program address label
763 
764  if (field_valid(dasm, l1) && field_valid(dasm, l3)) {
765  substitute(dasm->syntax, "l4", "0x%01X", (field_value(dasm, l3) << 1) | field_value(dasm, l1));
766  }
767 
768  // program memory address
769 
770  if (field_valid(dasm, l7)) {
771  substitute(dasm->syntax, "pmad", "0x%02X", field_value(dasm, l7));
772  }
773  if (field_valid(dasm, l16)) {
774  substitute(dasm->syntax, "pmad", "0x%04X", be16(field_value(dasm, l16)));
775  }
776 
777  // program or dasm address label
778 
779  if (field_valid(dasm, P8)) {
780  substitute(dasm->syntax, "P8", "0x%02X", field_value(dasm, P8));
781  }
782  if (field_valid(dasm, P24)) {
783  substitute(dasm->syntax, "P24", "0x%06X", be24(field_value(dasm, P24)));
784  }
785 }
786 
788  char tmp[64];
789 
790  if (field_valid(dasm, k6)) {
791  substitute(dasm->syntax, "SWAP ( )", get_swap_str(field_value(dasm, k6), tmp));
792  }
793 }
794 
796  if (field_valid(dasm, cc)) {
797  substitute(dasm->syntax, "RELOP", get_relop_str(field_value(dasm, cc), NULL));
798  }
799 }
800 
802  char tmp[64];
803 
804  if (field_valid(dasm, CCCCCCC)) {
805  substitute(dasm->syntax, "cond", "%s", get_cond_str(field_value(dasm, CCCCCCC), tmp));
806  }
807 
808  substitute(dasm->syntax, "[label, ]", "");
809 }
810 
812  ut8 code = 0;
813 
814  // transition register
815 
816  if (field_valid(dasm, r)) {
817  substitute(dasm->syntax, "TRNx", "trn%d", field_value(dasm, r));
818  }
819 
820  // source and destination temporary registers
821 
822  if (field_valid(dasm, ss)) {
823  substitute(dasm->syntax, "Tx", "t%d", field_value(dasm, ss));
824  }
825 
826  if (field_valid(dasm, dd)) {
827  substitute(dasm->syntax, "Tx", "t%d", field_value(dasm, dd));
828  }
829 
830  // shifted in/out bit values
831 
832  if (field_valid(dasm, vv)) {
833  substitute(dasm->syntax, "BitIn", "%s", get_v_str(field_value(dasm, vv) >> 1, NULL));
834  substitute(dasm->syntax, "BitOut", "%s", get_v_str(field_value(dasm, vv) >> 0, NULL));
835  }
836 
837  // source and destination of CRC instruction
838 
839  if (field_valid(dasm, t)) {
840  substitute(dasm->syntax, "TCx", "%s", get_t_str(field_value(dasm, t), NULL));
841  }
842 
843  if (field_valid(dasm, tt)) {
844  substitute(dasm->syntax, "TCx", "%s", get_t_str(field_value(dasm, tt) >> 0, NULL));
845  substitute(dasm->syntax, "TCy", "%s", get_t_str(field_value(dasm, tt) >> 1, NULL));
846  }
847 
848  // source or destination accumulator or extended register
849 
850  if (field_valid(dasm, XSSS)) {
851  substitute(dasm->syntax, "xsrc", "%s", get_xreg_str(field_value(dasm, XSSS), NULL));
852  substitute(dasm->syntax, "XAsrc", "%s", get_xreg_str(field_value(dasm, XSSS), NULL));
853  }
854 
855  if (field_valid(dasm, XDDD)) {
856  substitute(dasm->syntax, "xdst", "%s", get_xreg_str(field_value(dasm, XDDD), NULL));
857  substitute(dasm->syntax, "XAdst", "%s", get_xreg_str(field_value(dasm, XDDD), NULL));
858  }
859 
860  // source or destination accumulator, auxiliary or temporary register
861 
862  if (field_valid(dasm, FSSS) && field_valid(dasm, FDDD)) {
863  if (field_value(dasm, FSSS) == field_value(dasm, FDDD)) {
864  substitute(dasm->syntax, "[src,] dst", "dst");
865  } else {
866  substitute(dasm->syntax, "[src,] dst", "src, dst");
867  }
868  }
869 
870  if (field_valid(dasm, FSSS) && field_valid(dasm, FDDD)) {
871  substitute(dasm->syntax, "src1", "%s", get_freg_str(field_value(dasm, FSSS), NULL));
872  substitute(dasm->syntax, "src2", "%s", get_freg_str(field_value(dasm, FDDD), NULL));
873 
874  substitute(dasm->syntax, "dst1", "%s", get_freg_str(field_value(dasm, FSSS), NULL));
875  substitute(dasm->syntax, "dst2", "%s", get_freg_str(field_value(dasm, FDDD), NULL));
876  }
877 
878  code &= 0;
879  code |= field_valid(dasm, FSSS) ? 0x01 : 0x00;
880  code |= field_valid(dasm, FDDD) ? 0x02 : 0x00;
881 
882  switch (code) {
883  case 0x01: // FSSS
884  substitute(dasm->syntax, "TAx", "%s", get_freg_str(field_value(dasm, FSSS), NULL));
885  break;
886  case 0x02: // FDDD
887  substitute(dasm->syntax, "TAx", "%s", get_freg_str(field_value(dasm, FDDD), NULL));
888  substitute(dasm->syntax, "TAy", "%s", get_freg_str(field_value(dasm, FDDD), NULL));
889  break;
890  case 0x03: // FSSS FDDD
891  substitute(dasm->syntax, "TAx", "%s", get_freg_str(field_value(dasm, FSSS), NULL));
892  substitute(dasm->syntax, "TAy", "%s", get_freg_str(field_value(dasm, FDDD), NULL));
893  break;
894  }
895 
896  if (field_valid(dasm, FSSS)) {
897  substitute(dasm->syntax, "src", "%s", get_freg_str(field_value(dasm, FSSS), NULL));
898  }
899 
900  if (field_valid(dasm, FDDD)) {
901  substitute(dasm->syntax, "dst", "%s", get_freg_str(field_value(dasm, FDDD), NULL));
902  }
903 
904  if (field_valid(dasm, XACS)) {
905  substitute(dasm->syntax, "XACsrc", "%s", get_xreg_str(field_value(dasm, XACS), NULL));
906  }
907 
908  if (field_valid(dasm, XACD)) {
909  substitute(dasm->syntax, "XACdst", "%s", get_xreg_str(field_value(dasm, XACD), NULL));
910  }
911 
912  // source and destination accumulator registers
913 
914  code &= 0;
915  code |= field_valid(dasm, SS) ? 0x01 : 0x00;
916  code |= field_valid(dasm, SS2) ? 0x02 : 0x00;
917  code |= field_valid(dasm, DD) ? 0x10 : 0x00;
918  code |= field_valid(dasm, DD2) ? 0x20 : 0x00;
919 
920  switch (code) {
921  case 0x01: // SS
922  substitute(dasm->syntax, "ACx", "ac%d", field_value(dasm, SS));
923  break;
924  case 0x03: // SSSS
925  substitute(dasm->syntax, "ACx", "ac%d", field_value(dasm, SS));
926  substitute(dasm->syntax, "ACy", "ac%d", field_value(dasm, SS2));
927  break;
928  case 0x11: // SS DD
929  if (field_value(dasm, SS) == field_value(dasm, DD)) {
930  substitute(dasm->syntax, "[, ACy]", "");
931  substitute(dasm->syntax, "[ACx,] ACy", "ACy");
932  } else {
933  substitute(dasm->syntax, "[, ACy]", ", ACy");
934  substitute(dasm->syntax, "[ACx,] ACy", "ACx, ACy");
935  }
936  substitute(dasm->syntax, "ACx", "ac%d", field_value(dasm, SS));
937  substitute(dasm->syntax, "ACy", "ac%d", field_value(dasm, DD));
938  break;
939  case 0x33: // SSSS DDDD
940  substitute(dasm->syntax, "ACx", "ac%d", field_value(dasm, SS));
941  substitute(dasm->syntax, "ACy", "ac%d", field_value(dasm, SS2));
942  substitute(dasm->syntax, "ACz", "ac%d", field_value(dasm, DD));
943  substitute(dasm->syntax, "ACw", "ac%d", field_value(dasm, DD2));
944  break;
945  case 0x10: // DD
946  substitute(dasm->syntax, "ACx", "ac%d", field_value(dasm, DD));
947  break;
948  case 0x30: // DDDD
949  substitute(dasm->syntax, "ACx", "ac%d", field_value(dasm, DD));
950  substitute(dasm->syntax, "ACy", "ac%d", field_value(dasm, DD2));
951  break;
952  }
953 }
954 
956  // Cmem
957 
958  if (field_valid(dasm, mm)) {
959  substitute(dasm->syntax, "Cmem", "%s", get_cmem_str(field_value(dasm, mm), NULL));
960  }
961 
962  // Xmem and Ymem
963 
964  if (field_valid(dasm, Xmem_reg) && field_valid(dasm, Xmem_mmm)) {
965  substitute(dasm->syntax, "Xmem", "%s", get_mmm_str(field_value(dasm, Xmem_mmm), NULL));
966  substitute(dasm->syntax, "ARn", "ar%d", field_value(dasm, Xmem_reg));
967  }
968 
969  if (field_valid(dasm, Ymem_reg) && field_valid(dasm, Ymem_mmm)) {
970  substitute(dasm->syntax, "Ymem", "%s", get_mmm_str(field_value(dasm, Ymem_mmm), NULL));
971  substitute(dasm->syntax, "ARn", "ar%d", field_value(dasm, Ymem_reg));
972  }
973 
974  // Lmem and Smem
975 
976  if (field_valid(dasm, AAAAAAAI)) {
977  char str[64], tmp[64];
978 
979  snprintf(tmp, sizeof(tmp), "%s", get_smem_str(field_value(dasm, AAAAAAAI), str));
980 
981  if (field_value(dasm, AAAAAAAI) & 1) {
982  if (strstr(tmp, "k16")) {
983  substitute(tmp, "k16", "0x%04X", rz_read_be16(&dasm->stream + dasm->length));
984  dasm->length += 2;
985  } else if (strstr(tmp, "k23")) {
986  substitute(tmp, "k23", "0x%06X", rz_read_be24(&dasm->stream + dasm->length));
987  dasm->length += 3;
988  } else if (strstr(tmp, "K16")) {
989  substitute(tmp, "K16", "0x%04X", rz_read_be16(&dasm->stream + dasm->length));
990  dasm->length += 2;
991  }
992 
993  substitute(tmp, "ARn", "ar%d", field_value(dasm, AAAAAAAI) >> 5);
994  }
995 
996  substitute(dasm->syntax, "Smem", "%s", tmp);
997  substitute(dasm->syntax, "Lmem", "%s", tmp);
998  }
999 }
1000 
1002  switch (dasm->stream[dasm->length]) {
1003  case 0x98:
1004  // 1001 1000 - mmap
1005  break;
1006 
1007  case 0x99:
1008  // 1001 1001 - port(Smem)
1009  break;
1010  case 0x9a:
1011  // 1001 1010 - port(Smem)
1012  break;
1013 
1014  case 0x9c:
1015  // 1001 1100 - <insn>.LR
1016  set_field_value(dasm, q_lr, 1);
1017  break;
1018  case 0x9d:
1019  // 1001 1101 - <insn>.CR
1020  set_field_value(dasm, q_cr, 1);
1021  break;
1022  }
1023 }
1024 
1026  // remove odd spaces
1027 
1028  substitute(dasm->syntax, " ", "%s", " ");
1029 
1030  // add some qualifiers
1031 
1032  if (field_value(dasm, q_lr)) {
1033  replace(dasm->syntax, " ", ".lr ");
1034  }
1035  if (field_value(dasm, q_cr)) {
1036  replace(dasm->syntax, " ", ".cr ");
1037  }
1038 
1039  return dasm->insn;
1040 }
1041 
1043  dasm->length = dasm->head->size;
1044 
1045  snprintf(dasm->syntax, sizeof(dasm->syntax),
1046  field_valid(dasm, E) && field_value(dasm, E) ? "|| %s" : "%s", dasm->insn->syntax);
1047 
1048  decode_bits(dasm);
1049  decode_braces(dasm);
1050  decode_qualifiers(dasm);
1051 
1052  decode_constants(dasm);
1053  decode_addresses(dasm);
1054 
1055  decode_swap(dasm);
1056  decode_relop(dasm);
1057  decode_cond(dasm);
1058 
1059  decode_registers(dasm);
1061 
1062  return finalize(dasm);
1063 }
1064 
1066  run_f_list(dasm);
1067 
1068  if (dasm->insn->i_list) {
1069  dasm->insn = dasm->insn->i_list;
1070  while (!i_list_last(dasm->insn)) {
1071  if (run_m_list(dasm) && run_f_list(dasm)) {
1072  break;
1073  }
1074  dasm->insn++;
1075  }
1076  }
1077 
1078  if (!i_list_last(dasm->insn)) {
1079  return decode_insn(dasm);
1080  }
1081 
1082  return NULL;
1083 }
1084 
1085 static ut8 c55x_e_list[] = {
1086  0xF8,
1087  0x60, /* 0110 0lll */
1088  0xF0,
1089  0xA0, /* 1010 FDDD */
1090  0xFC,
1091  0xB0, /* 1011 00DD */
1092  0xF0,
1093  0xC0, /* 1100 FSSS */
1094  0xFC,
1095  0xBC, /* 1011 11SS */
1096  0x00,
1097  0x00,
1098 };
1099 
1101  ut8 *e_list = NULL;
1102  /* handle some exceptions */
1103 
1104  if (tms320_f_get_cpu(dasm) == TMS320_F_CPU_C55X) {
1105  e_list = c55x_e_list;
1106  }
1107  while (e_list && (e_list[0] && e_list[1])) {
1108  if ((dasm->opcode & e_list[0]) == e_list[1]) {
1109  dasm->head = ht_up_find(dasm->map, e_list[1], NULL);
1110  break;
1111  }
1112  e_list += 2;
1113  }
1114  if (!dasm->head) {
1115  dasm->head = ht_up_find(dasm->map, dasm->opcode, NULL);
1116  if (!dasm->head) {
1117  dasm->head = ht_up_find(dasm->map, (dasm->opcode & 0xfe), NULL);
1118  }
1119  }
1120  dasm->insn = dasm->head ? &dasm->head->insn : NULL;
1121  return dasm->head;
1122 }
1123 
1124 static void init_dasm(tms320_dasm_t *dasm, const ut8 *stream, int len) {
1125  strcpy(dasm->syntax, "invalid");
1126  memcpy(dasm->stream, stream, RZ_MIN(sizeof(dasm->stream), len));
1127 
1128  dasm->status = 0;
1129  dasm->length = 0;
1130 
1131  memset(&dasm->f, 0, sizeof(dasm->f));
1132 
1133  dasm->head = NULL;
1134  dasm->insn = NULL;
1135 }
1136 
1137 static int full_insn_size(tms320_dasm_t *dasm) {
1138  int qualifier_size = 0;
1139 
1140  if (field_value(dasm, q_cr)) {
1141  qualifier_size = 1;
1142  }
1143  if (field_value(dasm, q_lr)) {
1144  qualifier_size = 1;
1145  }
1146 
1147  return dasm->length + qualifier_size;
1148 }
1149 
1150 /*
1151  * TMS320 disassembly engine public interface
1152  */
1153 
1154 int tms320_dasm(tms320_dasm_t *dasm, const ut8 *stream, int len) {
1155  init_dasm(dasm, stream, len);
1156 
1158  if (lookup_insn_head(dasm) && decode_insn_head(dasm)) {
1159  if (dasm->length > len) {
1160  dasm->status |= TMS320_S_INVAL;
1161  }
1162  }
1163  } else {
1165  }
1166 
1167  if (strstr(dasm->syntax, "invalid")) {
1168  dasm->status |= TMS320_S_INVAL;
1169  }
1170 
1171  if (dasm->status & TMS320_S_INVAL) {
1172  strcpy(dasm->syntax, "invalid"), dasm->length = 1;
1173  }
1174 
1175  return full_insn_size(dasm);
1176 }
1177 
1178 // insn_head_t c55x_list[]
1179 #include "c55x/table.h"
1180 
1182  int i = 0;
1183 
1184  if (dasm->map) {
1185  /* already initialized */
1186  return 0;
1187  }
1188 
1189  dasm->map = ht_up_new0();
1190  if (!dasm->map) {
1191  return 0;
1192  }
1193  for (i = 0; i < RZ_ARRAY_SIZE(c55x_list); i++) {
1194  ht_up_insert(dasm->map, c55x_list[i].byte, &c55x_list[i]);
1195  }
1196 
1198 
1199  return 0;
1200 }
1201 
1203  if (dasm) {
1204  if (dasm->map) {
1205  ht_up_free(dasm->map);
1206  }
1207  /* avoid double free */
1208  memset(dasm, 0, sizeof(tms320_dasm_t));
1209  }
1210  return 0;
1211 }
size_t len
Definition: 6502dis.c:15
#define mask()
lzma_index ** i
Definition: index.h:629
#define R(x, b, m)
Definition: arc.h:168
int c55x_plus_disassemble(tms320_dasm_t *dasm, const ut8 *buf, int len)
Definition: c55plus.c:21
static int value
Definition: cmd_api.c:93
#define NULL
Definition: cris-opc.c:27
#define r
Definition: crypto_rc6.c:12
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
Definition: cs_driver.c:93
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
Definition: sflib.h:118
uint16_t ut16
uint32_t ut32
const char * v
Definition: dsignal.c:12
struct @667 g
voidpf stream
Definition: ioapi.h:138
snprintf
Definition: kernel.h:364
sprintf
Definition: kernel.h:365
vsnprintf
Definition: kernel.h:366
uint8_t ut8
Definition: lh5801.h:11
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
int args
Definition: mipsasm.c:18
static ut32 rz_read_be24(const void *src)
Definition: rz_endian.h:70
static ut16 rz_read_be16(const void *src)
Definition: rz_endian.h:50
#define RZ_ARRAY_SIZE(x)
Definition: rz_types.h:300
#define RZ_MIN(x, y)
Definition: inftree9.h:24
insn_head_t * head
Definition: tms320_dasm.h:115
insn_item_t * insn
Definition: tms320_dasm.h:116
struct tms320_dasm_t::@115 f
char syntax[1024]
Definition: tms320_dasm.h:127
insn_flag_t * f_list
Definition: tms320_dasm.h:89
insn_mask_t * m_list
Definition: tms320_dasm.h:88
insn_item_t * i_list
Definition: tms320_dasm.h:86
int pos
Definition: main.c:11
static insn_head_t c55x_list[]
Definition: table.h:4
static void init_dasm(tms320_dasm_t *dasm, const ut8 *stream, int len)
Definition: tms320_dasm.c:1124
int tms320_dasm_fini(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:1202
const char * get_swap_str(ut8 key, char *str)
Definition: tms320_dasm.c:393
const char * get_xreg_str(ut8 key, char *str)
Definition: tms320_dasm.c:347
int replace(char *string, const char *token, const char *fmt,...)
Definition: tms320_dasm.c:325
void decode_relop(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:795
const char * get_cmem_str(ut8 key, char *str)
Definition: tms320_dasm.c:493
void decode_braces(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:642
#define get_bits(av, af, an)
Definition: tms320_dasm.c:18
void decode_registers(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:811
void decode_bits(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:620
int run_m_list(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:291
const char * get_smem_str(ut8 key, char *str)
Definition: tms320_dasm.c:504
int run_f_list(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:43
static insn_item_t * finalize(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:1025
const char * get_relop_str(ut8 key, char *str)
Definition: tms320_dasm.c:417
int tms320_dasm_init(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:1181
int tms320_dasm(tms320_dasm_t *dasm, const ut8 *stream, int len)
Definition: tms320_dasm.c:1154
void decode_constants(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:694
void decode_swap(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:787
static ut16 be16(ut16 v)
Definition: tms320_dasm.c:21
insn_item_t * decode_insn_head(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:1065
const char * get_mmm_str(ut8 key, char *str)
Definition: tms320_dasm.c:590
const char * get_t_str(ut8 key, char *str)
Definition: tms320_dasm.c:484
void substitute(char *string, const char *token, const char *fmt,...)
Definition: tms320_dasm.c:336
const char * get_v_str(ut8 key, char *str)
Definition: tms320_dasm.c:475
void decode_addressing_modes(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:955
void decode_qualifiers(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:1001
static ut32 be24(ut32 v)
Definition: tms320_dasm.c:30
int vreplace(char *string, const char *token, const char *fmt, va_list args)
Definition: tms320_dasm.c:308
const char * get_freg_str(ut8 key, char *str)
Definition: tms320_dasm.c:370
void decode_cond(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:801
insn_item_t * decode_insn(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:1042
void decode_addresses(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:749
static ut8 c55x_e_list[]
Definition: tms320_dasm.c:1085
insn_head_t * lookup_insn_head(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:1100
static int full_insn_size(tms320_dasm_t *dasm)
Definition: tms320_dasm.c:1137
const char * get_cond_str(ut8 key, char *str)
Definition: tms320_dasm.c:425
#define f_list_last(x)
Definition: tms320_dasm.h:100
#define tms320_f_set_cpu(d, v)
Definition: tms320_dasm.h:215
#define TMS320_F_CPU_C55X_PLUS
Definition: tms320_dasm.h:211
@ TMS320_FLAG_l3
Definition: tms320_dasm.h:54
@ TMS320_FLAG_k4
Definition: tms320_dasm.h:43
@ TMS320_FLAG_SS
Definition: tms320_dasm.h:39
@ TMS320_FLAG_XSSS
Definition: tms320_dasm.h:73
@ TMS320_FLAG_XDDD
Definition: tms320_dasm.h:74
@ TMS320_FLAG_l7
Definition: tms320_dasm.h:55
@ TMS320_FLAG_FSSS
Definition: tms320_dasm.h:71
@ TMS320_FLAG_YY
Definition: tms320_dasm.h:81
@ TMS320_FLAG_FDDD
Definition: tms320_dasm.h:72
@ TMS320_FLAG_uu
Definition: tms320_dasm.h:32
@ TMS320_FLAG_k16
Definition: tms320_dasm.h:48
@ TMS320_FLAG_k12
Definition: tms320_dasm.h:47
@ TMS320_FLAG_r
Definition: tms320_dasm.h:29
@ TMS320_FLAG_E
Definition: tms320_dasm.h:24
@ TMS320_FLAG_SHIFTW
Definition: tms320_dasm.h:67
@ TMS320_FLAG_vv
Definition: tms320_dasm.h:36
@ TMS320_FLAG_mm
Definition: tms320_dasm.h:33
@ TMS320_FLAG_l16
Definition: tms320_dasm.h:56
@ TMS320_FLAG_DD
Definition: tms320_dasm.h:40
@ TMS320_FLAG_g
Definition: tms320_dasm.h:28
@ TMS320_FLAG_XXX
Definition: tms320_dasm.h:78
@ TMS320_FLAG_K8
Definition: tms320_dasm.h:50
@ TMS320_FLAG_XACD
Definition: tms320_dasm.h:76
@ TMS320_FLAG_P24
Definition: tms320_dasm.h:63
@ TMS320_FLAG_t
Definition: tms320_dasm.h:30
@ TMS320_FLAG_dd
Definition: tms320_dasm.h:38
@ TMS320_FLAG_K16
Definition: tms320_dasm.h:51
@ TMS320_FLAG_k8
Definition: tms320_dasm.h:46
@ TMS320_FLAG_cc
Definition: tms320_dasm.h:34
@ TMS320_FLAG_ss
Definition: tms320_dasm.h:37
@ TMS320_FLAG_u
Definition: tms320_dasm.h:27
@ TMS320_FLAG_L8
Definition: tms320_dasm.h:59
@ TMS320_FLAG_Y
Definition: tms320_dasm.h:80
@ TMS320_FLAG_AAAAAAAI
Definition: tms320_dasm.h:69
@ TMS320_FLAG_XACS
Definition: tms320_dasm.h:75
@ TMS320_FLAG_tt
Definition: tms320_dasm.h:35
@ TMS320_FLAG_MMM
Definition: tms320_dasm.h:79
@ TMS320_FLAG_k6
Definition: tms320_dasm.h:45
@ TMS320_FLAG_L7
Definition: tms320_dasm.h:58
@ TMS320_FLAG_k3
Definition: tms320_dasm.h:42
@ TMS320_FLAG_L16
Definition: tms320_dasm.h:60
@ TMS320_FLAG_U
Definition: tms320_dasm.h:26
@ TMS320_FLAG_D16
Definition: tms320_dasm.h:64
@ TMS320_FLAG_l1
Definition: tms320_dasm.h:53
@ TMS320_FLAG_SHFT
Definition: tms320_dasm.h:66
@ TMS320_FLAG_R
Definition: tms320_dasm.h:25
@ TMS320_FLAG_CCCCCCC
Definition: tms320_dasm.h:68
@ TMS320_FLAG_k5
Definition: tms320_dasm.h:44
@ TMS320_FLAG_P8
Definition: tms320_dasm.h:62
#define field_valid(d, name)
Definition: tms320_dasm.h:218
#define m_list_last(x)
Definition: tms320_dasm.h:95
#define set_field_value(d, name, value)
Definition: tms320_dasm.h:230
#define i_list_last(x)
Definition: tms320_dasm.h:85
#define tms320_f_get_cpu(d)
Definition: tms320_dasm.h:214
#define TMS320_F_CPU_C55X
Definition: tms320_dasm.h:210
#define TMS320_S_INVAL
Definition: tms320_dasm.h:124
@ field_value
Definition: parser.c:1972
Definition: dis.c:32
static const z80_opcode dd[]
Definition: z80_tab.h:844
#define E
Definition: zip_err_str.c:12