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