Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* Select disassembly routine for specified architecture. |
060d22b0 | 2 | Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 |
5b93d8bb | 3 | Free Software Foundation, Inc. |
252b5132 RH |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 2 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program; if not, write to the Free Software | |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
18 | ||
0d8dfecf | 19 | #include "sysdep.h" |
252b5132 RH |
20 | #include "dis-asm.h" |
21 | ||
22 | #ifdef ARCH_all | |
23 | #define ARCH_a29k | |
24 | #define ARCH_alpha | |
25 | #define ARCH_arc | |
26 | #define ARCH_arm | |
adde6300 | 27 | #define ARCH_avr |
6c95a37f | 28 | #define ARCH_cris |
252b5132 RH |
29 | #define ARCH_d10v |
30 | #define ARCH_d30v | |
31 | #define ARCH_h8300 | |
32 | #define ARCH_h8500 | |
33 | #define ARCH_hppa | |
5b93d8bb | 34 | #define ARCH_i370 |
252b5132 | 35 | #define ARCH_i386 |
9d751335 | 36 | #define ARCH_i860 |
252b5132 | 37 | #define ARCH_i960 |
800eeca4 | 38 | #define ARCH_ia64 |
252b5132 RH |
39 | #define ARCH_fr30 |
40 | #define ARCH_m32r | |
41 | #define ARCH_m68k | |
60bcf0fa NC |
42 | #define ARCH_m68hc11 |
43 | #define ARCH_m68hc12 | |
252b5132 RH |
44 | #define ARCH_m88k |
45 | #define ARCH_mcore | |
46 | #define ARCH_mips | |
47 | #define ARCH_mn10200 | |
48 | #define ARCH_mn10300 | |
49 | #define ARCH_ns32k | |
e135f41b | 50 | #define ARCH_pdp11 |
1e608f98 | 51 | #define ARCH_pj |
252b5132 RH |
52 | #define ARCH_powerpc |
53 | #define ARCH_rs6000 | |
a85d7ed0 | 54 | #define ARCH_s390 |
252b5132 RH |
55 | #define ARCH_sh |
56 | #define ARCH_sparc | |
57 | #define ARCH_tic30 | |
5c84d377 | 58 | #define ARCH_tic54x |
252b5132 RH |
59 | #define ARCH_tic80 |
60 | #define ARCH_v850 | |
61 | #define ARCH_vax | |
62 | #define ARCH_w65 | |
63 | #define ARCH_z8k | |
64 | #endif | |
65 | ||
66 | ||
67 | disassembler_ftype | |
68 | disassembler (abfd) | |
69 | bfd *abfd; | |
70 | { | |
71 | enum bfd_architecture a = bfd_get_arch (abfd); | |
72 | disassembler_ftype disassemble; | |
73 | ||
74 | switch (a) | |
75 | { | |
76 | /* If you add a case to this table, also add it to the | |
77 | ARCH_all definition right above this function. */ | |
78 | #ifdef ARCH_a29k | |
79 | case bfd_arch_a29k: | |
80 | /* As far as I know we only handle big-endian 29k objects. */ | |
81 | disassemble = print_insn_big_a29k; | |
82 | break; | |
83 | #endif | |
84 | #ifdef ARCH_alpha | |
85 | case bfd_arch_alpha: | |
86 | disassemble = print_insn_alpha; | |
87 | break; | |
88 | #endif | |
89 | #ifdef ARCH_arc | |
90 | case bfd_arch_arc: | |
91 | { | |
0d2bcfaf | 92 | disassemble = arc_get_disassembler (abfd); |
252b5132 RH |
93 | break; |
94 | } | |
95 | #endif | |
96 | #ifdef ARCH_arm | |
97 | case bfd_arch_arm: | |
98 | if (bfd_big_endian (abfd)) | |
99 | disassemble = print_insn_big_arm; | |
100 | else | |
101 | disassemble = print_insn_little_arm; | |
102 | break; | |
103 | #endif | |
adde6300 AM |
104 | #ifdef ARCH_avr |
105 | case bfd_arch_avr: | |
106 | disassemble = print_insn_avr; | |
107 | break; | |
108 | #endif | |
6c95a37f HPN |
109 | #ifdef ARCH_cris |
110 | case bfd_arch_cris: | |
78966507 | 111 | disassemble = cris_get_disassembler (abfd); |
6c95a37f HPN |
112 | break; |
113 | #endif | |
252b5132 RH |
114 | #ifdef ARCH_d10v |
115 | case bfd_arch_d10v: | |
116 | disassemble = print_insn_d10v; | |
117 | break; | |
118 | #endif | |
119 | #ifdef ARCH_d30v | |
120 | case bfd_arch_d30v: | |
121 | disassemble = print_insn_d30v; | |
122 | break; | |
123 | #endif | |
124 | #ifdef ARCH_h8300 | |
125 | case bfd_arch_h8300: | |
126 | if (bfd_get_mach(abfd) == bfd_mach_h8300h) | |
127 | disassemble = print_insn_h8300h; | |
128 | else if (bfd_get_mach(abfd) == bfd_mach_h8300s) | |
129 | disassemble = print_insn_h8300s; | |
b7ed8fad | 130 | else |
252b5132 RH |
131 | disassemble = print_insn_h8300; |
132 | break; | |
133 | #endif | |
134 | #ifdef ARCH_h8500 | |
135 | case bfd_arch_h8500: | |
136 | disassemble = print_insn_h8500; | |
137 | break; | |
138 | #endif | |
139 | #ifdef ARCH_hppa | |
140 | case bfd_arch_hppa: | |
141 | disassemble = print_insn_hppa; | |
142 | break; | |
143 | #endif | |
5b93d8bb AM |
144 | #ifdef ARCH_i370 |
145 | case bfd_arch_i370: | |
146 | disassemble = print_insn_i370; | |
147 | break; | |
148 | #endif | |
252b5132 RH |
149 | #ifdef ARCH_i386 |
150 | case bfd_arch_i386: | |
52b15da3 JH |
151 | if (bfd_get_mach (abfd) == bfd_mach_i386_i386_intel_syntax |
152 | || bfd_get_mach (abfd) == bfd_mach_x86_64_intel_syntax) | |
252b5132 RH |
153 | disassemble = print_insn_i386_intel; |
154 | else | |
155 | disassemble = print_insn_i386_att; | |
156 | break; | |
157 | #endif | |
9d751335 JE |
158 | #ifdef ARCH_i860 |
159 | case bfd_arch_i860: | |
160 | disassemble = print_insn_i860; | |
161 | break; | |
162 | #endif | |
252b5132 RH |
163 | #ifdef ARCH_i960 |
164 | case bfd_arch_i960: | |
165 | disassemble = print_insn_i960; | |
166 | break; | |
167 | #endif | |
800eeca4 JW |
168 | #ifdef ARCH_ia64 |
169 | case bfd_arch_ia64: | |
170 | disassemble = print_insn_ia64; | |
171 | break; | |
172 | #endif | |
252b5132 RH |
173 | #ifdef ARCH_fr30 |
174 | case bfd_arch_fr30: | |
175 | disassemble = print_insn_fr30; | |
176 | break; | |
177 | #endif | |
178 | #ifdef ARCH_m32r | |
179 | case bfd_arch_m32r: | |
180 | disassemble = print_insn_m32r; | |
181 | break; | |
182 | #endif | |
60bcf0fa NC |
183 | #if defined(ARCH_m68hc11) || defined(ARCH_m68hc12) |
184 | case bfd_arch_m68hc11: | |
185 | disassemble = print_insn_m68hc11; | |
186 | break; | |
187 | case bfd_arch_m68hc12: | |
188 | disassemble = print_insn_m68hc12; | |
189 | break; | |
190 | #endif | |
252b5132 RH |
191 | #ifdef ARCH_m68k |
192 | case bfd_arch_m68k: | |
193 | disassemble = print_insn_m68k; | |
194 | break; | |
195 | #endif | |
196 | #ifdef ARCH_m88k | |
197 | case bfd_arch_m88k: | |
198 | disassemble = print_insn_m88k; | |
199 | break; | |
200 | #endif | |
201 | #ifdef ARCH_ns32k | |
202 | case bfd_arch_ns32k: | |
203 | disassemble = print_insn_ns32k; | |
204 | break; | |
205 | #endif | |
206 | #ifdef ARCH_mcore | |
207 | case bfd_arch_mcore: | |
208 | disassemble = print_insn_mcore; | |
209 | break; | |
210 | #endif | |
211 | #ifdef ARCH_mips | |
212 | case bfd_arch_mips: | |
213 | if (bfd_big_endian (abfd)) | |
214 | disassemble = print_insn_big_mips; | |
215 | else | |
216 | disassemble = print_insn_little_mips; | |
217 | break; | |
218 | #endif | |
219 | #ifdef ARCH_mn10200 | |
220 | case bfd_arch_mn10200: | |
221 | disassemble = print_insn_mn10200; | |
222 | break; | |
223 | #endif | |
224 | #ifdef ARCH_mn10300 | |
225 | case bfd_arch_mn10300: | |
226 | disassemble = print_insn_mn10300; | |
227 | break; | |
228 | #endif | |
e135f41b NC |
229 | #ifdef ARCH_pdp11 |
230 | case bfd_arch_pdp11: | |
231 | disassemble = print_insn_pdp11; | |
232 | break; | |
233 | #endif | |
1e608f98 ILT |
234 | #ifdef ARCH_pj |
235 | case bfd_arch_pj: | |
236 | disassemble = print_insn_pj; | |
237 | break; | |
238 | #endif | |
252b5132 RH |
239 | #ifdef ARCH_powerpc |
240 | case bfd_arch_powerpc: | |
241 | if (bfd_big_endian (abfd)) | |
242 | disassemble = print_insn_big_powerpc; | |
243 | else | |
244 | disassemble = print_insn_little_powerpc; | |
245 | break; | |
246 | #endif | |
247 | #ifdef ARCH_rs6000 | |
248 | case bfd_arch_rs6000: | |
39c20e8f | 249 | if (bfd_get_mach (abfd) == bfd_mach_ppc_620) |
7f6d05e8 CP |
250 | disassemble = print_insn_big_powerpc; |
251 | else | |
252 | disassemble = print_insn_rs6000; | |
252b5132 RH |
253 | break; |
254 | #endif | |
a85d7ed0 NC |
255 | #ifdef ARCH_s390 |
256 | case bfd_arch_s390: | |
257 | disassemble = print_insn_s390; | |
258 | break; | |
259 | #endif | |
252b5132 RH |
260 | #ifdef ARCH_sh |
261 | case bfd_arch_sh: | |
262 | if (bfd_big_endian (abfd)) | |
263 | disassemble = print_insn_sh; | |
264 | else | |
265 | disassemble = print_insn_shl; | |
266 | break; | |
267 | #endif | |
268 | #ifdef ARCH_sparc | |
269 | case bfd_arch_sparc: | |
270 | disassemble = print_insn_sparc; | |
271 | break; | |
272 | #endif | |
273 | #ifdef ARCH_tic30 | |
274 | case bfd_arch_tic30: | |
275 | disassemble = print_insn_tic30; | |
276 | break; | |
277 | #endif | |
5c84d377 TW |
278 | #ifdef ARCH_tic54x |
279 | case bfd_arch_tic54x: | |
280 | disassemble = print_insn_tic54x; | |
281 | break; | |
282 | #endif | |
252b5132 RH |
283 | #ifdef ARCH_tic80 |
284 | case bfd_arch_tic80: | |
285 | disassemble = print_insn_tic80; | |
286 | break; | |
287 | #endif | |
288 | #ifdef ARCH_v850 | |
289 | case bfd_arch_v850: | |
290 | disassemble = print_insn_v850; | |
291 | break; | |
292 | #endif | |
293 | #ifdef ARCH_w65 | |
294 | case bfd_arch_w65: | |
295 | disassemble = print_insn_w65; | |
296 | break; | |
297 | #endif | |
298 | #ifdef ARCH_z8k | |
299 | case bfd_arch_z8k: | |
300 | if (bfd_get_mach(abfd) == bfd_mach_z8001) | |
301 | disassemble = print_insn_z8001; | |
b7ed8fad | 302 | else |
252b5132 RH |
303 | disassemble = print_insn_z8002; |
304 | break; | |
305 | #endif | |
306 | #ifdef ARCH_vax | |
307 | case bfd_arch_vax: | |
308 | disassemble = print_insn_vax; | |
309 | break; | |
310 | #endif | |
311 | default: | |
312 | return 0; | |
313 | } | |
314 | return disassemble; | |
315 | } | |
94470b23 NC |
316 | |
317 | void | |
9aaaa291 | 318 | disassembler_usage (stream) |
c1485d85 | 319 | FILE * stream ATTRIBUTE_UNUSED; |
94470b23 | 320 | { |
58efb6c0 NC |
321 | #ifdef ARCH_arm |
322 | print_arm_disassembler_options (stream); | |
323 | #endif | |
b7ed8fad | 324 | |
94470b23 NC |
325 | return; |
326 | } |