start-sanitize-d10v
[deliverable/binutils-gdb.git] / opcodes / disassemble.c
1 /* Select disassembly routine for specified architecture.
2 Copyright (C) 1994, 1995 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 /* start-sanitize-arc */
25 #define ARCH_arc
26 /* end-sanitize-arc */
27 #define ARCH_arm
28 /* start-sanitize-d10v */
29 #define ARCH_d10v
30 /* end-sanitize-d10v */
31 #define ARCH_h8300
32 #define ARCH_h8500
33 #define ARCH_hppa
34 #define ARCH_i386
35 #define ARCH_i960
36 #define ARCH_m68k
37 #define ARCH_m88k
38 #define ARCH_mips
39 #define ARCH_ns32k
40 #define ARCH_powerpc
41 #define ARCH_rs6000
42 #define ARCH_sh
43 #define ARCH_sparc
44 #define ARCH_w65
45 #define ARCH_z8k
46 #endif
47
48 disassembler_ftype
49 disassembler (abfd)
50 bfd *abfd;
51 {
52 enum bfd_architecture a = bfd_get_arch (abfd);
53 disassembler_ftype disassemble;
54
55 switch (a)
56 {
57 /* If you add a case to this table, also add it to the
58 ARCH_all definition right above this function. */
59 #ifdef ARCH_a29k
60 case bfd_arch_a29k:
61 /* As far as I know we only handle big-endian 29k objects. */
62 disassemble = print_insn_big_a29k;
63 break;
64 #endif
65 #ifdef ARCH_alpha
66 case bfd_arch_alpha:
67 disassemble = print_insn_alpha;
68 break;
69 #endif
70 /* start-sanitize-arc */
71 #ifdef ARCH_arc
72 case bfd_arch_arc:
73 {
74 disassemble = arc_get_disassembler (bfd_get_mach (abfd),
75 bfd_big_endian (abfd));
76 break;
77 }
78 #endif
79 /* end-sanitize-arc */
80 #ifdef ARCH_arm
81 case bfd_arch_arm:
82 if (bfd_big_endian (abfd))
83 disassemble = print_insn_big_arm;
84 else
85 disassemble = print_insn_little_arm;
86 break;
87 #endif
88 /* start-sanitize-d10v */
89 #ifdef ARCH_d10v
90 case bfd_arch_d10v:
91 disassemble = print_insn_d10v;
92 break;
93 #endif
94 /* end-sanitize-d10v */
95 #ifdef ARCH_h8300
96 case bfd_arch_h8300:
97 if (bfd_get_mach(abfd) == bfd_mach_h8300h)
98 disassemble = print_insn_h8300h;
99 else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
100 disassemble = print_insn_h8300s;
101 else
102 disassemble = print_insn_h8300;
103 break;
104 #endif
105 #ifdef ARCH_h8500
106 case bfd_arch_h8500:
107 disassemble = print_insn_h8500;
108 break;
109 #endif
110 #ifdef ARCH_hppa
111 case bfd_arch_hppa:
112 disassemble = print_insn_hppa;
113 break;
114 #endif
115 #ifdef ARCH_i386
116 case bfd_arch_i386:
117 disassemble = print_insn_i386;
118 break;
119 #endif
120 #ifdef ARCH_i960
121 case bfd_arch_i960:
122 disassemble = print_insn_i960;
123 break;
124 #endif
125 #ifdef ARCH_m68k
126 case bfd_arch_m68k:
127 disassemble = print_insn_m68k;
128 break;
129 #endif
130 #ifdef ARCH_m88k
131 case bfd_arch_m88k:
132 disassemble = print_insn_m88k;
133 break;
134 #endif
135 #ifdef ARCH_ns32k
136 case bfd_arch_ns32k:
137 disassemble = print_insn_ns32k;
138 break;
139 #endif
140 #ifdef ARCH_mips
141 case bfd_arch_mips:
142 if (bfd_big_endian (abfd))
143 disassemble = print_insn_big_mips;
144 else
145 disassemble = print_insn_little_mips;
146 break;
147 #endif
148 #ifdef ARCH_powerpc
149 case bfd_arch_powerpc:
150 if (bfd_big_endian (abfd))
151 disassemble = print_insn_big_powerpc;
152 else
153 disassemble = print_insn_little_powerpc;
154 break;
155 #endif
156 #ifdef ARCH_rs6000
157 case bfd_arch_rs6000:
158 disassemble = print_insn_rs6000;
159 break;
160 #endif
161 #ifdef ARCH_sh
162 case bfd_arch_sh:
163 if (bfd_big_endian (abfd))
164 disassemble = print_insn_sh;
165 else
166 disassemble = print_insn_shl;
167 break;
168 #endif
169 #ifdef ARCH_sparc
170 case bfd_arch_sparc:
171 disassemble = print_insn_sparc;
172 break;
173 #endif
174 #ifdef ARCH_w65
175 case bfd_arch_w65:
176 disassemble = print_insn_w65;
177 break;
178 #endif
179 #ifdef ARCH_z8k
180 case bfd_arch_z8k:
181 if (bfd_get_mach(abfd) == bfd_mach_z8001)
182 disassemble = print_insn_z8001;
183 else
184 disassemble = print_insn_z8002;
185 break;
186 #endif
187 default:
188 return 0;
189 }
190 return disassemble;
191 }
This page took 0.032921 seconds and 4 git commands to generate.