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