FreeCalypso > hg > freecalypso-reveng
annotate arm7dis/armdis.c @ 95:9ed4d0fcb1f6
armdis: swp decoding implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 30 Mar 2014 07:21:21 +0000 |
parents | 915e2ca2813d |
children | fb5ea2758482 |
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: |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
61 printf("%s", regnames[word&0xF]); |
88
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: |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
64 printf("%s, rrx", regnames[word&0xF]); |
88
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 } |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
70 printf("%s, %s #%u", regnames[word&0xF], shift_types[t], c); |
88
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 { |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
77 printf("%s, %s %s", regnames[word&0xF], shift_types[(word>>5)&3], |
88
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); |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
89 putchar('\n'); |
88
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 |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
92 static void |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
93 dataproc_op2(word) |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
94 unsigned word; |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
95 { |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
96 if (word & 0x02000000) |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
97 op2_immed(word); |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
98 else |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
99 op2_regshift(word); |
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 |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
102 static void |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
103 dataproc_tstcmp_overlay(word) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
104 unsigned word; |
88
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
105 { |
89
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
106 char msrmask[5], *cp; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
107 |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
108 if ((word & 0x0FFFFFF0) == 0x012FFF10) { |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
109 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
|
110 regnames[word&0xF]); |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
111 return; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
112 } else if ((word & 0x0FBF0FFF) == 0x010F0000) { |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
113 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
|
114 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
|
115 return; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
116 } else if ((word & 0x0DB0F000) == 0x0120F000) { |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
117 if (!(word & 0x02000000) && (word & 0xFF0)) { |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
118 printf("<invalid MSR>\n"); |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
119 return; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
120 } |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
121 if (word & 0xF0000) { |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
122 cp = msrmask; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
123 if (word & 0x80000) |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
124 *cp++ = 'f'; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
125 if (word & 0x40000) |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
126 *cp++ = 's'; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
127 if (word & 0x20000) |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
128 *cp++ = 'x'; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
129 if (word & 0x10000) |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
130 *cp++ = 'c'; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
131 *cp = '\0'; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
132 } else |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
133 strcpy(msrmask, "null"); |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
134 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
|
135 word&0x400000 ? 'S' : 'C', msrmask); |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
136 dataproc_op2(word); |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
137 return; |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
138 } |
c5d52666d2eb
armdis: BX/MRS/MSR decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
88
diff
changeset
|
139 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
|
140 } |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
141 |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
142 static void |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
143 dataproc(word) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
144 unsigned word; |
88
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
145 { |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
146 unsigned opc; |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
147 |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
148 opc = (word >> 21) & 0xF; |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
149 switch (opc) { |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
150 case 0: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
151 case 1: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
152 case 2: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
153 case 3: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
154 case 4: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
155 case 5: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
156 case 6: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
157 case 7: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
158 case 0xC: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
159 case 0xE: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
160 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
|
161 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
|
162 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
|
163 dataproc_op2(word); |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
164 return; |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
165 case 0xD: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
166 case 0xF: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
167 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
|
168 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
|
169 regnames[(word>>12)&0xF]); |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
170 dataproc_op2(word); |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
171 return; |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
172 case 8: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
173 case 9: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
174 case 0xA: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
175 case 0xB: |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
176 if (word & 0x100000) { |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
177 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
|
178 condition_decode[word>>28], |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
179 regnames[(word>>16)&0xF]); |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
180 dataproc_op2(word); |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
181 } else |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
182 dataproc_tstcmp_overlay(word); |
88
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
183 return; |
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 } |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
186 |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
187 static void |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
188 multiply(word) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
189 unsigned word; |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
190 { |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
191 if ((word & 0x0FE000F0) == 0x90) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
192 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
|
193 word&0x100000 ? "s" : "", regnames[(word>>16)&0xF], |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
194 regnames[word&0xF], regnames[(word>>8)&0xF]); |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
195 else if ((word & 0x0FE000F0) == 0x00200090) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
196 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
|
197 word&0x100000 ? "s" : "", regnames[(word>>16)&0xF], |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
198 regnames[word&0xF], regnames[(word>>8)&0xF], |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
199 regnames[(word>>12)&0xF]); |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
200 else if ((word & 0x0F8000F0) == 0x00800090) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
201 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
|
202 word&0x400000 ? 's' : 'u', |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
203 word&0x200000 ? "mla" : "mul", |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
204 condition_decode[word>>28], |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
205 word&0x100000 ? "s" : "", |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
206 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
|
207 regnames[word&0xF], regnames[(word>>8)&0xF]); |
95
9ed4d0fcb1f6
armdis: swp decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
94
diff
changeset
|
208 else if ((word & 0x0FB00FF0) == 0x01000090) |
9ed4d0fcb1f6
armdis: swp decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
94
diff
changeset
|
209 printf("swp%s%s\t%s, %s, [%s]\n", condition_decode[word>>28], |
9ed4d0fcb1f6
armdis: swp decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
94
diff
changeset
|
210 word&0x400000, "b", "", regnames[(word>>12)&0xF], |
9ed4d0fcb1f6
armdis: swp decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
94
diff
changeset
|
211 regnames[word&0xF], regnames[(word>>16)&0xF]); |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
212 else |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
213 printf("<invalid multiply>\n"); |
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 |
92
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
216 static int |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
217 check_ldr_litpool(off, word, loff, size) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
218 unsigned off, word, loff; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
219 { |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
220 unsigned litoff, datum; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
221 |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
222 /* base reg must be 15 */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
223 if (((word >> 16) & 0xF) != 15) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
224 return(0); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
225 /* must be a load */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
226 if (!(word & 0x100000)) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
227 return(0); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
228 /* no writeback allowed */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
229 if (word & 0x200000) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
230 return(0); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
231 /* alignment */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
232 if (loff & (size - 1)) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
233 return(0); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
234 /* range */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
235 off += 8; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
236 if (word & 0x800000) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
237 litoff = off + loff; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
238 else { |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
239 if (loff > off) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
240 return(0); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
241 litoff = off - loff; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
242 } |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
243 if (litoff >= disasm_len) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
244 return(0); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
245 /* all checks passed, proceed */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
246 switch (size) { |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
247 case 1: |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
248 datum = filemap[litoff]; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
249 break; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
250 case 2: |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
251 datum = get_u16(filemap + litoff); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
252 break; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
253 case 4: |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
254 datum = get_u32(filemap + litoff); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
255 break; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
256 } |
93
5ebebbc74622
armdis: buglet in literal pool handling: forgot to add base_vma
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
92
diff
changeset
|
257 printf("=0x%x\t; via 0x%x\n", datum, base_vma + litoff); |
92
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
258 return(1); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
259 } |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
260 |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
261 static void |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
262 ldr_str_imm_pre(off, word) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
263 unsigned off, word; |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
264 { |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
265 unsigned loff = word & 0xFFF; |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
266 |
92
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
267 printf("%s%s%s\t%s, ", word&0x100000 ? "ldr" : "str", |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
268 condition_decode[word>>28], word&0x400000 ? "b" : "", |
92
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
269 regnames[(word>>12)&0xF]); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
270 if (check_ldr_litpool(off, word, loff, word&0x400000 ? 1 : 4)) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
271 return; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
272 printf("[%s", regnames[(word>>16)&0xF]); |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
273 if (loff || word&0x200000) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
274 printf(", #%s%u", word&0x800000 ? "" : "-", loff); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
275 putchar(']'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
276 if (word & 0x200000) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
277 putchar('!'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
278 if (loff >= 10) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
279 printf("\t; 0x%x", loff); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
280 putchar('\n'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
281 } |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
282 |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
283 static void |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
284 ldr_str_imm_post(word) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
285 unsigned word; |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
286 { |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
287 unsigned loff = word & 0xFFF; |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
288 |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
289 printf("%s%s%s%s\t%s, [%s], #%s%u", word&0x100000 ? "ldr" : "str", |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
290 condition_decode[word>>28], word&0x400000 ? "b" : "", |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
291 word&0x200000 ? "t" : "", |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
292 regnames[(word>>12)&0xF], regnames[(word>>16)&0xF], |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
293 word&0x800000 ? "" : "-", loff); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
294 if (loff >= 10) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
295 printf("\t; 0x%x", loff); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
296 putchar('\n'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
297 } |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
298 |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
299 static void |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
300 ldr_str_reg_pre(word) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
301 unsigned word; |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
302 { |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
303 if (word & 0x10) { |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
304 printf("<invalid ldr/str: offset reg shift by reg>\n"); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
305 return; |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
306 } |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
307 printf("%s%s%s\t%s, [%s, ", word&0x100000 ? "ldr" : "str", |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
308 condition_decode[word>>28], word&0x400000 ? "b" : "", |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
309 regnames[(word>>12)&0xF], regnames[(word>>16)&0xF]); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
310 if (!(word & 0x800000)) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
311 putchar('-'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
312 op2_regbyconst(word); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
313 putchar(']'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
314 if (word & 0x200000) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
315 putchar('!'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
316 putchar('\n'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
317 } |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
318 |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
319 static void |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
320 ldr_str_reg_post(word) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
321 unsigned word; |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
322 { |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
323 if (word & 0x10) { |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
324 printf("<invalid ldr/str: offset reg shift by reg>\n"); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
325 return; |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
326 } |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
327 printf("%s%s%s%s\t%s, [%s], ", word&0x100000 ? "ldr" : "str", |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
328 condition_decode[word>>28], word&0x400000 ? "b" : "", |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
329 word&0x200000 ? "t" : "", |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
330 regnames[(word>>12)&0xF], regnames[(word>>16)&0xF]); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
331 if (!(word & 0x800000)) |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
332 putchar('-'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
333 op2_regbyconst(word); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
334 putchar('\n'); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
335 } |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
336 |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
337 static void |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
338 ldr_str_ext(off, word) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
339 unsigned off, word; |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
340 { |
92
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
341 unsigned loff; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
342 |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
343 if (!(word&0x01000000) && word&0x200000) { |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
344 printf("<invalid ldrh/strh: P=0, W=1>\n"); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
345 return; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
346 } |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
347 if (!(word&0x400000) && word&0xF00) { |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
348 printf("<invalid ldrh/strh: SBZ!=0>\n"); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
349 return; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
350 } |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
351 printf("%s%s%s%c\t%s, ", word&0x100000 ? "ldr" : "str", |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
352 condition_decode[word>>28], |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
353 word&0x40 ? "s" : "", |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
354 word&0x20 ? 'h' : 'b', |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
355 regnames[(word>>12)&0xF]); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
356 if (word & 0x400000) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
357 loff = ((word & 0xF00) >> 4) | (word & 0xF); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
358 switch (word & 0x01400000) { |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
359 case 0: |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
360 /* reg post */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
361 printf("[%s], %s%s", regnames[(word>>16)&0xF], |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
362 word&0x800000 ? "" : "-", regnames[word&0xF]); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
363 break; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
364 case 0x400000: |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
365 /* imm post */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
366 printf("[%s], #%s%u", regnames[(word>>16)&0xF], |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
367 word&0x800000 ? "" : "-", loff); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
368 if (loff >= 10) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
369 printf("\t; 0x%x", loff); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
370 break; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
371 case 0x01000000: |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
372 /* reg pre */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
373 printf("[%s, %s%s]%s", regnames[(word>>16)&0xF], |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
374 word&0x800000 ? "" : "-", regnames[word&0xF], |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
375 word&0x200000 ? "!" : ""); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
376 break; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
377 case 0x01400000: |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
378 /* imm pre */ |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
379 if (check_ldr_litpool(off, word, loff, word&0x20 ? 2 : 1)) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
380 return; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
381 printf("[%s", regnames[(word>>16)&0xF]); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
382 if (loff || word&0x200000) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
383 printf(", #%s%u", word&0x800000 ? "" : "-", loff); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
384 putchar(']'); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
385 if (word & 0x200000) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
386 putchar('!'); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
387 if (loff >= 10) |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
388 printf("\t; 0x%x", loff); |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
389 break; |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
390 } |
708f2452d1ae
armdis: full ldr/str decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
91
diff
changeset
|
391 putchar('\n'); |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
392 } |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
393 |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
394 static void |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
395 dataproc_74_overlay(off, word) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
396 unsigned off, word; |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
397 { |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
398 if (word & 0x60) |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
399 ldr_str_ext(off, word); |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
400 else |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
401 multiply(word); |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
402 } |
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
403 |
94
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
404 static void |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
405 ldm_stm(word) |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
406 unsigned word; |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
407 { |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
408 int r, flag; |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
409 |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
410 printf("%s%s%c%c\t%s", word&0x100000 ? "ldm" : "stm", |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
411 condition_decode[word>>28], |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
412 word&0x800000 ? 'i' : 'd', word&0x01000000 ? 'b' : 'a', |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
413 regnames[(word>>16)&0xF]); |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
414 if (word & 0x200000) |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
415 putchar('!'); |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
416 fputs(", {", stdout); |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
417 flag = 0; |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
418 for (r = 0; r < 16; r++) |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
419 if (word & (1 << r)) { |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
420 if (flag) |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
421 fputs(", ", stdout); |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
422 fputs(regnames[r], stdout); |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
423 flag = 1; |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
424 } |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
425 putchar('}'); |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
426 if (word & 0x400000) |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
427 putchar('^'); |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
428 putchar('\n'); |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
429 } |
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
430 |
86
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
431 void |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
432 arm_disasm_line(off) |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
433 unsigned off; |
86
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
434 { |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
435 unsigned word; |
86
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
436 |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
437 word = get_u32(filemap + off); |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
438 printf("%8x:\t%08x\t", base_vma + off, word); |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
439 if ((word >> 28) == 0xF) { |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
440 printf("<invalid-F>\n"); |
86
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
441 return; |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
442 } |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
443 switch ((word >> 24) & 0xF) { |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
444 case 0: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
445 case 1: |
88
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
446 if ((word & 0x90) == 0x90) |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
447 dataproc_74_overlay(off, word); |
691551f0635b
armdis: implemented decoding of data processing instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
87
diff
changeset
|
448 else |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
449 dataproc(word); |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
450 return; |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
451 case 2: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
452 case 3: |
90
f68d8e7a904f
armdis: implemented decoding of multiplication instructions
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
89
diff
changeset
|
453 dataproc(word); |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
454 return; |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
455 case 4: |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
456 ldr_str_imm_post(word); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
457 return; |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
458 case 5: |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
459 ldr_str_imm_pre(off, word); |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
460 return; |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
461 case 6: |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
462 ldr_str_reg_post(word); |
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
463 return; |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
464 case 7: |
91
daf69d5edb3f
armdis: ldr/str decoding implemented (but not PC-relative ldr yet)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
90
diff
changeset
|
465 ldr_str_reg_pre(word); |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
466 return; |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
467 case 8: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
468 case 9: |
94
915e2ca2813d
armdis: ldm/stm decoding implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
93
diff
changeset
|
469 ldm_stm(word); |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
470 return; |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
471 case 0xA: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
472 case 0xB: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
473 arm_branch(off, word); |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
474 return; |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
475 case 0xC: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
476 case 0xD: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
477 case 0xE: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
478 printf("<COPROCESSOR>\n"); |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
479 return; |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
480 case 0xF: |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
481 printf("swi%s\t0x%x\n", condition_decode[word>>28], |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
482 word & 0xFFFFFF); |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
483 return; |
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
484 } |
86
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
485 } |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
486 |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
487 main(argc, argv) |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
488 char **argv; |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
489 { |
87
f7fba8518fa2
armdis: skeleton compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
86
diff
changeset
|
490 unsigned off; |
86
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
491 |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
492 common_init(argc, argv, 4); |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
493 for (off = 0; off < disasm_len; off += 4) |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
494 arm_disasm_line(off); |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
495 exit(0); |
537cf2245d98
beginning of ARM7 disassembler
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
496 } |