FreeCalypso > hg > freecalypso-reveng
comparison arm7dis/armdis.c @ 89:c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 29 Mar 2014 21:36:22 +0000 |
parents | 691551f0635b |
children | f68d8e7a904f |
comparison
equal
deleted
inserted
replaced
88:691551f0635b | 89:c5d52666d2eb |
---|---|
1 #include <sys/types.h> | 1 #include <sys/types.h> |
2 #include <stdio.h> | 2 #include <stdio.h> |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 #include <string.h> | |
5 #include <strings.h> | |
4 | 6 |
5 extern char *binfilename; | 7 extern char *binfilename; |
6 extern u_char *filemap; | 8 extern u_char *filemap; |
7 extern unsigned disasm_len, base_vma; | 9 extern unsigned disasm_len, base_vma; |
8 | 10 |
105 | 107 |
106 static void | 108 static void |
107 dataproc_tstcmp_overlay(off, word) | 109 dataproc_tstcmp_overlay(off, word) |
108 unsigned off, word; | 110 unsigned off, word; |
109 { | 111 { |
110 printf("<dataproc overlay with S=0 for tst/cmp>\n"); | 112 char msrmask[5], *cp; |
113 | |
114 if ((word & 0x0FFFFFF0) == 0x012FFF10) { | |
115 printf("bx%s\t%s\n", condition_decode[word>>28], | |
116 regnames[word&0xF]); | |
117 return; | |
118 } else if ((word & 0x0FBF0FFF) == 0x010F0000) { | |
119 printf("mrs%s\t%s, %cPSR\n", condition_decode[word>>28], | |
120 regnames[(word>>12)&0xF], word&0x400000 ? 'S' : 'C'); | |
121 return; | |
122 } else if ((word & 0x0DB0F000) == 0x0120F000) { | |
123 if (!(word & 0x02000000) && (word & 0xFF0)) { | |
124 printf("<invalid MSR>\n"); | |
125 return; | |
126 } | |
127 if (word & 0xF0000) { | |
128 cp = msrmask; | |
129 if (word & 0x80000) | |
130 *cp++ = 'f'; | |
131 if (word & 0x40000) | |
132 *cp++ = 's'; | |
133 if (word & 0x20000) | |
134 *cp++ = 'x'; | |
135 if (word & 0x10000) | |
136 *cp++ = 'c'; | |
137 *cp = '\0'; | |
138 } else | |
139 strcpy(msrmask, "null"); | |
140 printf("msr%s\t%cPSR_%s, ", condition_decode[word>>28], | |
141 word&0x400000 ? 'S' : 'C', msrmask); | |
142 dataproc_op2(word); | |
143 return; | |
144 } | |
145 printf("<invalid BX/MRS/MSR>\n"); | |
111 } | 146 } |
112 | 147 |
113 static void | 148 static void |
114 dataproc(off, word) | 149 dataproc(off, word) |
115 unsigned off, word; | 150 unsigned off, word; |