annotate arm7dis/armdis.c @ 90:f68d8e7a904f

armdis: implemented decoding of multiplication instructions
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 29 Mar 2014 22:19:21 +0000
parents c5d52666d2eb
children daf69d5edb3f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <sys/types.h>
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdio.h>
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 #include <stdlib.h>
89
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
4 #include <string.h>
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
5 #include <strings.h>
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 extern char *binfilename;
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 extern u_char *filemap;
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
9 extern unsigned disasm_len, base_vma;
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 extern unsigned get_u16(), get_u32();
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
13 extern char *regnames[16], *condition_decode[16];
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
14
88
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
15 static char *dataproc_ops[16] = {"and", "eor", "sub", "rsb",
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
16 "add", "adc", "sbc", "rsc",
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
17 "tst", "teq", "cmp", "cmn",
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
18 "orr", "mov", "bic", "mvn"};
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
19 static char *shift_types[4] = {"lsl", "lsr", "asr", "ror"};
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
20
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
21 static void
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
22 arm_branch(off, word)
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
23 unsigned off, word;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
24 {
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
25 unsigned dest;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
26
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
27 dest = (word & 0x00FFFFFF) << 2;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
28 if (dest & 0x02000000)
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
29 dest |= 0xFC000000;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
30 dest += base_vma + off + 8;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
31 printf("b%s%s\t0x%x\n", word&0x1000000 ? "l" : "",
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
32 condition_decode[word>>28], dest);
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
33 }
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
34
88
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
35 static void
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
36 op2_immed(word)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
37 unsigned word;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
38 {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
39 unsigned low8, rot, val;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
40
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
41 low8 = word & 0xFF;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
42 rot = (word & 0xF00) >> 7;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
43 val = (low8 << (32 - rot)) | (low8 >> rot);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
44 if (val <= 9)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
45 printf("#%u\n", val);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
46 else
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
47 printf("#%u\t; 0x%x\n", val, val);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
48 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
49
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
50 static void
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
51 op2_regbyconst(word)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
52 unsigned word;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
53 {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
54 unsigned c, t;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
55
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
56 c = (word >> 7) & 0x1F;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
57 t = (word >> 5) & 3;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
58 if (!c) {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
59 switch (t) {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
60 case 0:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
61 printf("%s\n", regnames[word&0xF]);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
62 return;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
63 case 3:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
64 printf("%s, rrx\n", regnames[word&0xF]);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
65 return;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
66 default:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
67 c = 32;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
68 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
69 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
70 printf("%s, %s #%u\n", regnames[word&0xF], shift_types[t], c);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
71 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
72
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
73 static void
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
74 op2_regbyreg(word)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
75 unsigned word;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
76 {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
77 printf("%s, %s %s\n", regnames[word&0xF], shift_types[(word>>5)&3],
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
78 regnames[(word>>8)&0xF]);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
79 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
80
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
81 static void
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
82 op2_regshift(word)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
83 unsigned word;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
84 {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
85 if (word & 0x10)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
86 op2_regbyreg(word);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
87 else
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
88 op2_regbyconst(word);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
89 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
90
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
91 static void
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
92 dataproc_op2(word)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
93 unsigned word;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
94 {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
95 if (word & 0x02000000)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
96 op2_immed(word);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
97 else
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
98 op2_regshift(word);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
99 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
100
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
101 static void
90
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
102 dataproc_tstcmp_overlay(word)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
103 unsigned word;
88
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
104 {
89
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
105 char msrmask[5], *cp;
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
106
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
107 if ((word & 0x0FFFFFF0) == 0x012FFF10) {
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
108 printf("bx%s\t%s\n", condition_decode[word>>28],
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
109 regnames[word&0xF]);
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
110 return;
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
111 } else if ((word & 0x0FBF0FFF) == 0x010F0000) {
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
112 printf("mrs%s\t%s, %cPSR\n", condition_decode[word>>28],
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
113 regnames[(word>>12)&0xF], word&0x400000 ? 'S' : 'C');
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
114 return;
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
115 } else if ((word & 0x0DB0F000) == 0x0120F000) {
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
116 if (!(word & 0x02000000) && (word & 0xFF0)) {
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
117 printf("<invalid MSR>\n");
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
118 return;
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
119 }
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
120 if (word & 0xF0000) {
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
121 cp = msrmask;
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
122 if (word & 0x80000)
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
123 *cp++ = 'f';
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
124 if (word & 0x40000)
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
125 *cp++ = 's';
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
126 if (word & 0x20000)
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
127 *cp++ = 'x';
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
128 if (word & 0x10000)
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
129 *cp++ = 'c';
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
130 *cp = '\0';
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
131 } else
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
132 strcpy(msrmask, "null");
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
133 printf("msr%s\t%cPSR_%s, ", condition_decode[word>>28],
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
134 word&0x400000 ? 'S' : 'C', msrmask);
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
135 dataproc_op2(word);
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
136 return;
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
137 }
c5d52666d2eb armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 88
diff changeset
138 printf("<invalid BX/MRS/MSR>\n");
88
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
139 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
140
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
141 static void
90
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
142 dataproc(word)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
143 unsigned word;
88
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
144 {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
145 unsigned opc;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
146
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
147 opc = (word >> 21) & 0xF;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
148 switch (opc) {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
149 case 0:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
150 case 1:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
151 case 2:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
152 case 3:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
153 case 4:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
154 case 5:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
155 case 6:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
156 case 7:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
157 case 0xC:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
158 case 0xE:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
159 printf("%s%s%s\t%s, %s, ", dataproc_ops[opc],
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
160 condition_decode[word>>28], word&0x100000 ? "s" : "",
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
161 regnames[(word>>12)&0xF], regnames[(word>>16)&0xF]);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
162 dataproc_op2(word);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
163 return;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
164 case 0xD:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
165 case 0xF:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
166 printf("%s%s%s\t%s, ", dataproc_ops[opc],
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
167 condition_decode[word>>28], word&0x100000 ? "s" : "",
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
168 regnames[(word>>12)&0xF]);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
169 dataproc_op2(word);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
170 return;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
171 case 8:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
172 case 9:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
173 case 0xA:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
174 case 0xB:
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
175 if (word & 0x100000) {
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
176 printf("%s%s\t%s, ", dataproc_ops[opc],
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
177 condition_decode[word>>28],
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
178 regnames[(word>>16)&0xF]);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
179 dataproc_op2(word);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
180 } else
90
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
181 dataproc_tstcmp_overlay(word);
88
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
182 return;
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
183 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
184 }
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
185
90
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
186 static void
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
187 multiply(word)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
188 unsigned word;
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
189 {
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
190 if ((word & 0x0FE000F0) == 0x90)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
191 printf("mul%s%s\t%s, %s, %s\n", condition_decode[word>>28],
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
192 word&0x100000 ? "s" : "", regnames[(word>>16)&0xF],
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
193 regnames[word&0xF], regnames[(word>>8)&0xF]);
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
194 else if ((word & 0x0FE000F0) == 0x00200090)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
195 printf("mla%s%s\t%s, %s, %s, %s\n", condition_decode[word>>28],
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
196 word&0x100000 ? "s" : "", regnames[(word>>16)&0xF],
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
197 regnames[word&0xF], regnames[(word>>8)&0xF],
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
198 regnames[(word>>12)&0xF]);
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
199 else if ((word & 0x0F8000F0) == 0x00800090)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
200 printf("%c%sl%s%s\t%s, %s, %s, %s\n",
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
201 word&0x400000 ? 's' : 'u',
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
202 word&0x200000 ? "mla" : "mul",
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
203 condition_decode[word>>28],
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
204 word&0x100000 ? "s" : "",
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
205 regnames[(word>>12)&0xF], regnames[(word>>16)&0xF],
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
206 regnames[word&0xF], regnames[(word>>8)&0xF]);
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
207 else
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
208 printf("<invalid multiply>\n");
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
209 }
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
210
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
211 static void
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
212 ldr_str_ext(off, word)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
213 unsigned off, word;
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
214 {
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
215 printf("<extended ldr/str>\n");
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
216 }
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
217
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
218 static void
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
219 dataproc_74_overlay(off, word)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
220 unsigned off, word;
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
221 {
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
222 if (word & 0x60)
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
223 ldr_str_ext(off, word);
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
224 else
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
225 multiply(word);
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
226 }
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
227
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
228 void
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
229 arm_disasm_line(off)
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
230 unsigned off;
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
231 {
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
232 unsigned word;
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
233
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
234 word = get_u32(filemap + off);
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
235 printf("%8x:\t%08x\t", base_vma + off, word);
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
236 if ((word >> 28) == 0xF) {
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
237 printf("invalid-F\n");
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
238 return;
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
239 }
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
240 switch ((word >> 24) & 0xF) {
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
241 case 0:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
242 case 1:
88
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
243 if ((word & 0x90) == 0x90)
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
244 dataproc_74_overlay(off, word);
691551f0635b armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 87
diff changeset
245 else
90
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
246 dataproc(word);
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
247 return;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
248 case 2:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
249 case 3:
90
f68d8e7a904f armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 89
diff changeset
250 dataproc(word);
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
251 return;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
252 case 4:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
253 case 5:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
254 printf("<ldr/str, immediate offset>\n");
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
255 return;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
256 case 6:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
257 case 7:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
258 printf("<ldr/str, register offset>\n");
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
259 return;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
260 case 8:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
261 case 9:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
262 printf("<ldm/stm>\n");
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
263 return;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
264 case 0xA:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
265 case 0xB:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
266 arm_branch(off, word);
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
267 return;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
268 case 0xC:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
269 case 0xD:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
270 case 0xE:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
271 printf("<COPROCESSOR>\n");
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
272 return;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
273 case 0xF:
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
274 printf("swi%s\t0x%x\n", condition_decode[word>>28],
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
275 word & 0xFFFFFF);
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
276 return;
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
277 }
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
278 }
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
279
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
280 main(argc, argv)
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
281 char **argv;
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
282 {
87
f7fba8518fa2 armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 86
diff changeset
283 unsigned off;
86
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
284
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
285 common_init(argc, argv, 4);
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
286 for (off = 0; off < disasm_len; off += 4)
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
287 arm_disasm_line(off);
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
288 exit(0);
537cf2245d98 beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
289 }