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