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 | |
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
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 | { | |
71 | disassemble = arc_disassembler (abfd); | |
72 | break; | |
73 | } | |
74 | #endif | |
75 | /* end-sanitize-arc */ | |
17775ffb SC |
76 | #ifdef ARCH_arm |
77 | case bfd_arch_arm: | |
78 | disassemble = print_insn_arm; | |
79 | break; | |
80 | #endif | |
81 | #ifdef ARCH_h8300 | |
82 | case bfd_arch_h8300: | |
83 | if (bfd_get_mach(abfd) == bfd_mach_h8300h) | |
84 | disassemble = print_insn_h8300h; | |
85 | else | |
86 | disassemble = print_insn_h8300; | |
87 | break; | |
88 | #endif | |
89 | #ifdef ARCH_h8500 | |
90 | case bfd_arch_h8500: | |
91 | disassemble = print_insn_h8500; | |
92 | break; | |
93 | #endif | |
94 | #ifdef ARCH_hppa | |
95 | case bfd_arch_hppa: | |
96 | disassemble = print_insn_hppa; | |
97 | break; | |
98 | #endif | |
99 | #ifdef ARCH_i386 | |
100 | case bfd_arch_i386: | |
101 | disassemble = print_insn_i386; | |
102 | break; | |
103 | #endif | |
104 | #ifdef ARCH_i960 | |
105 | case bfd_arch_i960: | |
106 | disassemble = print_insn_i960; | |
107 | break; | |
108 | #endif | |
109 | #ifdef ARCH_m68k | |
110 | case bfd_arch_m68k: | |
111 | disassemble = print_insn_m68k; | |
112 | break; | |
113 | #endif | |
114 | #ifdef ARCH_m88k | |
115 | case bfd_arch_m88k: | |
116 | disassemble = print_insn_m88k; | |
117 | break; | |
118 | #endif | |
119 | #ifdef ARCH_ns32k | |
120 | case bfd_arch_ns32k: | |
121 | disassemble = print_insn_ns32k; | |
122 | break; | |
123 | #endif | |
124 | #ifdef ARCH_mips | |
125 | case bfd_arch_mips: | |
126 | if (abfd->xvec->byteorder_big_p) | |
127 | disassemble = print_insn_big_mips; | |
128 | else | |
129 | disassemble = print_insn_little_mips; | |
130 | break; | |
131 | #endif | |
132 | #ifdef ARCH_powerpc | |
133 | case bfd_arch_powerpc: | |
134 | if (abfd->xvec->byteorder_big_p) | |
135 | disassemble = print_insn_big_powerpc; | |
136 | else | |
137 | disassemble = print_insn_little_powerpc; | |
138 | break; | |
139 | #endif | |
140 | #ifdef ARCH_rs6000 | |
141 | case bfd_arch_rs6000: | |
142 | disassemble = print_insn_rs6000; | |
143 | break; | |
144 | #endif | |
145 | #ifdef ARCH_sh | |
146 | case bfd_arch_sh: | |
147 | if (abfd->xvec->byteorder_big_p) | |
148 | disassemble = print_insn_sh; | |
149 | else | |
150 | disassemble = print_insn_shl; | |
151 | break; | |
152 | #endif | |
153 | #ifdef ARCH_sparc | |
154 | case bfd_arch_sparc: | |
155 | disassemble = print_insn_sparc; | |
156 | break; | |
157 | #endif | |
9f05921f DE |
158 | #ifdef ARCH_w65 |
159 | case bfd_arch_w65: | |
160 | disassemble = print_insn_w65; | |
161 | break; | |
162 | #endif | |
17775ffb SC |
163 | #ifdef ARCH_z8k |
164 | case bfd_arch_z8k: | |
165 | if (bfd_get_mach(abfd) == bfd_mach_z8001) | |
166 | disassemble = print_insn_z8001; | |
167 | else | |
168 | disassemble = print_insn_z8002; | |
169 | break; | |
170 | #endif | |
171 | default: | |
172 | return 0; | |
173 | } | |
174 | return disassemble; | |
175 | } |