]>
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: | |
52b15da3 JH |
153 | if (bfd_get_mach (abfd) == bfd_mach_i386_i386_intel_syntax |
154 | || bfd_get_mach (abfd) == bfd_mach_x86_64_intel_syntax) | |
252b5132 RH |
155 | disassemble = print_insn_i386_intel; |
156 | else | |
157 | disassemble = print_insn_i386_att; | |
158 | break; | |
159 | #endif | |
9d751335 JE |
160 | #ifdef ARCH_i860 |
161 | case bfd_arch_i860: | |
162 | disassemble = print_insn_i860; | |
163 | break; | |
164 | #endif | |
252b5132 RH |
165 | #ifdef ARCH_i960 |
166 | case bfd_arch_i960: | |
167 | disassemble = print_insn_i960; | |
168 | break; | |
169 | #endif | |
800eeca4 JW |
170 | #ifdef ARCH_ia64 |
171 | case bfd_arch_ia64: | |
172 | disassemble = print_insn_ia64; | |
173 | break; | |
174 | #endif | |
252b5132 RH |
175 | #ifdef ARCH_fr30 |
176 | case bfd_arch_fr30: | |
177 | disassemble = print_insn_fr30; | |
178 | break; | |
179 | #endif | |
180 | #ifdef ARCH_m32r | |
181 | case bfd_arch_m32r: | |
182 | disassemble = print_insn_m32r; | |
183 | break; | |
184 | #endif | |
60bcf0fa NC |
185 | #if defined(ARCH_m68hc11) || defined(ARCH_m68hc12) |
186 | case bfd_arch_m68hc11: | |
187 | disassemble = print_insn_m68hc11; | |
188 | break; | |
189 | case bfd_arch_m68hc12: | |
190 | disassemble = print_insn_m68hc12; | |
191 | break; | |
192 | #endif | |
252b5132 RH |
193 | #ifdef ARCH_m68k |
194 | case bfd_arch_m68k: | |
195 | disassemble = print_insn_m68k; | |
196 | break; | |
197 | #endif | |
198 | #ifdef ARCH_m88k | |
199 | case bfd_arch_m88k: | |
200 | disassemble = print_insn_m88k; | |
201 | break; | |
202 | #endif | |
203 | #ifdef ARCH_ns32k | |
204 | case bfd_arch_ns32k: | |
205 | disassemble = print_insn_ns32k; | |
206 | break; | |
207 | #endif | |
208 | #ifdef ARCH_mcore | |
209 | case bfd_arch_mcore: | |
210 | disassemble = print_insn_mcore; | |
211 | break; | |
212 | #endif | |
213 | #ifdef ARCH_mips | |
214 | case bfd_arch_mips: | |
215 | if (bfd_big_endian (abfd)) | |
216 | disassemble = print_insn_big_mips; | |
217 | else | |
218 | disassemble = print_insn_little_mips; | |
219 | break; | |
220 | #endif | |
3c3bdf30 NC |
221 | #ifdef ARCH_mmix |
222 | case bfd_arch_mmix: | |
223 | disassemble = print_insn_mmix; | |
224 | break; | |
225 | #endif | |
252b5132 RH |
226 | #ifdef ARCH_mn10200 |
227 | case bfd_arch_mn10200: | |
228 | disassemble = print_insn_mn10200; | |
229 | break; | |
230 | #endif | |
231 | #ifdef ARCH_mn10300 | |
232 | case bfd_arch_mn10300: | |
233 | disassemble = print_insn_mn10300; | |
234 | break; | |
235 | #endif | |
87e6d782 NC |
236 | #ifdef ARCH_openrisc |
237 | case bfd_arch_openrisc: | |
238 | disassemble = print_insn_openrisc; | |
239 | break; | |
240 | #endif | |
e135f41b NC |
241 | #ifdef ARCH_pdp11 |
242 | case bfd_arch_pdp11: | |
243 | disassemble = print_insn_pdp11; | |
244 | break; | |
245 | #endif | |
1e608f98 ILT |
246 | #ifdef ARCH_pj |
247 | case bfd_arch_pj: | |
248 | disassemble = print_insn_pj; | |
249 | break; | |
250 | #endif | |
252b5132 RH |
251 | #ifdef ARCH_powerpc |
252 | case bfd_arch_powerpc: | |
253 | if (bfd_big_endian (abfd)) | |
254 | disassemble = print_insn_big_powerpc; | |
255 | else | |
256 | disassemble = print_insn_little_powerpc; | |
257 | break; | |
258 | #endif | |
259 | #ifdef ARCH_rs6000 | |
260 | case bfd_arch_rs6000: | |
39c20e8f | 261 | if (bfd_get_mach (abfd) == bfd_mach_ppc_620) |
7f6d05e8 CP |
262 | disassemble = print_insn_big_powerpc; |
263 | else | |
264 | disassemble = print_insn_rs6000; | |
252b5132 RH |
265 | break; |
266 | #endif | |
a85d7ed0 NC |
267 | #ifdef ARCH_s390 |
268 | case bfd_arch_s390: | |
269 | disassemble = print_insn_s390; | |
270 | break; | |
271 | #endif | |
252b5132 RH |
272 | #ifdef ARCH_sh |
273 | case bfd_arch_sh: | |
274 | if (bfd_big_endian (abfd)) | |
275 | disassemble = print_insn_sh; | |
276 | else | |
277 | disassemble = print_insn_shl; | |
278 | break; | |
279 | #endif | |
280 | #ifdef ARCH_sparc | |
281 | case bfd_arch_sparc: | |
282 | disassemble = print_insn_sparc; | |
283 | break; | |
284 | #endif | |
285 | #ifdef ARCH_tic30 | |
286 | case bfd_arch_tic30: | |
287 | disassemble = print_insn_tic30; | |
288 | break; | |
289 | #endif | |
5c84d377 TW |
290 | #ifdef ARCH_tic54x |
291 | case bfd_arch_tic54x: | |
292 | disassemble = print_insn_tic54x; | |
293 | break; | |
294 | #endif | |
252b5132 RH |
295 | #ifdef ARCH_tic80 |
296 | case bfd_arch_tic80: | |
297 | disassemble = print_insn_tic80; | |
298 | break; | |
299 | #endif | |
300 | #ifdef ARCH_v850 | |
301 | case bfd_arch_v850: | |
302 | disassemble = print_insn_v850; | |
303 | break; | |
304 | #endif | |
305 | #ifdef ARCH_w65 | |
306 | case bfd_arch_w65: | |
307 | disassemble = print_insn_w65; | |
308 | break; | |
309 | #endif | |
310 | #ifdef ARCH_z8k | |
311 | case bfd_arch_z8k: | |
312 | if (bfd_get_mach(abfd) == bfd_mach_z8001) | |
313 | disassemble = print_insn_z8001; | |
b7ed8fad | 314 | else |
252b5132 RH |
315 | disassemble = print_insn_z8002; |
316 | break; | |
317 | #endif | |
318 | #ifdef ARCH_vax | |
319 | case bfd_arch_vax: | |
320 | disassemble = print_insn_vax; | |
321 | break; | |
322 | #endif | |
323 | default: | |
324 | return 0; | |
325 | } | |
326 | return disassemble; | |
327 | } | |
94470b23 NC |
328 | |
329 | void | |
9aaaa291 | 330 | disassembler_usage (stream) |
7f32bebc | 331 | FILE * stream ATTRIBUTE_UNUSED; |
94470b23 | 332 | { |
58efb6c0 NC |
333 | #ifdef ARCH_arm |
334 | print_arm_disassembler_options (stream); | |
335 | #endif | |
b7ed8fad | 336 | |
94470b23 NC |
337 | return; |
338 | } |