a366264d489a71954c6f605cc3079b19cbf88908
[deliverable/binutils-gdb.git] / opcodes / disassemble.c
1 /* Select disassembly routine for specified architecture.
2 Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17
18 #include "ansidecl.h"
19 #include "dis-asm.h"
20
21 #ifdef ARCH_all
22 #define ARCH_a29k
23 #define ARCH_alpha
24 #define ARCH_arc
25 #define ARCH_arm
26 #define ARCH_d10v
27 /* start-sanitize-d30v */
28 #define ARCH_d30v
29 /* end-sanitize-d30v */
30 #define ARCH_h8300
31 #define ARCH_h8500
32 #define ARCH_hppa
33 #define ARCH_i386
34 #define ARCH_i960
35 #define ARCH_m32r
36 #define ARCH_m68k
37 #define ARCH_m88k
38 #define ARCH_mips
39 #define ARCH_mn10200
40 #define ARCH_mn10300
41 #define ARCH_ns32k
42 #define ARCH_powerpc
43 #define ARCH_rs6000
44 #define ARCH_sh
45 #define ARCH_sparc
46 /* start-sanitize-tic80 */
47 #define ARCH_tic80
48 /* end-sanitize-tic80 */
49 /* start-sanitize-sky */
50 #define ARCH_txvu
51 /* end-sanitize-sky */
52 #define ARCH_v850
53 #define ARCH_w65
54 #define ARCH_z8k
55 #endif
56
57 disassembler_ftype
58 disassembler (abfd)
59 bfd *abfd;
60 {
61 enum bfd_architecture a = bfd_get_arch (abfd);
62 disassembler_ftype disassemble;
63
64 switch (a)
65 {
66 /* If you add a case to this table, also add it to the
67 ARCH_all definition right above this function. */
68 #ifdef ARCH_a29k
69 case bfd_arch_a29k:
70 /* As far as I know we only handle big-endian 29k objects. */
71 disassemble = print_insn_big_a29k;
72 break;
73 #endif
74 #ifdef ARCH_alpha
75 case bfd_arch_alpha:
76 disassemble = print_insn_alpha;
77 break;
78 #endif
79 #ifdef ARCH_arc
80 case bfd_arch_arc:
81 {
82 disassemble = arc_get_disassembler (bfd_get_mach (abfd),
83 bfd_big_endian (abfd));
84 break;
85 }
86 #endif
87 #ifdef ARCH_arm
88 case bfd_arch_arm:
89 if (bfd_big_endian (abfd))
90 disassemble = print_insn_big_arm;
91 else
92 disassemble = print_insn_little_arm;
93 break;
94 #endif
95 #ifdef ARCH_d10v
96 case bfd_arch_d10v:
97 disassemble = print_insn_d10v;
98 break;
99 #endif
100 /* start-sanitize-d30v */
101 #ifdef ARCH_d30v
102 case bfd_arch_d30v:
103 disassemble = print_insn_d30v;
104 break;
105 #endif
106 /* end-sanitize-d30v */
107 #ifdef ARCH_h8300
108 case bfd_arch_h8300:
109 if (bfd_get_mach(abfd) == bfd_mach_h8300h)
110 disassemble = print_insn_h8300h;
111 else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
112 disassemble = print_insn_h8300s;
113 else
114 disassemble = print_insn_h8300;
115 break;
116 #endif
117 #ifdef ARCH_h8500
118 case bfd_arch_h8500:
119 disassemble = print_insn_h8500;
120 break;
121 #endif
122 #ifdef ARCH_hppa
123 case bfd_arch_hppa:
124 disassemble = print_insn_hppa;
125 break;
126 #endif
127 #ifdef ARCH_i386
128 case bfd_arch_i386:
129 disassemble = print_insn_i386;
130 break;
131 #endif
132 #ifdef ARCH_i960
133 case bfd_arch_i960:
134 disassemble = print_insn_i960;
135 break;
136 #endif
137 #ifdef ARCH_m32r
138 case bfd_arch_m32r:
139 disassemble = print_insn_m32r;
140 break;
141 #endif
142 #ifdef ARCH_m68k
143 case bfd_arch_m68k:
144 disassemble = print_insn_m68k;
145 break;
146 #endif
147 #ifdef ARCH_m88k
148 case bfd_arch_m88k:
149 disassemble = print_insn_m88k;
150 break;
151 #endif
152 #ifdef ARCH_ns32k
153 case bfd_arch_ns32k:
154 disassemble = print_insn_ns32k;
155 break;
156 #endif
157 #ifdef ARCH_mips
158 case bfd_arch_mips:
159 if (bfd_big_endian (abfd))
160 disassemble = print_insn_big_mips;
161 else
162 disassemble = print_insn_little_mips;
163 break;
164 #endif
165 #ifdef ARCH_mn10200
166 case bfd_arch_mn10200:
167 disassemble = print_insn_mn10200;
168 break;
169 #endif
170 #ifdef ARCH_mn10300
171 case bfd_arch_mn10300:
172 disassemble = print_insn_mn10300;
173 break;
174 #endif
175 #ifdef ARCH_powerpc
176 case bfd_arch_powerpc:
177 if (bfd_big_endian (abfd))
178 disassemble = print_insn_big_powerpc;
179 else
180 disassemble = print_insn_little_powerpc;
181 break;
182 #endif
183 #ifdef ARCH_rs6000
184 case bfd_arch_rs6000:
185 disassemble = print_insn_rs6000;
186 break;
187 #endif
188 #ifdef ARCH_sh
189 case bfd_arch_sh:
190 if (bfd_big_endian (abfd))
191 disassemble = print_insn_sh;
192 else
193 disassemble = print_insn_shl;
194 break;
195 #endif
196 #ifdef ARCH_sparc
197 case bfd_arch_sparc:
198 disassemble = print_insn_sparc;
199 break;
200 #endif
201 /* start-sanitize-tic80 */
202 #ifdef ARCH_tic80
203 case bfd_arch_tic80:
204 disassemble = print_insn_tic80;
205 break;
206 #endif
207 /* end-sanitize-tic80 */
208 /* start-sanitize-sky */
209 #ifdef ARCH_txvu_foo
210 case bfd_arch_txvu:
211 disassemble = print_insn_txvu;
212 break;
213 #endif
214 /* end-sanitize-sky */
215 #ifdef ARCH_v850
216 case bfd_arch_v850:
217 disassemble = print_insn_v850;
218 break;
219 #endif
220 #ifdef ARCH_w65
221 case bfd_arch_w65:
222 disassemble = print_insn_w65;
223 break;
224 #endif
225 #ifdef ARCH_z8k
226 case bfd_arch_z8k:
227 if (bfd_get_mach(abfd) == bfd_mach_z8001)
228 disassemble = print_insn_z8001;
229 else
230 disassemble = print_insn_z8002;
231 break;
232 #endif
233 default:
234 return 0;
235 }
236 return disassemble;
237 }
238
This page took 0.033294 seconds and 4 git commands to generate.