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