Fix assembly of "callt 0x3f"
[binutils.git] / opcodes / disassemble.c
blob88fa63573a6760def1248130bb9b06875c824687
1 /* Select disassembly routine for specified architecture.
2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
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.
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.
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. */
19 #include "sysdep.h"
20 #include "dis-asm.h"
22 #ifdef ARCH_all
23 #define ARCH_a29k
24 #define ARCH_alpha
25 #define ARCH_arc
26 #define ARCH_arm
27 #define ARCH_avr
28 #define ARCH_cris
29 #define ARCH_d10v
30 #define ARCH_d30v
31 #define ARCH_dlx
32 #define ARCH_h8300
33 #define ARCH_h8500
34 #define ARCH_hppa
35 #define ARCH_i370
36 #define ARCH_i386
37 #define ARCH_i860
38 #define ARCH_i960
39 #define ARCH_ip2k
40 #define ARCH_ia64
41 #define ARCH_fr30
42 #define ARCH_m32r
43 #define ARCH_m68k
44 #define ARCH_m68hc11
45 #define ARCH_m68hc12
46 #define ARCH_m88k
47 #define ARCH_mcore
48 #define ARCH_mips
49 #define ARCH_mmix
50 #define ARCH_mn10200
51 #define ARCH_mn10300
52 #define ARCH_ns32k
53 #define ARCH_openrisc
54 #define ARCH_or32
55 #define ARCH_pdp11
56 #define ARCH_pj
57 #define ARCH_powerpc
58 #define ARCH_rs6000
59 #define ARCH_s390
60 #define ARCH_sh
61 #define ARCH_sparc
62 #define ARCH_tic30
63 #define ARCH_tic54x
64 #define ARCH_tic80
65 #define ARCH_v850
66 #define ARCH_vax
67 #define ARCH_w65
68 #define ARCH_xstormy16
69 #define ARCH_z8k
70 #define ARCH_frv
71 #define INCLUDE_SHMEDIA
72 #endif
75 disassembler_ftype
76 disassembler (abfd)
77 bfd *abfd;
79 enum bfd_architecture a = bfd_get_arch (abfd);
80 disassembler_ftype disassemble;
82 switch (a)
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:
100 disassemble = arc_get_disassembler (abfd);
101 break;
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
112 #ifdef ARCH_avr
113 case bfd_arch_avr:
114 disassemble = print_insn_avr;
115 break;
116 #endif
117 #ifdef ARCH_cris
118 case bfd_arch_cris:
119 disassemble = cris_get_disassembler (abfd);
120 break;
121 #endif
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
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
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;
144 else
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
158 #ifdef ARCH_i370
159 case bfd_arch_i370:
160 disassemble = print_insn_i370;
161 break;
162 #endif
163 #ifdef ARCH_i386
164 case bfd_arch_i386:
165 disassemble = print_insn_i386;
166 break;
167 #endif
168 #ifdef ARCH_i860
169 case bfd_arch_i860:
170 disassemble = print_insn_i860;
171 break;
172 #endif
173 #ifdef ARCH_i960
174 case bfd_arch_i960:
175 disassemble = print_insn_i960;
176 break;
177 #endif
178 #ifdef ARCH_ia64
179 case bfd_arch_ia64:
180 disassemble = print_insn_ia64;
181 break;
182 #endif
183 #ifdef ARCH_ip2k
184 case bfd_arch_ip2k:
185 disassemble = print_insn_ip2k;
186 break;
187 #endif
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
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
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
234 #ifdef ARCH_mmix
235 case bfd_arch_mmix:
236 disassemble = print_insn_mmix;
237 break;
238 #endif
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
249 #ifdef ARCH_openrisc
250 case bfd_arch_openrisc:
251 disassemble = print_insn_openrisc;
252 break;
253 #endif
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
262 #ifdef ARCH_pdp11
263 case bfd_arch_pdp11:
264 disassemble = print_insn_pdp11;
265 break;
266 #endif
267 #ifdef ARCH_pj
268 case bfd_arch_pj:
269 disassemble = print_insn_pj;
270 break;
271 #endif
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:
282 if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
283 disassemble = print_insn_big_powerpc;
284 else
285 disassemble = print_insn_rs6000;
286 break;
287 #endif
288 #ifdef ARCH_s390
289 case bfd_arch_s390:
290 disassemble = print_insn_s390;
291 break;
292 #endif
293 #ifdef ARCH_sh
294 case bfd_arch_sh:
295 disassemble = print_insn_sh;
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
308 #ifdef ARCH_tic54x
309 case bfd_arch_tic54x:
310 disassemble = print_insn_tic54x;
311 break;
312 #endif
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
328 #ifdef ARCH_xstormy16
329 case bfd_arch_xstormy16:
330 disassemble = print_insn_xstormy16;
331 break;
332 #endif
333 #ifdef ARCH_z8k
334 case bfd_arch_z8k:
335 if (bfd_get_mach(abfd) == bfd_mach_z8001)
336 disassemble = print_insn_z8001;
337 else
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;
345 #endif
346 #ifdef ARCH_frv
347 case bfd_arch_frv:
348 disassemble = print_insn_frv;
349 break;
350 #endif
351 default:
352 return 0;
354 return disassemble;
357 void
358 disassembler_usage (stream)
359 FILE * stream ATTRIBUTE_UNUSED;
361 #ifdef ARCH_arm
362 print_arm_disassembler_options (stream);
363 #endif
365 return;