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