Applied Stephane Carrez <Stephane.Carrez@worldnet.fr> patches to add support
[deliverable/binutils-gdb.git] / opcodes / disassemble.c
1 /* Select disassembly routine for specified architecture.
2 Copyright (C) 1994, 95, 96, 97, 98, 99, 2000
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_d10v
29 #define ARCH_d30v
30 #define ARCH_h8300
31 #define ARCH_h8500
32 #define ARCH_hppa
33 #define ARCH_i370
34 #define ARCH_i386
35 #define ARCH_i960
36 #define ARCH_ia64
37 #define ARCH_fr30
38 #define ARCH_m32r
39 #define ARCH_m68k
40 #define ARCH_m68hc11
41 #define ARCH_m68hc12
42 #define ARCH_m88k
43 #define ARCH_mcore
44 #define ARCH_mips
45 #define ARCH_mn10200
46 #define ARCH_mn10300
47 #define ARCH_ns32k
48 #define ARCH_pj
49 #define ARCH_powerpc
50 #define ARCH_rs6000
51 #define ARCH_sh
52 #define ARCH_sparc
53 #define ARCH_tic30
54 #define ARCH_tic54x
55 #define ARCH_tic80
56 #define ARCH_v850
57 #define ARCH_vax
58 #define ARCH_w65
59 #define ARCH_z8k
60 #endif
61
62
63 disassembler_ftype
64 disassembler (abfd)
65 bfd *abfd;
66 {
67 enum bfd_architecture a = bfd_get_arch (abfd);
68 disassembler_ftype disassemble;
69
70 switch (a)
71 {
72 /* If you add a case to this table, also add it to the
73 ARCH_all definition right above this function. */
74 #ifdef ARCH_a29k
75 case bfd_arch_a29k:
76 /* As far as I know we only handle big-endian 29k objects. */
77 disassemble = print_insn_big_a29k;
78 break;
79 #endif
80 #ifdef ARCH_alpha
81 case bfd_arch_alpha:
82 disassemble = print_insn_alpha;
83 break;
84 #endif
85 #ifdef ARCH_arc
86 case bfd_arch_arc:
87 {
88 disassemble = arc_get_disassembler (bfd_get_mach (abfd),
89 bfd_big_endian (abfd));
90 break;
91 }
92 #endif
93 #ifdef ARCH_arm
94 case bfd_arch_arm:
95 if (bfd_big_endian (abfd))
96 disassemble = print_insn_big_arm;
97 else
98 disassemble = print_insn_little_arm;
99 break;
100 #endif
101 #ifdef ARCH_avr
102 case bfd_arch_avr:
103 disassemble = print_insn_avr;
104 break;
105 #endif
106 #ifdef ARCH_d10v
107 case bfd_arch_d10v:
108 disassemble = print_insn_d10v;
109 break;
110 #endif
111 #ifdef ARCH_d30v
112 case bfd_arch_d30v:
113 disassemble = print_insn_d30v;
114 break;
115 #endif
116 #ifdef ARCH_h8300
117 case bfd_arch_h8300:
118 if (bfd_get_mach(abfd) == bfd_mach_h8300h)
119 disassemble = print_insn_h8300h;
120 else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
121 disassemble = print_insn_h8300s;
122 else
123 disassemble = print_insn_h8300;
124 break;
125 #endif
126 #ifdef ARCH_h8500
127 case bfd_arch_h8500:
128 disassemble = print_insn_h8500;
129 break;
130 #endif
131 #ifdef ARCH_hppa
132 case bfd_arch_hppa:
133 disassemble = print_insn_hppa;
134 break;
135 #endif
136 #ifdef ARCH_i370
137 case bfd_arch_i370:
138 disassemble = print_insn_i370;
139 break;
140 #endif
141 #ifdef ARCH_i386
142 case bfd_arch_i386:
143 if (bfd_get_mach (abfd) == bfd_mach_i386_i386_intel_syntax)
144 disassemble = print_insn_i386_intel;
145 else
146 disassemble = print_insn_i386_att;
147 break;
148 #endif
149 #ifdef ARCH_i960
150 case bfd_arch_i960:
151 disassemble = print_insn_i960;
152 break;
153 #endif
154 #ifdef ARCH_ia64
155 case bfd_arch_ia64:
156 disassemble = print_insn_ia64;
157 break;
158 #endif
159 #ifdef ARCH_fr30
160 case bfd_arch_fr30:
161 disassemble = print_insn_fr30;
162 break;
163 #endif
164 #ifdef ARCH_m32r
165 case bfd_arch_m32r:
166 disassemble = print_insn_m32r;
167 break;
168 #endif
169 #if defined(ARCH_m68hc11) || defined(ARCH_m68hc12)
170 case bfd_arch_m68hc11:
171 disassemble = print_insn_m68hc11;
172 break;
173 case bfd_arch_m68hc12:
174 disassemble = print_insn_m68hc12;
175 break;
176 #endif
177 #ifdef ARCH_m68k
178 case bfd_arch_m68k:
179 disassemble = print_insn_m68k;
180 break;
181 #endif
182 #ifdef ARCH_m88k
183 case bfd_arch_m88k:
184 disassemble = print_insn_m88k;
185 break;
186 #endif
187 #ifdef ARCH_ns32k
188 case bfd_arch_ns32k:
189 disassemble = print_insn_ns32k;
190 break;
191 #endif
192 #ifdef ARCH_mcore
193 case bfd_arch_mcore:
194 disassemble = print_insn_mcore;
195 break;
196 #endif
197 #ifdef ARCH_mips
198 case bfd_arch_mips:
199 if (bfd_big_endian (abfd))
200 disassemble = print_insn_big_mips;
201 else
202 disassemble = print_insn_little_mips;
203 break;
204 #endif
205 #ifdef ARCH_mn10200
206 case bfd_arch_mn10200:
207 disassemble = print_insn_mn10200;
208 break;
209 #endif
210 #ifdef ARCH_mn10300
211 case bfd_arch_mn10300:
212 disassemble = print_insn_mn10300;
213 break;
214 #endif
215 #ifdef ARCH_pj
216 case bfd_arch_pj:
217 disassemble = print_insn_pj;
218 break;
219 #endif
220 #ifdef ARCH_powerpc
221 case bfd_arch_powerpc:
222 if (bfd_big_endian (abfd))
223 disassemble = print_insn_big_powerpc;
224 else
225 disassemble = print_insn_little_powerpc;
226 break;
227 #endif
228 #ifdef ARCH_rs6000
229 case bfd_arch_rs6000:
230 if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
231 disassemble = print_insn_big_powerpc;
232 else
233 disassemble = print_insn_rs6000;
234 break;
235 #endif
236 #ifdef ARCH_sh
237 case bfd_arch_sh:
238 if (bfd_big_endian (abfd))
239 disassemble = print_insn_sh;
240 else
241 disassemble = print_insn_shl;
242 break;
243 #endif
244 #ifdef ARCH_sparc
245 case bfd_arch_sparc:
246 disassemble = print_insn_sparc;
247 break;
248 #endif
249 #ifdef ARCH_tic30
250 case bfd_arch_tic30:
251 disassemble = print_insn_tic30;
252 break;
253 #endif
254 #ifdef ARCH_tic54x
255 case bfd_arch_tic54x:
256 disassemble = print_insn_tic54x;
257 break;
258 #endif
259 #ifdef ARCH_tic80
260 case bfd_arch_tic80:
261 disassemble = print_insn_tic80;
262 break;
263 #endif
264 #ifdef ARCH_v850
265 case bfd_arch_v850:
266 disassemble = print_insn_v850;
267 break;
268 #endif
269 #ifdef ARCH_w65
270 case bfd_arch_w65:
271 disassemble = print_insn_w65;
272 break;
273 #endif
274 #ifdef ARCH_z8k
275 case bfd_arch_z8k:
276 if (bfd_get_mach(abfd) == bfd_mach_z8001)
277 disassemble = print_insn_z8001;
278 else
279 disassemble = print_insn_z8002;
280 break;
281 #endif
282 #ifdef ARCH_vax
283 case bfd_arch_vax:
284 disassemble = print_insn_vax;
285 break;
286 #endif
287 default:
288 return 0;
289 }
290 return disassemble;
291 }
292
293 void
294 disassembler_usage (stream)
295 FILE * stream ATTRIBUTE_UNUSED;
296 {
297 #ifdef ARCH_arm
298 print_arm_disassembler_options (stream);
299 #endif
300
301 return;
302 }
This page took 0.037415 seconds and 5 git commands to generate.