Add support for msp430.
[deliverable/binutils-gdb.git] / opcodes / disassemble.c
1 /* Select disassembly routine for specified architecture.
2 Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
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
19 #include "sysdep.h"
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
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_msp430
53 #define ARCH_ns32k
54 #define ARCH_openrisc
55 #define ARCH_or32
56 #define ARCH_pdp11
57 #define ARCH_pj
58 #define ARCH_powerpc
59 #define ARCH_rs6000
60 #define ARCH_s390
61 #define ARCH_sh
62 #define ARCH_sparc
63 #define ARCH_tic30
64 #define ARCH_tic4x
65 #define ARCH_tic54x
66 #define ARCH_tic80
67 #define ARCH_v850
68 #define ARCH_vax
69 #define ARCH_w65
70 #define ARCH_xstormy16
71 #define ARCH_z8k
72 #define ARCH_frv
73 #define INCLUDE_SHMEDIA
74 #endif
75
76
77 disassembler_ftype
78 disassembler (abfd)
79 bfd *abfd;
80 {
81 enum bfd_architecture a = bfd_get_arch (abfd);
82 disassembler_ftype disassemble;
83
84 switch (a)
85 {
86 /* If you add a case to this table, also add it to the
87 ARCH_all definition right above this function. */
88 #ifdef ARCH_a29k
89 case bfd_arch_a29k:
90 /* As far as I know we only handle big-endian 29k objects. */
91 disassemble = print_insn_big_a29k;
92 break;
93 #endif
94 #ifdef ARCH_alpha
95 case bfd_arch_alpha:
96 disassemble = print_insn_alpha;
97 break;
98 #endif
99 #ifdef ARCH_arc
100 case bfd_arch_arc:
101 {
102 disassemble = arc_get_disassembler (abfd);
103 break;
104 }
105 #endif
106 #ifdef ARCH_arm
107 case bfd_arch_arm:
108 if (bfd_big_endian (abfd))
109 disassemble = print_insn_big_arm;
110 else
111 disassemble = print_insn_little_arm;
112 break;
113 #endif
114 #ifdef ARCH_avr
115 case bfd_arch_avr:
116 disassemble = print_insn_avr;
117 break;
118 #endif
119 #ifdef ARCH_cris
120 case bfd_arch_cris:
121 disassemble = cris_get_disassembler (abfd);
122 break;
123 #endif
124 #ifdef ARCH_d10v
125 case bfd_arch_d10v:
126 disassemble = print_insn_d10v;
127 break;
128 #endif
129 #ifdef ARCH_d30v
130 case bfd_arch_d30v:
131 disassemble = print_insn_d30v;
132 break;
133 #endif
134 #ifdef ARCH_dlx
135 case bfd_arch_dlx:
136 /* As far as I know we only handle big-endian DLX objects. */
137 disassemble = print_insn_dlx;
138 break;
139 #endif
140 #ifdef ARCH_h8300
141 case bfd_arch_h8300:
142 if (bfd_get_mach(abfd) == bfd_mach_h8300h)
143 disassemble = print_insn_h8300h;
144 else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
145 disassemble = print_insn_h8300s;
146 else
147 disassemble = print_insn_h8300;
148 break;
149 #endif
150 #ifdef ARCH_h8500
151 case bfd_arch_h8500:
152 disassemble = print_insn_h8500;
153 break;
154 #endif
155 #ifdef ARCH_hppa
156 case bfd_arch_hppa:
157 disassemble = print_insn_hppa;
158 break;
159 #endif
160 #ifdef ARCH_i370
161 case bfd_arch_i370:
162 disassemble = print_insn_i370;
163 break;
164 #endif
165 #ifdef ARCH_i386
166 case bfd_arch_i386:
167 disassemble = print_insn_i386;
168 break;
169 #endif
170 #ifdef ARCH_i860
171 case bfd_arch_i860:
172 disassemble = print_insn_i860;
173 break;
174 #endif
175 #ifdef ARCH_i960
176 case bfd_arch_i960:
177 disassemble = print_insn_i960;
178 break;
179 #endif
180 #ifdef ARCH_ia64
181 case bfd_arch_ia64:
182 disassemble = print_insn_ia64;
183 break;
184 #endif
185 #ifdef ARCH_ip2k
186 case bfd_arch_ip2k:
187 disassemble = print_insn_ip2k;
188 break;
189 #endif
190 #ifdef ARCH_fr30
191 case bfd_arch_fr30:
192 disassemble = print_insn_fr30;
193 break;
194 #endif
195 #ifdef ARCH_m32r
196 case bfd_arch_m32r:
197 disassemble = print_insn_m32r;
198 break;
199 #endif
200 #if defined(ARCH_m68hc11) || defined(ARCH_m68hc12)
201 case bfd_arch_m68hc11:
202 disassemble = print_insn_m68hc11;
203 break;
204 case bfd_arch_m68hc12:
205 disassemble = print_insn_m68hc12;
206 break;
207 #endif
208 #ifdef ARCH_m68k
209 case bfd_arch_m68k:
210 disassemble = print_insn_m68k;
211 break;
212 #endif
213 #ifdef ARCH_m88k
214 case bfd_arch_m88k:
215 disassemble = print_insn_m88k;
216 break;
217 #endif
218 #ifdef ARCH_msp430
219 case bfd_arch_msp430:
220 disassemble = print_insn_msp430;
221 break;
222 #endif
223 #ifdef ARCH_ns32k
224 case bfd_arch_ns32k:
225 disassemble = print_insn_ns32k;
226 break;
227 #endif
228 #ifdef ARCH_mcore
229 case bfd_arch_mcore:
230 disassemble = print_insn_mcore;
231 break;
232 #endif
233 #ifdef ARCH_mips
234 case bfd_arch_mips:
235 if (bfd_big_endian (abfd))
236 disassemble = print_insn_big_mips;
237 else
238 disassemble = print_insn_little_mips;
239 break;
240 #endif
241 #ifdef ARCH_mmix
242 case bfd_arch_mmix:
243 disassemble = print_insn_mmix;
244 break;
245 #endif
246 #ifdef ARCH_mn10200
247 case bfd_arch_mn10200:
248 disassemble = print_insn_mn10200;
249 break;
250 #endif
251 #ifdef ARCH_mn10300
252 case bfd_arch_mn10300:
253 disassemble = print_insn_mn10300;
254 break;
255 #endif
256 #ifdef ARCH_openrisc
257 case bfd_arch_openrisc:
258 disassemble = print_insn_openrisc;
259 break;
260 #endif
261 #ifdef ARCH_or32
262 case bfd_arch_or32:
263 if (bfd_big_endian (abfd))
264 disassemble = print_insn_big_or32;
265 else
266 disassemble = print_insn_little_or32;
267 break;
268 #endif
269 #ifdef ARCH_pdp11
270 case bfd_arch_pdp11:
271 disassemble = print_insn_pdp11;
272 break;
273 #endif
274 #ifdef ARCH_pj
275 case bfd_arch_pj:
276 disassemble = print_insn_pj;
277 break;
278 #endif
279 #ifdef ARCH_powerpc
280 case bfd_arch_powerpc:
281 if (bfd_big_endian (abfd))
282 disassemble = print_insn_big_powerpc;
283 else
284 disassemble = print_insn_little_powerpc;
285 break;
286 #endif
287 #ifdef ARCH_rs6000
288 case bfd_arch_rs6000:
289 if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
290 disassemble = print_insn_big_powerpc;
291 else
292 disassemble = print_insn_rs6000;
293 break;
294 #endif
295 #ifdef ARCH_s390
296 case bfd_arch_s390:
297 disassemble = print_insn_s390;
298 break;
299 #endif
300 #ifdef ARCH_sh
301 case bfd_arch_sh:
302 disassemble = print_insn_sh;
303 break;
304 #endif
305 #ifdef ARCH_sparc
306 case bfd_arch_sparc:
307 disassemble = print_insn_sparc;
308 break;
309 #endif
310 #ifdef ARCH_tic30
311 case bfd_arch_tic30:
312 disassemble = print_insn_tic30;
313 break;
314 #endif
315 #ifdef ARCH_tic4x
316 case bfd_arch_tic4x:
317 disassemble = print_insn_tic4x;
318 break;
319 #endif
320 #ifdef ARCH_tic54x
321 case bfd_arch_tic54x:
322 disassemble = print_insn_tic54x;
323 break;
324 #endif
325 #ifdef ARCH_tic80
326 case bfd_arch_tic80:
327 disassemble = print_insn_tic80;
328 break;
329 #endif
330 #ifdef ARCH_v850
331 case bfd_arch_v850:
332 disassemble = print_insn_v850;
333 break;
334 #endif
335 #ifdef ARCH_w65
336 case bfd_arch_w65:
337 disassemble = print_insn_w65;
338 break;
339 #endif
340 #ifdef ARCH_xstormy16
341 case bfd_arch_xstormy16:
342 disassemble = print_insn_xstormy16;
343 break;
344 #endif
345 #ifdef ARCH_z8k
346 case bfd_arch_z8k:
347 if (bfd_get_mach(abfd) == bfd_mach_z8001)
348 disassemble = print_insn_z8001;
349 else
350 disassemble = print_insn_z8002;
351 break;
352 #endif
353 #ifdef ARCH_vax
354 case bfd_arch_vax:
355 disassemble = print_insn_vax;
356 break;
357 #endif
358 #ifdef ARCH_frv
359 case bfd_arch_frv:
360 disassemble = print_insn_frv;
361 break;
362 #endif
363 default:
364 return 0;
365 }
366 return disassemble;
367 }
368
369 void
370 disassembler_usage (stream)
371 FILE * stream ATTRIBUTE_UNUSED;
372 {
373 #ifdef ARCH_arm
374 print_arm_disassembler_options (stream);
375 #endif
376 #ifdef ARCH_mips
377 print_mips_disassembler_options (stream);
378 #endif
379 #ifdef ARCH_powerpc
380 print_ppc_disassembler_options (stream);
381 #endif
382
383 return;
384 }
This page took 0.038683 seconds and 4 git commands to generate.