Wed Jan 28 16:41:19 1998 J.J. van der Heijden <J.J.vanderHeijden@student.utwente.nl>
[deliverable/binutils-gdb.git] / opcodes / disassemble.c
CommitLineData
17775ffb 1/* Select disassembly routine for specified architecture.
c08a4e6b 2 Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
17775ffb
SC
3
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation; either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
79ae32ab 16Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17775ffb
SC
17
18#include "ansidecl.h"
19#include "dis-asm.h"
20
21#ifdef ARCH_all
22#define ARCH_a29k
23#define ARCH_alpha
9f05921f 24#define ARCH_arc
17775ffb 25#define ARCH_arm
e3659cbf 26#define ARCH_d10v
b2e3f844
MH
27/* start-sanitize-d30v */
28#define ARCH_d30v
29/* end-sanitize-d30v */
17775ffb
SC
30#define ARCH_h8300
31#define ARCH_h8500
32#define ARCH_hppa
33#define ARCH_i386
34#define ARCH_i960
c08a4e6b 35#define ARCH_m32r
17775ffb
SC
36#define ARCH_m68k
37#define ARCH_m88k
38#define ARCH_mips
b2e3f844
MH
39#define ARCH_mn10200
40#define ARCH_mn10300
17775ffb
SC
41#define ARCH_ns32k
42#define ARCH_powerpc
43#define ARCH_rs6000
44#define ARCH_sh
45#define ARCH_sparc
b2e3f844
MH
46/* start-sanitize-tic80 */
47#define ARCH_tic80
48/* end-sanitize-tic80 */
80c396f6
DE
49/* start-sanitize-sky */
50#define ARCH_txvu
51/* end-sanitize-sky */
b2e3f844 52#define ARCH_v850
9f05921f 53#define ARCH_w65
17775ffb
SC
54#define ARCH_z8k
55#endif
56
57disassembler_ftype
58disassembler (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:
e7c50cef 76 disassemble = print_insn_alpha;
17775ffb
SC
77 break;
78#endif
9f05921f
DE
79#ifdef ARCH_arc
80 case bfd_arch_arc:
81 {
79ae32ab
DE
82 disassemble = arc_get_disassembler (bfd_get_mach (abfd),
83 bfd_big_endian (abfd));
9f05921f
DE
84 break;
85 }
86#endif
17775ffb
SC
87#ifdef ARCH_arm
88 case bfd_arch_arm:
79ae32ab
DE
89 if (bfd_big_endian (abfd))
90 disassemble = print_insn_big_arm;
91 else
92 disassemble = print_insn_little_arm;
17775ffb
SC
93 break;
94#endif
e3659cbf
MH
95#ifdef ARCH_d10v
96 case bfd_arch_d10v:
97 disassemble = print_insn_d10v;
98 break;
99#endif
b2e3f844
MH
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 */
17775ffb
SC
107#ifdef ARCH_h8300
108 case bfd_arch_h8300:
109 if (bfd_get_mach(abfd) == bfd_mach_h8300h)
110 disassemble = print_insn_h8300h;
25b344a4
JL
111 else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
112 disassemble = print_insn_h8300s;
17775ffb
SC
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
c08a4e6b
NC
137#ifdef ARCH_m32r
138 case bfd_arch_m32r:
139 disassemble = print_insn_m32r;
140 break;
141#endif
17775ffb
SC
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:
79ae32ab 159 if (bfd_big_endian (abfd))
17775ffb
SC
160 disassemble = print_insn_big_mips;
161 else
162 disassemble = print_insn_little_mips;
163 break;
164#endif
b2e3f844
MH
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;
e7c50cef
JL
173 break;
174#endif
17775ffb
SC
175#ifdef ARCH_powerpc
176 case bfd_arch_powerpc:
79ae32ab 177 if (bfd_big_endian (abfd))
17775ffb
SC
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:
79ae32ab 190 if (bfd_big_endian (abfd))
17775ffb
SC
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:
25b344a4 198 disassemble = print_insn_sparc;
17775ffb
SC
199 break;
200#endif
b2e3f844
MH
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 */
80c396f6 208/* start-sanitize-sky */
8ddd9d2f 209#ifdef ARCH_txvu
80c396f6
DE
210 case bfd_arch_txvu:
211 disassemble = print_insn_txvu;
212 break;
213#endif
214/* end-sanitize-sky */
e7c50cef
JL
215#ifdef ARCH_v850
216 case bfd_arch_v850:
217 disassemble = print_insn_v850;
218 break;
219#endif
9f05921f
DE
220#ifdef ARCH_w65
221 case bfd_arch_w65:
222 disassemble = print_insn_w65;
223 break;
224#endif
17775ffb
SC
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}
c08a4e6b 238
This page took 0.122903 seconds and 4 git commands to generate.