FreeCalypso > hg > freecalypso-reveng
annotate arm7dis/thumbdis.c @ 104:52cec4b71cfe
C139 boot re: got to UART initialization
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Mon, 31 Mar 2014 03:11:25 +0000 |
parents | a10acb1688e0 |
children | c883e60df239 |
rev | line source |
---|---|
97
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #include <sys/types.h> |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 #include <stdio.h> |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 #include <stdlib.h> |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 #include <string.h> |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <strings.h> |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 extern char *binfilename; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 extern u_char *filemap; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 extern unsigned disasm_len, base_vma; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 extern unsigned get_u16(), get_u32(); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 extern char *regnames[16], *condition_decode[16], *shift_types[4]; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 format_1_2(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 unsigned op, imm; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 op = (word >> 11) & 3; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 if (op != 3) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 /* format 1 */ |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 imm = (word >> 6) & 0x1F; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 if (op != 0 && imm == 0) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 imm = 32; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 printf("%s\t%s, %s, #%u\n", shift_types[op], regnames[word&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 regnames[(word>>3)&7], imm); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 /* format 2 */ |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 printf("%s\t%s, %s, ", word&0x200 ? "sub" : "add", regnames[word&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 regnames[(word>>3)&7]); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 if (word & 0x400) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 printf("#%u\n", (word >> 6) & 7); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 printf("%s\n", regnames[(word >> 6) & 7]); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 format_3(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 static char *opctab[4] = {"mov", "cmp", "add", "sub"}; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 unsigned imm; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 imm = word & 0xFF; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 printf("%s\t%s, #%u", opctab[(word>>11)&3], regnames[(word>>8)&7], imm); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 if (imm > 9) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 printf("\t; 0x%x", imm); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 putchar('\n'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 format_4(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 static char *opc[16] = {"and", "eor", "lsl", "lsr", |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 "asr", "adc", "sbc", "ror", |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 "tst", "neg", "cmp", "cmn", |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 "orr", "mul", "bic", "mvn"}; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 printf("%s\t%s, %s\n", opc[(word>>6)&0xF], regnames[word&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 regnames[(word>>3)&7]); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 format_5_bx(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 if (word & 0x80) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 printf("<invalid: blx instead of bx>\n"); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 printf("bx\t%s\n", regnames[(word>>3)&0xF]); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 format_5_hiops(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 { |
101
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
81 static char *opctab[3] = {"add", "cmp", "mov"}; |
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
82 int reg1, reg2, op; |
97
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 if (word & 0xC0) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 reg1 = word & 7; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 if (word & 0x80) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
87 reg1 += 8; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
88 reg2 = (word >> 3) & 0xF; |
101
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
89 op = (word >> 8) & 3; |
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
90 if (op == 2 && reg1 == reg2 && reg1 != 15) |
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
91 printf("nop\t\t\t(mov %s, %s)\n", |
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
92 regnames[reg1], regnames[reg2]); |
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
93 else |
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
94 printf("%s\t%s, %s\n", opctab[op], |
78e4702884e3
thumbdis: nop recognition
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
97
diff
changeset
|
95 regnames[reg1], regnames[reg2]); |
97
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
96 } else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
97 printf("<invalid: hi-reg format with both low regs>\n"); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
98 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
99 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
100 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
101 format_5(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
102 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
103 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
104 if ((word & 0x300) == 0x300) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
105 format_5_bx(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
106 else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
107 format_5_hiops(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
108 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
109 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
110 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
111 format_6(off, word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
112 unsigned off, word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
113 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
114 unsigned loff, litoff; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
115 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
116 loff = (word & 0xFF) << 2; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
117 off &= ~3; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
118 off += 4; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
119 litoff = off + loff; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
120 if (litoff+4 <= disasm_len) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
121 printf("ldr\t%s, =0x%x\t; via 0x%x\n", regnames[(word>>8)&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
122 get_u32(filemap + litoff), base_vma + litoff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
123 else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
124 printf("ldr\t%s, [pc, #%u]\t(0x%x)\n", regnames[(word>>8)&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
125 loff, base_vma + litoff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
126 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
127 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
128 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
129 format_7(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
130 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
131 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
132 printf("%s%s\t%s, [%s, %s]\n", word&0x800 ? "ldr" : "str", |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
133 word&0x400 ? "b" : "", regnames[word&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
134 regnames[(word>>3)&7], regnames[(word>>6)&7]); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
135 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
136 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
137 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
138 format_8(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
139 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
140 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
141 static char *opc[4] = {"strh", "ldrsb", "ldrh", "ldrsh"}; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
142 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
143 printf("%s\t%s, [%s, %s]\n", opc[(word>>10)&3], regnames[word&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
144 regnames[(word>>3)&7], regnames[(word>>6)&7]); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
145 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
146 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
147 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
148 format_9(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
149 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
150 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
151 unsigned loff; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
152 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
153 loff = (word >> 6) & 0x1F; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
154 if (!(word & 0x1000)) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
155 loff <<= 2; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
156 printf("%s%s\t%s, [%s, #%u]", word&0x800 ? "ldr" : "str", |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
157 word&0x1000 ? "b" : "", regnames[word&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
158 regnames[(word>>3)&7], loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
159 if (loff >= 10) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
160 printf("\t; 0x%x", loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
161 putchar('\n'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
162 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
163 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
164 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
165 format_10(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
166 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
167 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
168 unsigned loff; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
169 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
170 loff = (word >> 6) & 0x1F; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
171 loff <<= 1; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
172 printf("%sh\t%s, [%s, #%u]", word&0x800 ? "ldr" : "str", |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
173 regnames[word&7], regnames[(word>>3)&7], loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
174 if (loff >= 10) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
175 printf("\t; 0x%x", loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
176 putchar('\n'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
177 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
178 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
179 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
180 format_11(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
181 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
182 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
183 unsigned loff; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
184 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
185 loff = (word & 0xFF) << 2; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
186 printf("%s\t%s, [sp, #%u]", word&0x800 ? "ldr" : "str", |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
187 regnames[(word>>8)&7], loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
188 if (loff >= 10) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
189 printf("\t; 0x%x", loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
190 putchar('\n'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
191 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
192 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
193 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
194 format_12(off, word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
195 unsigned off, word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
196 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
197 unsigned loff; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
198 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
199 loff = (word & 0xFF) << 2; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
200 printf("add\t%s, %s, #%u", regnames[(word>>8)&7], |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
201 word&0x800 ? "sp" : "pc", loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
202 if (loff >= 10) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
203 printf("\t; 0x%x", loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
204 putchar('\n'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
205 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
206 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
207 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
208 format_13(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
209 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
210 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
211 unsigned loff; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
212 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
213 if ((word & 0xFF00) != 0xB000) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
214 printf("<invalid format 13>\n"); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
215 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
216 } |
103
a10acb1688e0
thumbdis: buglet in the decoding of sub-from-sp
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
101
diff
changeset
|
217 loff = (word & 0x7F) << 2; |
97
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
218 printf("%s\tsp, #%u", word&0x80 ? "sub" : "add", loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
219 if (loff >= 10) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
220 printf("\t; 0x%x", loff); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
221 putchar('\n'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
222 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
223 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
224 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
225 format_14(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
226 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
227 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
228 int r, flag; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
229 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
230 if ((word & 0xF600) != 0xB400) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
231 printf("<invalid format 14>\n"); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
232 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
233 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
234 printf("%s\t{", word&0x800 ? "pop" : "push"); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
235 flag = 0; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
236 for (r = 0; r < 9; r++) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
237 if (word & (1 << r)) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
238 if (flag) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
239 fputs(", ", stdout); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
240 if (r == 8) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
241 fputs(word&0x800 ? "pc" : "lr", stdout); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
242 else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
243 fputs(regnames[r], stdout); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
244 flag = 1; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
245 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
246 putchar('}'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
247 putchar('\n'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
248 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
249 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
250 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
251 format_15(word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
252 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
253 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
254 int r, flag; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
255 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
256 printf("%sia\t%s!, {", word&0x800 ? "ldm" : "stm", |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
257 regnames[(word>>8)&7]); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
258 flag = 0; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
259 for (r = 0; r < 8; r++) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
260 if (word & (1 << r)) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
261 if (flag) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
262 fputs(", ", stdout); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
263 fputs(regnames[r], stdout); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
264 flag = 1; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
265 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
266 putchar('}'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
267 putchar('\n'); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
268 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
269 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
270 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
271 format_16_17(off, word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
272 unsigned off, word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
273 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
274 unsigned cond; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
275 unsigned dest; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
276 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
277 cond = (word >> 8) & 0xF; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
278 switch (cond) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
279 case 0xE: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
280 printf("<invalid: bal>\n"); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
281 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
282 case 0xF: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
283 printf("swi\t0x%x\n", word & 0xFF); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
284 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
285 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
286 dest = (word & 0xFF) << 1; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
287 if (dest & 0x00000100) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
288 dest |= 0xFFFFFE00; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
289 dest += base_vma + off + 4; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
290 printf("b%s\t0x%x\n", condition_decode[cond], dest); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
291 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
292 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
293 static void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
294 format_18(off, word) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
295 unsigned off, word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
296 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
297 unsigned dest; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
298 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
299 if (word & 0x800) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
300 printf("<invalid format 18>\n"); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
301 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
302 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
303 dest = (word & 0x7FF) << 1; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
304 if (dest & 0x00000800) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
305 dest |= 0xFFFFF000; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
306 dest += base_vma + off + 4; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
307 printf("b\t0x%x\n", dest); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
308 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
309 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
310 void |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
311 thumb_disasm_line(off) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
312 unsigned off; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
313 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
314 unsigned word; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
315 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
316 word = get_u16(filemap + off); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
317 printf("%8x:\t%04x\t\t", base_vma + off, word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
318 switch (word >> 12) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
319 case 0: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
320 case 1: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
321 format_1_2(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
322 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
323 case 2: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
324 case 3: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
325 format_3(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
326 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
327 case 4: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
328 if (word & 0x800) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
329 format_6(off, word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
330 else if (word & 0x400) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
331 format_5(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
332 else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
333 format_4(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
334 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
335 case 5: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
336 if (word & 0x200) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
337 format_8(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
338 else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
339 format_7(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
340 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
341 case 6: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
342 case 7: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
343 format_9(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
344 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
345 case 8: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
346 format_10(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
347 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
348 case 9: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
349 format_11(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
350 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
351 case 0xA: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
352 format_12(off, word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
353 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
354 case 0xB: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
355 if (word & 0x400) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
356 format_14(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
357 else |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
358 format_13(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
359 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
360 case 0xC: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
361 format_15(word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
362 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
363 case 0xD: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
364 format_16_17(off, word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
365 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
366 case 0xE: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
367 format_18(off, word); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
368 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
369 case 0xF: |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
370 printf("<half-bl>\n"); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
371 return; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
372 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
373 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
374 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
375 thumb_check_bl(off) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
376 unsigned off; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
377 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
378 unsigned ins1, ins2; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
379 unsigned dest; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
380 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
381 if (off + 4 > disasm_len) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
382 return(0); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
383 ins1 = get_u16(filemap + off); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
384 if ((ins1 & 0xF800) != 0xF000) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
385 return(0); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
386 ins2 = get_u16(filemap + off + 2); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
387 if ((ins2 & 0xF800) != 0xF800) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
388 return(0); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
389 /* match */ |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
390 dest = ((ins1 & 0x7FF) << 12) | ((ins2 & 0x7FF) << 1); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
391 if (dest & 0x00400000) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
392 dest |= 0xFF800000; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
393 dest += base_vma + off + 4; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
394 printf("%8x:\t%04x %04x\tbl\t0x%x\n", base_vma + off, ins1, ins2, dest); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
395 return(1); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
396 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
397 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
398 main(argc, argv) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
399 char **argv; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
400 { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
401 unsigned off; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
402 |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
403 common_init(argc, argv, 2); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
404 for (off = 0; off < disasm_len; ) { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
405 if (thumb_check_bl(off)) |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
406 off += 4; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
407 else { |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
408 thumb_disasm_line(off); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
409 off += 2; |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
410 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
411 } |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
412 exit(0); |
fb5ea2758482
thumbdis written, compiles
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
413 } |