]>
Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* Select disassembly routine for specified architecture. |
3b16e843 | 2 | Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
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 | |
d172d4ba | 31 | #define ARCH_dlx |
252b5132 RH |
32 | #define ARCH_h8300 |
33 | #define ARCH_h8500 | |
34 | #define ARCH_hppa | |
5b93d8bb | 35 | #define ARCH_i370 |
252b5132 | 36 | #define ARCH_i386 |
9d751335 | 37 | #define ARCH_i860 |
252b5132 | 38 | #define ARCH_i960 |
a40cbfa3 | 39 | #define ARCH_ip2k |
800eeca4 | 40 | #define ARCH_ia64 |
252b5132 RH |
41 | #define ARCH_fr30 |
42 | #define ARCH_m32r | |
43 | #define ARCH_m68k | |
60bcf0fa NC |
44 | #define ARCH_m68hc11 |
45 | #define ARCH_m68hc12 | |
252b5132 RH |
46 | #define ARCH_m88k |
47 | #define ARCH_mcore | |
48 | #define ARCH_mips | |
3c3bdf30 | 49 | #define ARCH_mmix |
252b5132 RH |
50 | #define ARCH_mn10200 |
51 | #define ARCH_mn10300 | |
2469cfa2 | 52 | #define ARCH_msp430 |
252b5132 | 53 | #define ARCH_ns32k |
87e6d782 | 54 | #define ARCH_openrisc |
3b16e843 | 55 | #define ARCH_or32 |
e135f41b | 56 | #define ARCH_pdp11 |
1e608f98 | 57 | #define ARCH_pj |
252b5132 RH |
58 | #define ARCH_powerpc |
59 | #define ARCH_rs6000 | |
a85d7ed0 | 60 | #define ARCH_s390 |
252b5132 RH |
61 | #define ARCH_sh |
62 | #define ARCH_sparc | |
63 | #define ARCH_tic30 | |
026df7c5 | 64 | #define ARCH_tic4x |
5c84d377 | 65 | #define ARCH_tic54x |
252b5132 RH |
66 | #define ARCH_tic80 |
67 | #define ARCH_v850 | |
68 | #define ARCH_vax | |
69 | #define ARCH_w65 | |
93fbbb04 | 70 | #define ARCH_xstormy16 |
e0001a05 | 71 | #define ARCH_xtensa |
252b5132 | 72 | #define ARCH_z8k |
fd3c93d5 | 73 | #define ARCH_frv |
47b1a55a | 74 | #define ARCH_iq2000 |
d28847ce | 75 | #define INCLUDE_SHMEDIA |
252b5132 RH |
76 | #endif |
77 | ||
78 | ||
79 | disassembler_ftype | |
80 | disassembler (abfd) | |
81 | bfd *abfd; | |
82 | { | |
83 | enum bfd_architecture a = bfd_get_arch (abfd); | |
84 | disassembler_ftype disassemble; | |
85 | ||
86 | switch (a) | |
87 | { | |
88 | /* If you add a case to this table, also add it to the | |
89 | ARCH_all definition right above this function. */ | |
90 | #ifdef ARCH_a29k | |
91 | case bfd_arch_a29k: | |
92 | /* As far as I know we only handle big-endian 29k objects. */ | |
93 | disassemble = print_insn_big_a29k; | |
94 | break; | |
95 | #endif | |
96 | #ifdef ARCH_alpha | |
97 | case bfd_arch_alpha: | |
98 | disassemble = print_insn_alpha; | |
99 | break; | |
100 | #endif | |
101 | #ifdef ARCH_arc | |
102 | case bfd_arch_arc: | |
103 | { | |
0d2bcfaf | 104 | disassemble = arc_get_disassembler (abfd); |
252b5132 RH |
105 | break; |
106 | } | |
107 | #endif | |
108 | #ifdef ARCH_arm | |
109 | case bfd_arch_arm: | |
110 | if (bfd_big_endian (abfd)) | |
111 | disassemble = print_insn_big_arm; | |
112 | else | |
113 | disassemble = print_insn_little_arm; | |
114 | break; | |
115 | #endif | |
adde6300 AM |
116 | #ifdef ARCH_avr |
117 | case bfd_arch_avr: | |
118 | disassemble = print_insn_avr; | |
119 | break; | |
120 | #endif | |
6c95a37f HPN |
121 | #ifdef ARCH_cris |
122 | case bfd_arch_cris: | |
78966507 | 123 | disassemble = cris_get_disassembler (abfd); |
6c95a37f HPN |
124 | break; |
125 | #endif | |
252b5132 RH |
126 | #ifdef ARCH_d10v |
127 | case bfd_arch_d10v: | |
128 | disassemble = print_insn_d10v; | |
129 | break; | |
130 | #endif | |
131 | #ifdef ARCH_d30v | |
132 | case bfd_arch_d30v: | |
133 | disassemble = print_insn_d30v; | |
134 | break; | |
135 | #endif | |
d172d4ba NC |
136 | #ifdef ARCH_dlx |
137 | case bfd_arch_dlx: | |
138 | /* As far as I know we only handle big-endian DLX objects. */ | |
139 | disassemble = print_insn_dlx; | |
140 | break; | |
141 | #endif | |
252b5132 RH |
142 | #ifdef ARCH_h8300 |
143 | case bfd_arch_h8300: | |
049f8936 NC |
144 | if (bfd_get_mach (abfd) == bfd_mach_h8300h |
145 | || bfd_get_mach (abfd) == bfd_mach_h8300hn) | |
252b5132 | 146 | disassemble = print_insn_h8300h; |
049f8936 | 147 | else if (bfd_get_mach (abfd) == bfd_mach_h8300s |
d43ff6d2 MS |
148 | || bfd_get_mach (abfd) == bfd_mach_h8300sn |
149 | || bfd_get_mach (abfd) == bfd_mach_h8300sx) | |
252b5132 | 150 | disassemble = print_insn_h8300s; |
b7ed8fad | 151 | else |
252b5132 RH |
152 | disassemble = print_insn_h8300; |
153 | break; | |
154 | #endif | |
155 | #ifdef ARCH_h8500 | |
156 | case bfd_arch_h8500: | |
157 | disassemble = print_insn_h8500; | |
158 | break; | |
159 | #endif | |
160 | #ifdef ARCH_hppa | |
161 | case bfd_arch_hppa: | |
162 | disassemble = print_insn_hppa; | |
163 | break; | |
164 | #endif | |
5b93d8bb AM |
165 | #ifdef ARCH_i370 |
166 | case bfd_arch_i370: | |
167 | disassemble = print_insn_i370; | |
168 | break; | |
169 | #endif | |
252b5132 RH |
170 | #ifdef ARCH_i386 |
171 | case bfd_arch_i386: | |
e396998b | 172 | disassemble = print_insn_i386; |
252b5132 RH |
173 | break; |
174 | #endif | |
9d751335 JE |
175 | #ifdef ARCH_i860 |
176 | case bfd_arch_i860: | |
177 | disassemble = print_insn_i860; | |
178 | break; | |
179 | #endif | |
252b5132 RH |
180 | #ifdef ARCH_i960 |
181 | case bfd_arch_i960: | |
182 | disassemble = print_insn_i960; | |
183 | break; | |
184 | #endif | |
800eeca4 JW |
185 | #ifdef ARCH_ia64 |
186 | case bfd_arch_ia64: | |
187 | disassemble = print_insn_ia64; | |
188 | break; | |
189 | #endif | |
a40cbfa3 NC |
190 | #ifdef ARCH_ip2k |
191 | case bfd_arch_ip2k: | |
192 | disassemble = print_insn_ip2k; | |
193 | break; | |
194 | #endif | |
252b5132 RH |
195 | #ifdef ARCH_fr30 |
196 | case bfd_arch_fr30: | |
197 | disassemble = print_insn_fr30; | |
198 | break; | |
199 | #endif | |
200 | #ifdef ARCH_m32r | |
201 | case bfd_arch_m32r: | |
202 | disassemble = print_insn_m32r; | |
203 | break; | |
204 | #endif | |
60bcf0fa NC |
205 | #if defined(ARCH_m68hc11) || defined(ARCH_m68hc12) |
206 | case bfd_arch_m68hc11: | |
207 | disassemble = print_insn_m68hc11; | |
208 | break; | |
209 | case bfd_arch_m68hc12: | |
210 | disassemble = print_insn_m68hc12; | |
211 | break; | |
212 | #endif | |
252b5132 RH |
213 | #ifdef ARCH_m68k |
214 | case bfd_arch_m68k: | |
215 | disassemble = print_insn_m68k; | |
216 | break; | |
217 | #endif | |
218 | #ifdef ARCH_m88k | |
219 | case bfd_arch_m88k: | |
220 | disassemble = print_insn_m88k; | |
221 | break; | |
222 | #endif | |
2469cfa2 NC |
223 | #ifdef ARCH_msp430 |
224 | case bfd_arch_msp430: | |
225 | disassemble = print_insn_msp430; | |
226 | break; | |
227 | #endif | |
252b5132 RH |
228 | #ifdef ARCH_ns32k |
229 | case bfd_arch_ns32k: | |
230 | disassemble = print_insn_ns32k; | |
231 | break; | |
232 | #endif | |
233 | #ifdef ARCH_mcore | |
234 | case bfd_arch_mcore: | |
235 | disassemble = print_insn_mcore; | |
236 | break; | |
237 | #endif | |
238 | #ifdef ARCH_mips | |
239 | case bfd_arch_mips: | |
240 | if (bfd_big_endian (abfd)) | |
241 | disassemble = print_insn_big_mips; | |
242 | else | |
243 | disassemble = print_insn_little_mips; | |
244 | break; | |
245 | #endif | |
3c3bdf30 NC |
246 | #ifdef ARCH_mmix |
247 | case bfd_arch_mmix: | |
248 | disassemble = print_insn_mmix; | |
249 | break; | |
250 | #endif | |
252b5132 RH |
251 | #ifdef ARCH_mn10200 |
252 | case bfd_arch_mn10200: | |
253 | disassemble = print_insn_mn10200; | |
254 | break; | |
255 | #endif | |
256 | #ifdef ARCH_mn10300 | |
257 | case bfd_arch_mn10300: | |
258 | disassemble = print_insn_mn10300; | |
259 | break; | |
260 | #endif | |
87e6d782 NC |
261 | #ifdef ARCH_openrisc |
262 | case bfd_arch_openrisc: | |
263 | disassemble = print_insn_openrisc; | |
264 | break; | |
265 | #endif | |
3b16e843 NC |
266 | #ifdef ARCH_or32 |
267 | case bfd_arch_or32: | |
268 | if (bfd_big_endian (abfd)) | |
269 | disassemble = print_insn_big_or32; | |
270 | else | |
271 | disassemble = print_insn_little_or32; | |
272 | break; | |
273 | #endif | |
e135f41b NC |
274 | #ifdef ARCH_pdp11 |
275 | case bfd_arch_pdp11: | |
276 | disassemble = print_insn_pdp11; | |
277 | break; | |
278 | #endif | |
1e608f98 ILT |
279 | #ifdef ARCH_pj |
280 | case bfd_arch_pj: | |
281 | disassemble = print_insn_pj; | |
282 | break; | |
283 | #endif | |
252b5132 RH |
284 | #ifdef ARCH_powerpc |
285 | case bfd_arch_powerpc: | |
286 | if (bfd_big_endian (abfd)) | |
287 | disassemble = print_insn_big_powerpc; | |
288 | else | |
289 | disassemble = print_insn_little_powerpc; | |
290 | break; | |
291 | #endif | |
292 | #ifdef ARCH_rs6000 | |
293 | case bfd_arch_rs6000: | |
39c20e8f | 294 | if (bfd_get_mach (abfd) == bfd_mach_ppc_620) |
7f6d05e8 CP |
295 | disassemble = print_insn_big_powerpc; |
296 | else | |
297 | disassemble = print_insn_rs6000; | |
252b5132 RH |
298 | break; |
299 | #endif | |
a85d7ed0 NC |
300 | #ifdef ARCH_s390 |
301 | case bfd_arch_s390: | |
302 | disassemble = print_insn_s390; | |
303 | break; | |
304 | #endif | |
252b5132 RH |
305 | #ifdef ARCH_sh |
306 | case bfd_arch_sh: | |
1c509ca8 | 307 | disassemble = print_insn_sh; |
252b5132 RH |
308 | break; |
309 | #endif | |
310 | #ifdef ARCH_sparc | |
311 | case bfd_arch_sparc: | |
312 | disassemble = print_insn_sparc; | |
313 | break; | |
314 | #endif | |
315 | #ifdef ARCH_tic30 | |
316 | case bfd_arch_tic30: | |
317 | disassemble = print_insn_tic30; | |
318 | break; | |
319 | #endif | |
026df7c5 NC |
320 | #ifdef ARCH_tic4x |
321 | case bfd_arch_tic4x: | |
322 | disassemble = print_insn_tic4x; | |
323 | break; | |
324 | #endif | |
5c84d377 TW |
325 | #ifdef ARCH_tic54x |
326 | case bfd_arch_tic54x: | |
327 | disassemble = print_insn_tic54x; | |
328 | break; | |
329 | #endif | |
252b5132 RH |
330 | #ifdef ARCH_tic80 |
331 | case bfd_arch_tic80: | |
332 | disassemble = print_insn_tic80; | |
333 | break; | |
334 | #endif | |
335 | #ifdef ARCH_v850 | |
336 | case bfd_arch_v850: | |
337 | disassemble = print_insn_v850; | |
338 | break; | |
339 | #endif | |
340 | #ifdef ARCH_w65 | |
341 | case bfd_arch_w65: | |
342 | disassemble = print_insn_w65; | |
343 | break; | |
344 | #endif | |
93fbbb04 GK |
345 | #ifdef ARCH_xstormy16 |
346 | case bfd_arch_xstormy16: | |
347 | disassemble = print_insn_xstormy16; | |
348 | break; | |
349 | #endif | |
e0001a05 NC |
350 | #ifdef ARCH_xtensa |
351 | case bfd_arch_xtensa: | |
352 | disassemble = print_insn_xtensa; | |
353 | break; | |
354 | #endif | |
252b5132 RH |
355 | #ifdef ARCH_z8k |
356 | case bfd_arch_z8k: | |
357 | if (bfd_get_mach(abfd) == bfd_mach_z8001) | |
358 | disassemble = print_insn_z8001; | |
b7ed8fad | 359 | else |
252b5132 RH |
360 | disassemble = print_insn_z8002; |
361 | break; | |
362 | #endif | |
363 | #ifdef ARCH_vax | |
364 | case bfd_arch_vax: | |
365 | disassemble = print_insn_vax; | |
366 | break; | |
fd3c93d5 DB |
367 | #endif |
368 | #ifdef ARCH_frv | |
369 | case bfd_arch_frv: | |
370 | disassemble = print_insn_frv; | |
371 | break; | |
47b1a55a SC |
372 | #endif |
373 | #ifdef ARCH_iq2000 | |
374 | case bfd_arch_iq2000: | |
375 | disassemble = print_insn_iq2000; | |
376 | break; | |
252b5132 RH |
377 | #endif |
378 | default: | |
379 | return 0; | |
380 | } | |
381 | return disassemble; | |
382 | } | |
94470b23 NC |
383 | |
384 | void | |
9aaaa291 | 385 | disassembler_usage (stream) |
7f32bebc | 386 | FILE * stream ATTRIBUTE_UNUSED; |
94470b23 | 387 | { |
58efb6c0 NC |
388 | #ifdef ARCH_arm |
389 | print_arm_disassembler_options (stream); | |
390 | #endif | |
640c0ccd CD |
391 | #ifdef ARCH_mips |
392 | print_mips_disassembler_options (stream); | |
393 | #endif | |
07dd56a9 NC |
394 | #ifdef ARCH_powerpc |
395 | print_ppc_disassembler_options (stream); | |
396 | #endif | |
b7ed8fad | 397 | |
94470b23 NC |
398 | return; |
399 | } | |
22a398e1 NC |
400 | |
401 | void | |
402 | disassemble_init_for_target (struct disassemble_info * info) | |
403 | { | |
404 | if (info == NULL) | |
405 | return; | |
406 | ||
407 | switch (info->arch) | |
408 | { | |
409 | #ifdef ARCH_arm | |
410 | case bfd_arch_arm: | |
411 | info->symbol_is_valid = arm_symbol_is_valid; | |
412 | break; | |
413 | #endif | |
414 | default: | |
415 | break; | |
416 | } | |
417 | } |