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