Rizin
unix-like reverse engineering framework and cli tools
decode_funcs.h File Reference
#include <rz_types.h>

Go to the source code of this file.

Functions

char * get_tc2_tc1 (ut32 ins_bits)
 
char * get_trans_reg (ut32 ins_bits)
 
char * get_AR_regs_class1 (ut32 ins_bits)
 
char * get_AR_regs_class2 (ut32 ins_bits, ut32 *ret_len, ut32 ins_pos, ut32 idx)
 
char * get_reg_pair (ut32 idx)
 
char * get_reg_name_3 (ut32 idx)
 
char * get_reg_name_2 (ut32 idx)
 
char * get_reg_name_1 (ut32 idx)
 
char * get_status_regs_and_bits (char *reg_arg, ut32 reg_bit)
 
char * get_reg_name_4 (ut32 idx)
 
char * get_opers (ut8 oper_byte)
 
char * get_cmp_op (ut32 idx)
 
char * get_sim_reg (char *reg_arg, ut32 ins_bits)
 

Function Documentation

◆ get_AR_regs_class1()

char* get_AR_regs_class1 ( ut32  ins_bits)

Definition at line 58 of file decode_funcs.c.

58  {
59  ut32 op = (ins_bits >> 4) & 7;
60  char *res = (char *)calloc(1, 50);
61  if (!res) {
62  return NULL;
63  }
64  switch (op) {
65  case 0:
66  sprintf(res, "*ar-%ld", (long int)ins_bits & 0xF);
67  break;
68  case 1:
69  sprintf(res, "*ar+%ld", (long int)ins_bits & 0xF);
70  break;
71  case 2:
72  sprintf(res, "*ar%ld(t0)", (long int)ins_bits & 0xF);
73  break;
74  case 3:
75  sprintf(res, "*ar%ld", (long int)ins_bits & 0xF);
76  break;
77  case 4:
78  sprintf(res, "*(ar%ld-t0)", (long int)ins_bits & 0xF);
79  break;
80  case 5:
81  sprintf(res, "*(ar%ld-t1)", (long int)ins_bits & 0xF);
82  break;
83  case 6:
84  sprintf(res, "*(ar%ld+t0)", (long int)ins_bits & 0xF);
85  break;
86  case 7:
87  sprintf(res, "*(ar%ld+t1)", (long int)ins_bits & 0xF);
88  break;
89  }
90  return res;
91 }
#define NULL
Definition: cris-opc.c:27
uint32_t ut32
sprintf
Definition: kernel.h:365
void * calloc(size_t number, size_t size)
Definition: malloc.c:102
Definition: dis.c:32

References calloc(), NULL, and sprintf.

Referenced by get_token_decoded().

◆ get_AR_regs_class2()

char* get_AR_regs_class2 ( ut32  ins_bits,
ut32 ret_len,
ut32  ins_pos,
ut32  idx 
)

Definition at line 93 of file decode_funcs.c.

93  {
94  ut8 op, op2, reg_num, type;
95  char *res = NULL;
96 
97  op = ins_bits >> 6;
98  op2 = ins_bits & 3;
99  reg_num = (ins_bits >> 2) & 0xF;
100  if (ret_len) {
101  *ret_len = 0;
102  }
103  // printf("OP1 %x OP2 0x%x %x\n", op, op2, reg_num);
104  res = malloc(50);
105  if (!res) {
106  return NULL;
107  }
108  if (op2 == 2) {
109  if (op) {
110  sprintf(res, "*ar%ld(short(#0x%lx))",
111  (long int)reg_num, (long int)idx * op);
112  } else {
113  sprintf(res, "*ar%ld", (long int)reg_num);
114  }
115  } else {
116  type = (op >> 3 | 2 * op2);
117  if (type == 6) {
118  sprintf(res, "@#0x%lx", (long int)idx * (reg_num | 16 * (op & 7)));
119  } else if (type == 7) {
120  sprintf(res, "*sp(#0x%lx)", (long int)idx * (reg_num | 16 * (op & 7)));
121  } else {
122  type = idx | 16 * op;
123  switch (type) {
124  case 0:
125  sprintf(res, "*ar%ld-", (long int)reg_num);
126  break;
127  case 1:
128  sprintf(res, "*ar%ld+", (long int)reg_num);
129  break;
130  case 2:
131  sprintf(res, "*ar%ld(t0)", (long int)reg_num);
132  break;
133  case 3:
134  sprintf(res, "*ar%ld(t1)", (long int)reg_num);
135  break;
136  case 4:
137  sprintf(res, "*(ar%ld-t0)", (long int)reg_num);
138  break;
139  case 5:
140  sprintf(res, "*(ar%ld-t1)", (long int)reg_num);
141  break;
142  case 6:
143  sprintf(res, "*(ar%ld+t0)", (long int)reg_num);
144  break;
145  case 7:
146  sprintf(res, "*(ar%ld+t1)", (long int)reg_num);
147  break;
148  case 8:
149  sprintf(res, "*-ar%ld", (long int)reg_num);
150  break;
151  case 9:
152  sprintf(res, "*+ar%ld", (long int)reg_num);
153  break;
154  case 10:
155  sprintf(res, "*ar%ld(t2)", (long int)reg_num);
156  break;
157  case 11:
158  sprintf(res, "*ar%ld(t3)", (long int)reg_num);
159  break;
160  case 12:
161  sprintf(res, "*(ar%ld-t2)", (long int)reg_num);
162  break;
163  case 13:
164  sprintf(res, "*(ar%ld-t3)", (long int)reg_num);
165  break;
166  case 14:
167  sprintf(res, "*(ar%ld+t2)", (long int)reg_num);
168  break;
169  case 15:
170  sprintf(res, "*(ar%ld+t3)", (long int)reg_num);
171  break;
172  case 16:
173  sprintf(res, "*(ar%ld-t0b)", (long int)reg_num);
174  break;
175  case 17:
176  sprintf(res, "*(ar%ld+t0b)", (long int)reg_num);
177  break;
178  case 18:
179  sprintf(res, "*ar%ld(t0<<#1)", (long int)reg_num);
180  break;
181  case 19:
182  sprintf(res, "*ar%ld(t1<<#1)", (long int)reg_num);
183  break;
184  case 23:
185  sprintf(res, "*ar%ld(xar15)", (long int)reg_num);
186  break;
187 
188  case 24:
189  case 25:
190  case 26:
191  case 27:
192  idx = get_ins_part(ins_pos, 2);
193  if (ret_len) {
194  *ret_len = 2;
195  }
196  switch (type) {
197  case 24:
198  sprintf(res, "*ar%ld(#%ld)", (long int)reg_num, (long int)op * idx);
199  break;
200  case 25:
201  sprintf(res, "*+ar%ld(#%ld)", (long int)reg_num, (long int)op * idx);
202  break;
203  case 26:
204  sprintf(res, "*abs16(#0x%lx)", (long int)idx);
205  break;
206  default:
207  sprintf(res, "*port(#0x%lx)", (long int)idx);
208  break;
209  }
210  break;
211  case 28:
212  case 29:
213  case 30:
214  idx = get_ins_part(ins_pos, 3);
215  if (ret_len) {
216  *ret_len = 3;
217  }
218  switch (type) {
219  case 28:
220  sprintf(res, "*ar%ld(#0x%lx)", (long int)reg_num, (long int)idx * op);
221  break;
222  case 29:
223  sprintf(res, "*+ar%ld(#0x%lx)", (long int)reg_num, (long int)idx * op);
224  break;
225  default:
226  sprintf(res, "*(#0x%lx)", (long int)idx);
227  break;
228  }
229 
230  break;
231  }
232  }
233  }
234 
235  return res;
236 }
ut8 op
Definition: 6502dis.c:13
ut32 get_ins_part(ut32 pos, ut32 len)
Definition: ins.c:51
uint8_t ut8
Definition: lh5801.h:11
void * malloc(size_t size)
Definition: malloc.c:123
int type
Definition: mipsasm.c:17
int idx
Definition: setup.py:197

References get_ins_part(), setup::idx, malloc(), NULL, op, sprintf, and type.

Referenced by get_token_decoded().

◆ get_cmp_op()

char* get_cmp_op ( ut32  idx)

Definition at line 1052 of file decode_funcs.c.

1052  {
1053  const char *res = NULL;
1054  switch (idx) {
1055  case 0: res = "=="; break;
1056  case 1: res = "!="; break;
1057  case 2: res = "<"; break;
1058  case 3: res = ">="; break;
1059  }
1060  return res ? strdup(res) : NULL;
1061 }
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 setup::idx, NULL, and strdup().

Referenced by get_token_decoded().

◆ get_opers()

char* get_opers ( ut8  oper_byte)

Definition at line 951 of file decode_funcs.c.

951  {
952  switch (oper_byte) {
953  case 0xE0u:
954  return strdup("overflow(ac0)");
955  case 0xE1u:
956  return strdup("overflow(ac1)");
957  case 0xE2u:
958  return strdup("overflow(ac2)");
959  case 0xE3u:
960  return strdup("overflow(ac3)");
961  case 0xE4u:
962  return strdup("tc1");
963  case 0xE5u:
964  return strdup("tc2");
965  case 0xE6u:
966  return strdup("carry");
967  case 0xE7u:
968  return strdup("overflow(govf)");
969  case 0xE8u:
970  return strdup("tc1 & tc2");
971  case 0xE9u:
972  return strdup("tc1 & !tc2");
973  case 0xEAu:
974  return strdup("!tc1 & tc2");
975  case 0xEBu:
976  return strdup("!tc1 & !tc2");
977  case 0xECu:
978  return strdup("word_mode");
979  case 0xEDu:
980  return strdup("byte_mode");
981  case 0xF0u:
982  return strdup("!overflow(ac0)");
983  case 0xF1u:
984  return strdup("!overflow(ac1)");
985  case 0xF2u:
986  return strdup("!overflow(ac2)");
987  case 0xF3u:
988  return strdup("!overflow(ac3)");
989  case 0xF4u:
990  return strdup("!tc1");
991  case 0xF5u:
992  return strdup("!tc2");
993  case 0xF6u:
994  return strdup("!carry");
995  case 0xF7u:
996  return strdup("!overflow(govf)");
997  case 0xF8u:
998  return strdup("tc1 | tc2");
999  case 0xF9u:
1000  return strdup("tc1 | !tc2");
1001  case 0xFAu:
1002  return strdup("!tc1 | tc2");
1003  case 0xFBu:
1004  return strdup("!tc1 | !tc2");
1005  case 0xFCu:
1006  return strdup("tc1 ^ tc2");
1007  case 0xFDu:
1008  return strdup("tc1 ^ !tc2");
1009  case 0xFEu:
1010  return strdup("!tc1 ^ tc2");
1011  case 0xFFu:
1012  return strdup("!tc1 ^ !tc2");
1013  default: {
1014  ut8 oper_type = oper_byte >> 5;
1015  if (oper_type != 6) {
1016  char *reg_name = get_reg_name_4(oper_byte & 0x1F);
1017  switch (oper_type) {
1018  case 1u:
1019  return strcat_dup(reg_name, " != #0", 1);
1020  case 0u:
1021  return strcat_dup(reg_name, " == #0", 1);
1022  case 2u:
1023  return strcat_dup(reg_name, " < #0", 1);
1024  case 3u:
1025  return strcat_dup(reg_name, " >= #0", 1);
1026  case 4u:
1027  return strcat_dup(reg_name, " > #0", 1);
1028  case 5u:
1029  return strcat_dup(reg_name, " <= #0", 1);
1030  default:
1031  free(reg_name);
1032  return NULL;
1033  }
1034  }
1035  char *reg_name = get_reg_name_1((oper_byte & 0xF) + 128);
1036  oper_type = (oper_byte >> 4) - 12;
1037  if (oper_type) {
1038  if (oper_type != 1) {
1039  free(reg_name);
1040  return NULL;
1041  }
1042  return strcat_dup(reg_name, " != #0", 1);
1043  } else {
1044  // coverity may complain but strcat_dup set to null
1045  // reg_name when free
1046  return strcat_dup(reg_name, " == #0", 1);
1047  }
1048  }
1049  }
1050 }
char * get_reg_name_4(ut32 idx)
Definition: decode_funcs.c:859
char * get_reg_name_1(ut32 idx)
Definition: decode_funcs.c:389
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
char * strcat_dup(char *s1, char *s2, st32 n_free)
Definition: utils.c:12

References free(), get_reg_name_1(), get_reg_name_4(), NULL, strcat_dup(), and strdup().

Referenced by get_token_decoded().

◆ get_reg_name_1()

char* get_reg_name_1 ( ut32  idx)

Definition at line 389 of file decode_funcs.c.

389  {
390  char *res = NULL;
391 
392  switch (idx) {
393  case 0: res = "ac0"; break;
394  case 1: res = "ac1"; break;
395  case 2: res = "ac2"; break;
396  case 3: res = "ac3"; break;
397  case 4: res = "ac4"; break;
398  case 5: res = "ac5"; break;
399  case 6: res = "ac6"; break;
400  case 7: res = "ac7"; break;
401  case 8: res = "ac8"; break;
402  case 9: res = "ac9"; break;
403  case 10: res = "ac10"; break;
404  case 11: res = "ac11"; break;
405  case 12: res = "ac12"; break;
406  case 13: res = "ac13"; break;
407  case 14: res = "ac14"; break;
408  case 15: res = "ac15"; break;
409  case 16: res = "ac16"; break;
410  case 17: res = "ac17"; break;
411  case 18: res = "ac18"; break;
412  case 19: res = "ac19"; break;
413  case 20: res = "ac20"; break;
414  case 21: res = "ac21"; break;
415  case 22: res = "ac22"; break;
416  case 23: res = "ac23"; break;
417  case 24: res = "ac24"; break;
418  case 25: res = "ac25"; break;
419  case 26: res = "ac26"; break;
420  case 27: res = "ac27"; break;
421  case 28: res = "ac28"; break;
422  case 29: res = "ac29"; break;
423  case 30: res = "ac30"; break;
424  case 31: res = "ac31"; break;
425  case 32: res = "ar0"; break;
426  case 33: res = "ar1"; break;
427  case 34: res = "ar2"; break;
428  case 35: res = "ar3"; break;
429  case 36: res = "ar4"; break;
430  case 37: res = "ar5"; break;
431  case 38: res = "ar6"; break;
432  case 39: res = "ar7"; break;
433  case 40: res = "ar8"; break;
434  case 41: res = "ar9"; break;
435  case 42: res = "ar10"; break;
436  case 43: res = "ar11"; break;
437  case 44: res = "ar12"; break;
438  case 45: res = "ar13"; break;
439  case 46: res = "ar14"; break;
440  case 47: res = "ar15"; break;
441  case 48: res = "t0"; break;
442  case 49: res = "t1"; break;
443  case 50: res = "t2"; break;
444  case 51: res = "t3"; break;
445  case 52: res = "ssp"; break;
446  case 53: res = "sp"; break;
447  case 54: res = "dp"; break;
448  case 56: res = "csr"; break;
449  case 57: res = "rptc"; break;
450  case 58: res = "brc0"; break;
451  case 59: res = "brc1"; break;
452  case 62: res = "config"; break;
453  case 63: res = "cpurev"; break;
454  case 64: res = "ac0.h"; break;
455  case 65: res = "ac1.h"; break;
456  case 66: res = "ac2.h"; break;
457  case 67: res = "ac3.h"; break;
458  case 68: res = "ac4.h"; break;
459  case 69: res = "ac5.h"; break;
460  case 70: res = "ac6.h"; break;
461  case 71: res = "ac7.h"; break;
462  case 72: res = "ac8.h"; break;
463  case 73: res = "ac9.h"; break;
464  case 74: res = "ac10.h"; break;
465  case 75: res = "ac11.h"; break;
466  case 76: res = "ac12.h"; break;
467  case 77: res = "ac13.h"; break;
468  case 78: res = "ac14.h"; break;
469  case 79: res = "ac15.h"; break;
470  case 80: res = "ac16.h"; break;
471  case 81: res = "ac17.h"; break;
472  case 82: res = "ac18.h"; break;
473  case 83: res = "ac19.h"; break;
474  case 84: res = "ac20.h"; break;
475  case 85: res = "ac21.h"; break;
476  case 86: res = "ac22.h"; break;
477  case 87: res = "ac23.h"; break;
478  case 88: res = "ac24.h"; break;
479  case 89: res = "ac25.h"; break;
480  case 90: res = "ac26.h"; break;
481  case 91: res = "ac27.h"; break;
482  case 92: res = "ac28.h"; break;
483  case 93: res = "ac29.h"; break;
484  case 94: res = "ac30.h"; break;
485  case 95: res = "ac31.h"; break;
486  case 96: res = "ac0.l"; break;
487  case 97: res = "ac1.l"; break;
488  case 98: res = "ac2.l"; break;
489  case 99: res = "ac3.l"; break;
490  case 100: res = "ac4.l"; break;
491  case 101: res = "ac5.l"; break;
492  case 102: res = "ac6.l"; break;
493  case 103: res = "ac7.l"; break;
494  case 104: res = "ac8.l"; break;
495  case 105: res = "ac9.l"; break;
496  case 106: res = "ac10.l"; break;
497  case 107: res = "ac11.l"; break;
498  case 108: res = "ac12.l"; break;
499  case 109: res = "ac13.l"; break;
500  case 110: res = "ac14.l"; break;
501  case 111: res = "ac15.l"; break;
502  case 112: res = "ac16.l"; break;
503  case 113: res = "ac17.l"; break;
504  case 114: res = "ac18.l"; break;
505  case 115: res = "ac19.l"; break;
506  case 116: res = "ac20.l"; break;
507  case 117: res = "ac21.l"; break;
508  case 118: res = "ac22.l"; break;
509  case 119: res = "ac23.l"; break;
510  case 120: res = "ac24.l"; break;
511  case 121: res = "ac25.l"; break;
512  case 122: res = "ac26.l"; break;
513  case 123: res = "ac27.l"; break;
514  case 124: res = "ac28.l"; break;
515  case 125: res = "ac29.l"; break;
516  case 126: res = "ac30.l"; break;
517  case 127: res = "ac31.l"; break;
518  case 128: res = "xar0"; break;
519  case 129: res = "xar1"; break;
520  case 130: res = "xar2"; break;
521  case 131: res = "xar3"; break;
522  case 132: res = "xar4"; break;
523  case 133: res = "xar5"; break;
524  case 134: res = "xar6"; break;
525  case 135: res = "xar7"; break;
526  case 136: res = "xar8"; break;
527  case 137: res = "xar9"; break;
528  case 138: res = "xar10"; break;
529  case 139: res = "xar11"; break;
530  case 140: res = "xar12"; break;
531  case 141: res = "xar13"; break;
532  case 142: res = "xar14"; break;
533  case 143: res = "xar15"; break;
534  case 148: res = "xssp"; break;
535  case 149: res = "xsp"; break;
536  case 150: res = "xdp"; break;
537  case 152: res = "rsa0"; break;
538  case 153: res = "rsa1"; break;
539  case 154: res = "rea0"; break;
540  case 155: res = "rea1"; break;
541  case 156: res = "dbgpaddr"; break;
542  case 157: res = "dbgpdata"; break;
543  case 159: res = "reta"; break;
544  case 160: res = "xar0.h"; break;
545  case 161: res = "xar1.h"; break;
546  case 162: res = "xar2.h"; break;
547  case 163: res = "xar3.h"; break;
548  case 164: res = "xar4.h"; break;
549  case 165: res = "xar5.h"; break;
550  case 166: res = "xar6.h"; break;
551  case 167: res = "xar7.h"; break;
552  case 168: res = "xar8.h"; break;
553  case 169: res = "xar9.h"; break;
554  case 170: res = "xar10.h"; break;
555  case 171: res = "xar11.h"; break;
556  case 172: res = "xar12.h"; break;
557  case 173: res = "xar13.h"; break;
558  case 174: res = "xar14.h"; break;
559  case 175: res = "xar15.h"; break;
560  case 180: res = "xssp.h"; break;
561  case 181: res = "xsp.h"; break;
562  case 182: res = "xdp.h"; break;
563  case 183: res = "pdp"; break;
564  case 184: res = "bsa01"; break;
565  case 185: res = "bsa23"; break;
566  case 186: res = "bsa45"; break;
567  case 187: res = "bsa67"; break;
568  case 188: res = "bsac"; break;
569  case 189: // res = (char *)&off_42FBE8;
570  res = "bkc";
571  break;
572  case 190: res = "bk03"; break;
573  case 191: res = "bk47"; break;
574  case 192: res = "ac0.g"; break;
575  case 193: res = "ac1.g"; break;
576  case 194: res = "ac2.g"; break;
577  case 195: res = "ac3.g"; break;
578  case 196: res = "ac4.g"; break;
579  case 197: res = "ac5.g"; break;
580  case 198: res = "ac6.g"; break;
581  case 199: res = "ac7.g"; break;
582  case 200: res = "ac8.g"; break;
583  case 201: res = "ac9.g"; break;
584  case 202: res = "ac10.g"; break;
585  case 203: res = "ac11.g"; break;
586  case 204: res = "ac12.g"; break;
587  case 205: res = "ac13.g"; break;
588  case 206: res = "ac14.g"; break;
589  case 207: res = "ac15.g"; break;
590  case 208: res = "ac16.g"; break;
591  case 209: res = "ac17.g"; break;
592  case 210: res = "ac18.g"; break;
593  case 211: res = "ac19.g"; break;
594  case 212: res = "ac20.g"; break;
595  case 213: res = "ac21.g"; break;
596  case 214: res = "ac22.g"; break;
597  case 215: res = "ac23.g"; break;
598  case 216: res = "ac24.g"; break;
599  case 217: res = "ac25.g"; break;
600  case 218: res = "ac26.g"; break;
601  case 219: res = "ac27.g"; break;
602  case 220: res = "ac28.g"; break;
603  case 221: res = "ac29.g"; break;
604  case 222: res = "ac30.g"; break;
605  case 223: res = "ac31.g"; break;
606  case 224: res = "st0"; break;
607  case 225: res = "st1"; break;
608  case 226: res = "st2"; break;
609  case 227: res = "st3"; break;
610  case 228: res = "st0_55"; break;
611  case 229: res = "st1_55"; break;
612  case 231: res = "st3_55"; break;
613  case 232: res = "ier0"; break;
614  case 233: res = "ier1"; break;
615  case 234: res = "ifr0"; break;
616  case 235: res = "ifr1"; break;
617  case 236: res = "dbier0"; break;
618  case 237: res = "dbier1"; break;
619  case 238: res = "ivpd"; break;
620  case 239: res = "ivph"; break;
621  case 240: res = "rsa0.h"; break;
622  case 241: res = "rsa1.h"; break;
623  case 242: res = "rea0.h"; break;
624  case 243: res = "rea1.h"; break;
625  case 244: res = "bios"; break;
626  case 245: res = "brs1"; break;
627  case 246: res = "iir"; break;
628  case 247: res = "ber"; break;
629  case 248: res = "rsa0.l"; break;
630  case 249: res = "rsa1.l"; break;
631  case 250: res = "rea0.l"; break;
632  case 251: res = "rea1.l"; break;
633  case 252: res = "tsdr"; break;
634  default: res = NULL;
635  }
636 
637  if (res != NULL) {
638  res = strdup(res);
639  }
640 
641  return res;
642 }

References setup::idx, NULL, and strdup().

Referenced by decode_regis(), get_opers(), and get_sim_reg().

◆ get_reg_name_2()

char* get_reg_name_2 ( ut32  idx)

Definition at line 333 of file decode_funcs.c.

333  {
334  char *res = NULL;
335 
336  switch (idx) {
337  case 0: res = "ar0"; break;
338  case 1: res = "ar1"; break;
339  case 2: res = "ar2"; break;
340  case 3: res = "ar3"; break;
341  case 4: res = "ar4"; break;
342  case 5: res = "ar5"; break;
343  case 6: res = "ar6"; break;
344  case 7: res = "ar7"; break;
345  case 8: res = "ar8"; break;
346  case 9: res = "ar9"; break;
347  case 10: res = "ar10"; break;
348  case 11: res = "ar11"; break;
349  case 12: res = "ar12"; break;
350  case 13: res = "ar13"; break;
351  case 14: res = "ar14"; break;
352  case 15: res = "ar15"; break;
353  case 16: res = "t0"; break;
354  case 17: res = "t1"; break;
355  case 18: res = "t2"; break;
356  case 19: res = "t3"; break;
357  case 20: res = "ssp"; break;
358  case 21: res = "sp"; break;
359  case 22: res = "dp"; break;
360  case 32: res = "xar0"; break;
361  case 33: res = "xar1"; break;
362  case 34: res = "xar2"; break;
363  case 35: res = "xar3"; break;
364  case 36: res = "xar4"; break;
365  case 37: res = "xar5"; break;
366  case 38: res = "xar6"; break;
367  case 39: res = "xar7"; break;
368  case 40: res = "xar8"; break;
369  case 41: res = "xar9"; break;
370  case 42: res = "xar10"; break;
371  case 43: res = "xar11"; break;
372  case 44: res = "xar12"; break;
373  case 45: res = "xar13"; break;
374  case 46: res = "xar14"; break;
375  case 47: res = "xar15"; break;
376  case 52: res = "xssp"; break;
377  case 53: res = "xsp"; break;
378  case 54: res = "xdp"; break;
379  default: res = NULL;
380  }
381 
382  if (res != NULL) {
383  res = strdup(res);
384  }
385 
386  return res;
387 }

References setup::idx, NULL, and strdup().

Referenced by decode_regis().

◆ get_reg_name_3()

char* get_reg_name_3 ( ut32  idx)

Definition at line 269 of file decode_funcs.c.

269  {
270  char *res = NULL;
271 
272  switch (idx) {
273  case 0: res = "ac0"; break;
274  case 1: res = "ac1"; break;
275  case 2: res = "ac2"; break;
276  case 3: res = "ac3"; break;
277  case 4: res = "ac4"; break;
278  case 5: res = "ac5"; break;
279  case 6: res = "ac6"; break;
280  case 7: res = "ac7"; break;
281  case 8: res = "ac8"; break;
282  case 9: res = "ac9"; break;
283  case 10: res = "ac10"; break;
284  case 11: res = "ac11"; break;
285  case 12: res = "ac12"; break;
286  case 13: res = "ac13"; break;
287  case 14: res = "ac14"; break;
288  case 15: res = "ac15"; break;
289  case 16: res = "ac16"; break;
290  case 17: res = "ac17"; break;
291  case 18: res = "ac18"; break;
292  case 19: res = "ac19"; break;
293  case 20: res = "ac20"; break;
294  case 21: res = "ac21"; break;
295  case 22: res = "ac22"; break;
296  case 23: res = "ac23"; break;
297  case 24: res = "ac24"; break;
298  case 25: res = "ac25"; break;
299  case 26: res = "ac26"; break;
300  case 27: res = "ac27"; break;
301  case 28: res = "ac28"; break;
302  case 29: res = "ac29"; break;
303  case 30: res = "ac30"; break;
304  case 31: res = "ac31"; break;
305  case 32: res = "xar0"; break;
306  case 33: res = "xar1"; break;
307  case 34: res = "xar2"; break;
308  case 35: res = "xar3"; break;
309  case 36: res = "xar4"; break;
310  case 37: res = "xar5"; break;
311  case 38: res = "xar6"; break;
312  case 39: res = "xar7"; break;
313  case 40: res = "xar8"; break;
314  case 41: res = "xar9"; break;
315  case 42: res = "xar10"; break;
316  case 43: res = "xar11"; break;
317  case 44: res = "xar12"; break;
318  case 45: res = "xar13"; break;
319  case 46: res = "xar14"; break;
320  case 47: res = "xar15"; break;
321  case 52: res = "xssp"; break;
322  case 53: res = "xsp"; break;
323  case 54: res = "xdp"; break;
324  default: res = NULL;
325  }
326 
327  if (res != NULL) {
328  res = strdup(res);
329  }
330  return res;
331 }

References setup::idx, NULL, and strdup().

Referenced by decode_regis().

◆ get_reg_name_4()

char* get_reg_name_4 ( ut32  idx)

Definition at line 859 of file decode_funcs.c.

859  {
860  char *res = NULL;
861 
862  switch (idx) {
863  case 0:
864  res = "ac0";
865  break;
866  case 1:
867  res = "ac1";
868  break;
869  case 2:
870  res = "ac2";
871  break;
872  case 3:
873  res = "ac3";
874  break;
875  case 4:
876  res = "ac4";
877  break;
878  case 5:
879  res = "ac5";
880  break;
881  case 6:
882  res = "ac6";
883  break;
884  case 7:
885  res = "ac7";
886  break;
887  case 8:
888  res = "t0";
889  break;
890  case 9:
891  res = "t1";
892  break;
893  case 10:
894  res = "t2";
895  break;
896  case 11:
897  res = "t3";
898  break;
899  case 16:
900  res = "ar0";
901  break;
902  case 17:
903  res = "ar1";
904  break;
905  case 18:
906  res = "ar2";
907  break;
908  case 19:
909  res = "ar3";
910  break;
911  case 20:
912  res = "ar4";
913  break;
914  case 21:
915  res = "ar5";
916  break;
917  case 22:
918  res = "ar6";
919  break;
920  case 23:
921  res = "ar7";
922  break;
923  case 24:
924  res = "ac0.l";
925  break;
926  case 25:
927  res = "ac1.l";
928  break;
929  case 26:
930  res = "ac2.l";
931  break;
932  case 27:
933  res = "ac3.l";
934  break;
935  case 28:
936  res = "ac4.l";
937  break;
938  case 29:
939  res = "ac5.l";
940  break;
941  case 30:
942  res = "ac6.l";
943  break;
944  case 31:
945  res = "ac7.l";
946  break;
947  }
948  return res ? strdup(res) : NULL;
949 }

References setup::idx, NULL, and strdup().

Referenced by get_opers().

◆ get_reg_pair()

char* get_reg_pair ( ut32  idx)

Definition at line 238 of file decode_funcs.c.

238  {
239  char *res = NULL;
240 
241  switch (idx) {
242  case 1: res = "ac0, ac2"; break;
243  case 2: res = "ac1, ac3"; break;
244  case 3: res = "pair(ac0), pair(ac2)"; break;
245  case 4: res = "ar0, ar1"; break;
246  case 5: res = "ar0, ar2"; break;
247  case 6: res = "ar1, ar3"; break;
248  case 7: res = "pair(ar0), pair(ar2)"; break;
249  case 9: res = "t0, t2"; break;
250  case 10: res = "t1, t3"; break;
251  case 11: res = "pair(t0), pair(t2)"; break;
252  case 21: res = "ar4, t0"; break;
253  case 22: res = "ar5, t1"; break;
254  case 23: res = "pair(ar4), pair(t0)"; break;
255  case 25: res = "ar6, t2"; break;
256  case 26: res = "ar7, t3"; break;
257  case 27: res = "pair(ar6), pair(t2)"; break;
258  case 31: res = "block(ar4), block(t0)"; break;
259  default: res = NULL;
260  }
261 
262  if (res != NULL) {
263  res = strdup(res);
264  }
265 
266  return res;
267 }

References setup::idx, NULL, and strdup().

Referenced by get_token_decoded().

◆ get_sim_reg()

char* get_sim_reg ( char *  reg_arg,
ut32  ins_bits 
)

Definition at line 1063 of file decode_funcs.c.

1063  {
1064  st32 code;
1065  char *res = NULL;
1066  char *aux;
1067  code = ins_bits & 3;
1068  switch (code) {
1069  case 0:
1070  if (reg_arg && strchr(reg_arg, 'w')) {
1071  if (code == 62) {
1072  return strdup("sim0");
1073  }
1074  if (code == 63) {
1075  return strdup("sim0");
1076  }
1077  }
1078  aux = get_reg_name_1(ins_bits >> 2);
1079  res = strcat_dup("@", aux, 2);
1080  break;
1081  case 2:
1082  aux = (char *)calloc(1, 50);
1083  if (!aux) {
1084  return NULL;
1085  }
1086  sprintf(aux, "@#0x%x", code);
1087  res = aux;
1088  break;
1089  case 1:
1090  case 3:
1091  res = strdup("<reserved>");
1092  break;
1093  }
1094  return res;
1095 }
const char * code
Definition: pal.c:98
#define st32
Definition: rz_types_base.h:12
Definition: inftree9.h:24

References calloc(), code, get_reg_name_1(), NULL, sprintf, st32, strcat_dup(), and strdup().

Referenced by get_token_decoded().

◆ get_status_regs_and_bits()

char* get_status_regs_and_bits ( char *  reg_arg,
ut32  reg_bit 
)

◆ get_tc2_tc1()

char* get_tc2_tc1 ( ut32  ins_bits)

Definition at line 11 of file decode_funcs.c.

11  {
12  char *res = "tc1";
13  if (ins_bits) {
14  if (ins_bits != 1) {
15  fprintf(stderr, "Invalid instruction TC2 or TC1 (%d)\n", ins_bits);
16  return NULL;
17  }
18  res = "tc2";
19  }
20  return strdup(res);
21 }

References NULL, and strdup().

Referenced by get_token_decoded().

◆ get_trans_reg()

char* get_trans_reg ( ut32  ins_bits)

Definition at line 23 of file decode_funcs.c.

23  {
24  char *res = NULL;
25 
26  switch (ins_bits) {
27  case 6:
28  res = "trn0";
29  break;
30  case 7:
31  res = "trn1";
32  break;
33  case 4:
34  res = "trn2";
35  break;
36  case 5:
37  res = "trn3";
38  break;
39  case 2:
40  res = "trn4";
41  break;
42  case 3:
43  res = "trn5";
44  break;
45  case 0:
46  res = "trn6";
47  break;
48  case 1:
49  res = "trn7";
50  break;
51 
52  default:
53  fprintf(stderr, "Invalid transaction instruction 0x%x\n", ins_bits);
54  }
55  return res ? strdup(res) : NULL;
56 }

References NULL, and strdup().

Referenced by get_token_decoded().