Thu Nov 12 19:21:57 1998 Dave Brolley <brolley@cygnus.com>
[deliverable/binutils-gdb.git] / opcodes / disassemble.c
... / ...
CommitLineData
1/* Select disassembly routine for specified architecture.
2 Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
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
16Foundation, 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#define ARCH_v850
50#define ARCH_w65
51#define ARCH_z8k
52#endif
53
54/* start-sanitize-sky */
55#if defined (ARCH_dvp) && ! defined (ARCH_mips)
56#define ARCH_mips
57#endif
58/* end-sanitize-sky */
59
60disassembler_ftype
61disassembler (abfd)
62 bfd *abfd;
63{
64 enum bfd_architecture a = bfd_get_arch (abfd);
65 disassembler_ftype disassemble;
66
67 switch (a)
68 {
69 /* If you add a case to this table, also add it to the
70 ARCH_all definition right above this function. */
71#ifdef ARCH_a29k
72 case bfd_arch_a29k:
73 /* As far as I know we only handle big-endian 29k objects. */
74 disassemble = print_insn_big_a29k;
75 break;
76#endif
77#ifdef ARCH_alpha
78 case bfd_arch_alpha:
79 disassemble = print_insn_alpha;
80 break;
81#endif
82#ifdef ARCH_arc
83 case bfd_arch_arc:
84 {
85 disassemble = arc_get_disassembler (bfd_get_mach (abfd),
86 bfd_big_endian (abfd));
87 break;
88 }
89#endif
90#ifdef ARCH_arm
91 case bfd_arch_arm:
92 if (bfd_big_endian (abfd))
93 disassemble = print_insn_big_arm;
94 else
95 disassemble = print_insn_little_arm;
96 break;
97#endif
98#ifdef ARCH_d10v
99 case bfd_arch_d10v:
100 disassemble = print_insn_d10v;
101 break;
102#endif
103/* start-sanitize-d30v */
104#ifdef ARCH_d30v
105 case bfd_arch_d30v:
106 disassemble = print_insn_d30v;
107 break;
108#endif
109/* end-sanitize-d30v */
110#ifdef ARCH_h8300
111 case bfd_arch_h8300:
112 if (bfd_get_mach(abfd) == bfd_mach_h8300h)
113 disassemble = print_insn_h8300h;
114 else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
115 disassemble = print_insn_h8300s;
116 else
117 disassemble = print_insn_h8300;
118 break;
119#endif
120#ifdef ARCH_h8500
121 case bfd_arch_h8500:
122 disassemble = print_insn_h8500;
123 break;
124#endif
125#ifdef ARCH_hppa
126 case bfd_arch_hppa:
127 disassemble = print_insn_hppa;
128 break;
129#endif
130#ifdef ARCH_i386
131 case bfd_arch_i386:
132 disassemble = print_insn_i386;
133 break;
134#endif
135#ifdef ARCH_i960
136 case bfd_arch_i960:
137 disassemble = print_insn_i960;
138 break;
139#endif
140#ifdef ARCH_m32r
141 case bfd_arch_m32r:
142 disassemble = print_insn_m32r;
143 break;
144#endif
145#ifdef ARCH_m68k
146 case bfd_arch_m68k:
147 disassemble = print_insn_m68k;
148 break;
149#endif
150#ifdef ARCH_m88k
151 case bfd_arch_m88k:
152 disassemble = print_insn_m88k;
153 break;
154#endif
155#ifdef ARCH_ns32k
156 case bfd_arch_ns32k:
157 disassemble = print_insn_ns32k;
158 break;
159#endif
160#ifdef ARCH_mips
161 case bfd_arch_mips:
162 if (bfd_big_endian (abfd))
163 disassemble = print_insn_big_mips;
164 else
165 disassemble = print_insn_little_mips;
166 break;
167#endif
168#ifdef ARCH_mn10200
169 case bfd_arch_mn10200:
170 disassemble = print_insn_mn10200;
171 break;
172#endif
173#ifdef ARCH_mn10300
174 case bfd_arch_mn10300:
175 disassemble = print_insn_mn10300;
176 break;
177#endif
178#ifdef ARCH_powerpc
179 case bfd_arch_powerpc:
180 if (bfd_big_endian (abfd))
181 disassemble = print_insn_big_powerpc;
182 else
183 disassemble = print_insn_little_powerpc;
184 break;
185#endif
186#ifdef ARCH_rs6000
187 case bfd_arch_rs6000:
188 disassemble = print_insn_rs6000;
189 break;
190#endif
191#ifdef ARCH_sh
192 case bfd_arch_sh:
193 if (bfd_big_endian (abfd))
194 disassemble = print_insn_sh;
195 else
196 disassemble = print_insn_shl;
197 break;
198#endif
199#ifdef ARCH_sparc
200 case bfd_arch_sparc:
201 disassemble = print_insn_sparc;
202 break;
203#endif
204/* start-sanitize-tic80 */
205#ifdef ARCH_tic80
206 case bfd_arch_tic80:
207 disassemble = print_insn_tic80;
208 break;
209#endif
210/* end-sanitize-tic80 */
211#ifdef ARCH_v850
212 case bfd_arch_v850:
213 disassemble = print_insn_v850;
214 break;
215#endif
216#ifdef ARCH_w65
217 case bfd_arch_w65:
218 disassemble = print_insn_w65;
219 break;
220#endif
221#ifdef ARCH_z8k
222 case bfd_arch_z8k:
223 if (bfd_get_mach(abfd) == bfd_mach_z8001)
224 disassemble = print_insn_z8001;
225 else
226 disassemble = print_insn_z8002;
227 break;
228#endif
229 default:
230 return 0;
231 }
232 return disassemble;
233}
234
This page took 0.023059 seconds and 4 git commands to generate.