2000-05-23 H.J. Lu <hjl@gnu.org>
[deliverable/binutils-gdb.git] / opcodes / disassemble.c
CommitLineData
252b5132 1/* Select disassembly routine for specified architecture.
5b93d8bb
AM
2 Copyright (C) 1994, 95, 96, 97, 98, 99, 2000
3 Free Software Foundation, Inc.
252b5132
RH
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation; either version 2 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, 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
252b5132
RH
28#define ARCH_d10v
29#define ARCH_d30v
30#define ARCH_h8300
31#define ARCH_h8500
32#define ARCH_hppa
5b93d8bb 33#define ARCH_i370
252b5132
RH
34#define ARCH_i386
35#define ARCH_i960
800eeca4 36#define ARCH_ia64
252b5132
RH
37#define ARCH_fr30
38#define ARCH_m32r
39#define ARCH_m68k
40#define ARCH_m88k
41#define ARCH_mcore
42#define ARCH_mips
43#define ARCH_mn10200
44#define ARCH_mn10300
45#define ARCH_ns32k
1e608f98 46#define ARCH_pj
252b5132
RH
47#define ARCH_powerpc
48#define ARCH_rs6000
49#define ARCH_sh
50#define ARCH_sparc
51#define ARCH_tic30
5c84d377 52#define ARCH_tic54x
252b5132
RH
53#define ARCH_tic80
54#define ARCH_v850
55#define ARCH_vax
56#define ARCH_w65
57#define ARCH_z8k
58#endif
59
60
61disassembler_ftype
62disassembler (abfd)
63 bfd *abfd;
64{
65 enum bfd_architecture a = bfd_get_arch (abfd);
66 disassembler_ftype disassemble;
67
68 switch (a)
69 {
70 /* If you add a case to this table, also add it to the
71 ARCH_all definition right above this function. */
72#ifdef ARCH_a29k
73 case bfd_arch_a29k:
74 /* As far as I know we only handle big-endian 29k objects. */
75 disassemble = print_insn_big_a29k;
76 break;
77#endif
78#ifdef ARCH_alpha
79 case bfd_arch_alpha:
80 disassemble = print_insn_alpha;
81 break;
82#endif
83#ifdef ARCH_arc
84 case bfd_arch_arc:
85 {
86 disassemble = arc_get_disassembler (bfd_get_mach (abfd),
87 bfd_big_endian (abfd));
88 break;
89 }
90#endif
91#ifdef ARCH_arm
92 case bfd_arch_arm:
93 if (bfd_big_endian (abfd))
94 disassemble = print_insn_big_arm;
95 else
96 disassemble = print_insn_little_arm;
97 break;
98#endif
adde6300
AM
99#ifdef ARCH_avr
100 case bfd_arch_avr:
101 disassemble = print_insn_avr;
102 break;
103#endif
252b5132
RH
104#ifdef ARCH_d10v
105 case bfd_arch_d10v:
106 disassemble = print_insn_d10v;
107 break;
108#endif
109#ifdef ARCH_d30v
110 case bfd_arch_d30v:
111 disassemble = print_insn_d30v;
112 break;
113#endif
114#ifdef ARCH_h8300
115 case bfd_arch_h8300:
116 if (bfd_get_mach(abfd) == bfd_mach_h8300h)
117 disassemble = print_insn_h8300h;
118 else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
119 disassemble = print_insn_h8300s;
120 else
121 disassemble = print_insn_h8300;
122 break;
123#endif
124#ifdef ARCH_h8500
125 case bfd_arch_h8500:
126 disassemble = print_insn_h8500;
127 break;
128#endif
129#ifdef ARCH_hppa
130 case bfd_arch_hppa:
131 disassemble = print_insn_hppa;
132 break;
133#endif
5b93d8bb
AM
134#ifdef ARCH_i370
135 case bfd_arch_i370:
136 disassemble = print_insn_i370;
137 break;
138#endif
252b5132
RH
139#ifdef ARCH_i386
140 case bfd_arch_i386:
141 if (bfd_get_mach (abfd) == bfd_mach_i386_i386_intel_syntax)
142 disassemble = print_insn_i386_intel;
143 else
144 disassemble = print_insn_i386_att;
145 break;
146#endif
147#ifdef ARCH_i960
148 case bfd_arch_i960:
149 disassemble = print_insn_i960;
150 break;
151#endif
800eeca4
JW
152#ifdef ARCH_ia64
153 case bfd_arch_ia64:
154 disassemble = print_insn_ia64;
155 break;
156#endif
252b5132
RH
157#ifdef ARCH_fr30
158 case bfd_arch_fr30:
159 disassemble = print_insn_fr30;
160 break;
161#endif
162#ifdef ARCH_m32r
163 case bfd_arch_m32r:
164 disassemble = print_insn_m32r;
165 break;
166#endif
167#ifdef ARCH_m68k
168 case bfd_arch_m68k:
169 disassemble = print_insn_m68k;
170 break;
171#endif
172#ifdef ARCH_m88k
173 case bfd_arch_m88k:
174 disassemble = print_insn_m88k;
175 break;
176#endif
177#ifdef ARCH_ns32k
178 case bfd_arch_ns32k:
179 disassemble = print_insn_ns32k;
180 break;
181#endif
182#ifdef ARCH_mcore
183 case bfd_arch_mcore:
184 disassemble = print_insn_mcore;
185 break;
186#endif
187#ifdef ARCH_mips
188 case bfd_arch_mips:
189 if (bfd_big_endian (abfd))
190 disassemble = print_insn_big_mips;
191 else
192 disassemble = print_insn_little_mips;
193 break;
194#endif
195#ifdef ARCH_mn10200
196 case bfd_arch_mn10200:
197 disassemble = print_insn_mn10200;
198 break;
199#endif
200#ifdef ARCH_mn10300
201 case bfd_arch_mn10300:
202 disassemble = print_insn_mn10300;
203 break;
204#endif
1e608f98
ILT
205#ifdef ARCH_pj
206 case bfd_arch_pj:
207 disassemble = print_insn_pj;
208 break;
209#endif
252b5132
RH
210#ifdef ARCH_powerpc
211 case bfd_arch_powerpc:
212 if (bfd_big_endian (abfd))
213 disassemble = print_insn_big_powerpc;
214 else
215 disassemble = print_insn_little_powerpc;
216 break;
217#endif
218#ifdef ARCH_rs6000
219 case bfd_arch_rs6000:
7f6d05e8
CP
220 if (bfd_get_mach (abfd) == 620)
221 disassemble = print_insn_big_powerpc;
222 else
223 disassemble = print_insn_rs6000;
252b5132
RH
224 break;
225#endif
226#ifdef ARCH_sh
227 case bfd_arch_sh:
228 if (bfd_big_endian (abfd))
229 disassemble = print_insn_sh;
230 else
231 disassemble = print_insn_shl;
232 break;
233#endif
234#ifdef ARCH_sparc
235 case bfd_arch_sparc:
236 disassemble = print_insn_sparc;
237 break;
238#endif
239#ifdef ARCH_tic30
240 case bfd_arch_tic30:
241 disassemble = print_insn_tic30;
242 break;
243#endif
5c84d377
TW
244#ifdef ARCH_tic54x
245 case bfd_arch_tic54x:
246 disassemble = print_insn_tic54x;
247 break;
248#endif
252b5132
RH
249#ifdef ARCH_tic80
250 case bfd_arch_tic80:
251 disassemble = print_insn_tic80;
252 break;
253#endif
254#ifdef ARCH_v850
255 case bfd_arch_v850:
256 disassemble = print_insn_v850;
257 break;
258#endif
259#ifdef ARCH_w65
260 case bfd_arch_w65:
261 disassemble = print_insn_w65;
262 break;
263#endif
264#ifdef ARCH_z8k
265 case bfd_arch_z8k:
266 if (bfd_get_mach(abfd) == bfd_mach_z8001)
267 disassemble = print_insn_z8001;
268 else
269 disassemble = print_insn_z8002;
270 break;
271#endif
272#ifdef ARCH_vax
273 case bfd_arch_vax:
274 disassemble = print_insn_vax;
275 break;
276#endif
277 default:
278 return 0;
279 }
280 return disassemble;
281}
94470b23
NC
282
283void
9aaaa291
ILT
284disassembler_usage (stream)
285 FILE *stream ATTRIBUTE_UNUSED;
94470b23 286{
58efb6c0
NC
287#ifdef ARCH_arm
288 print_arm_disassembler_options (stream);
289#endif
290
94470b23
NC
291 return;
292}
This page took 0.060912 seconds and 4 git commands to generate.