OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [opcodes/] [disassemble.c] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* Select disassembly routine for specified architecture.
2
   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3
   Free Software Foundation, Inc.
4
 
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
 
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU General Public License for more details.
14
 
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18
 
19
#include "sysdep.h"
20
#include "dis-asm.h"
21
 
22
#ifdef ARCH_all
23
#define ARCH_or32
24
#define ARCH_a29k
25
#define ARCH_alpha
26
#define ARCH_arc
27
#define ARCH_arm
28
#define ARCH_avr
29
#define ARCH_cris
30
#define ARCH_d10v
31
#define ARCH_d30v
32
#define ARCH_h8300
33
#define ARCH_h8500
34
#define ARCH_hppa
35
#define ARCH_i370
36
#define ARCH_i386
37
#define ARCH_i860
38
#define ARCH_i960
39
#define ARCH_ia64
40
#define ARCH_fr30
41
#define ARCH_m32r
42
#define ARCH_m68k
43
#define ARCH_m68hc11
44
#define ARCH_m68hc12
45
#define ARCH_m88k
46
#define ARCH_mcore
47
#define ARCH_mips
48
#define ARCH_mn10200
49
#define ARCH_mn10300
50
#define ARCH_ns32k
51
#define ARCH_openrisc
52
#define ARCH_pdp11
53
#define ARCH_pj
54
#define ARCH_powerpc
55
#define ARCH_rs6000
56
#define ARCH_s390
57
#define ARCH_sh
58
#define ARCH_sparc
59
#define ARCH_tic30
60
#define ARCH_tic54x
61
#define ARCH_tic80
62
#define ARCH_v850
63
#define ARCH_vax
64
#define ARCH_w65
65
#define ARCH_z8k
66
#endif
67
 
68
 
69
disassembler_ftype
70
disassembler (abfd)
71
     bfd *abfd;
72
{
73
  enum bfd_architecture a = bfd_get_arch (abfd);
74
  disassembler_ftype disassemble;
75
 
76
  switch (a)
77
    {
78
      /* If you add a case to this table, also add it to the
79
         ARCH_all definition right above this function.  */
80
#ifdef ARCH_a29k
81
    case bfd_arch_a29k:
82
      /* As far as I know we only handle big-endian 29k objects.  */
83
      disassemble = print_insn_big_a29k;
84
      break;
85
#endif
86
#ifdef ARCH_alpha
87
    case bfd_arch_alpha:
88
      disassemble = print_insn_alpha;
89
      break;
90
#endif
91
#ifdef ARCH_arc
92
    case bfd_arch_arc:
93
      {
94
        disassemble = arc_get_disassembler (abfd);
95
        break;
96
      }
97
#endif
98
#ifdef ARCH_arm
99
    case bfd_arch_arm:
100
      if (bfd_big_endian (abfd))
101
        disassemble = print_insn_big_arm;
102
      else
103
        disassemble = print_insn_little_arm;
104
      break;
105
#endif
106
#ifdef ARCH_avr
107
    case bfd_arch_avr:
108
      disassemble = print_insn_avr;
109
      break;
110
#endif
111
#ifdef ARCH_cris
112
    case bfd_arch_cris:
113
      disassemble = cris_get_disassembler (abfd);
114
      break;
115
#endif
116
#ifdef ARCH_d10v
117
    case bfd_arch_d10v:
118
      disassemble = print_insn_d10v;
119
      break;
120
#endif
121
#ifdef ARCH_d30v
122
    case bfd_arch_d30v:
123
      disassemble = print_insn_d30v;
124
      break;
125
#endif
126
#ifdef ARCH_h8300
127
    case bfd_arch_h8300:
128
      if (bfd_get_mach(abfd) == bfd_mach_h8300h)
129
        disassemble = print_insn_h8300h;
130
      else if (bfd_get_mach(abfd) == bfd_mach_h8300s)
131
        disassemble = print_insn_h8300s;
132
      else
133
        disassemble = print_insn_h8300;
134
      break;
135
#endif
136
#ifdef ARCH_h8500
137
    case bfd_arch_h8500:
138
      disassemble = print_insn_h8500;
139
      break;
140
#endif
141
#ifdef ARCH_hppa
142
    case bfd_arch_hppa:
143
      disassemble = print_insn_hppa;
144
      break;
145
#endif
146
#ifdef ARCH_i370
147
    case bfd_arch_i370:
148
      disassemble = print_insn_i370;
149
      break;
150
#endif
151
#ifdef ARCH_i386
152
    case bfd_arch_i386:
153
      if (bfd_get_mach (abfd) == bfd_mach_i386_i386_intel_syntax
154
          || bfd_get_mach (abfd) == bfd_mach_x86_64_intel_syntax)
155
        disassemble = print_insn_i386_intel;
156
      else
157
        disassemble = print_insn_i386_att;
158
      break;
159
#endif
160
#ifdef ARCH_i860
161
    case bfd_arch_i860:
162
      disassemble = print_insn_i860;
163
      break;
164
#endif
165
#ifdef ARCH_i960
166
    case bfd_arch_i960:
167
      disassemble = print_insn_i960;
168
      break;
169
#endif
170
#ifdef ARCH_ia64
171
    case bfd_arch_ia64:
172
      disassemble = print_insn_ia64;
173
      break;
174
#endif
175
#ifdef ARCH_fr30
176
    case bfd_arch_fr30:
177
      disassemble = print_insn_fr30;
178
      break;
179
#endif
180
#ifdef ARCH_m32r
181
    case bfd_arch_m32r:
182
      disassemble = print_insn_m32r;
183
      break;
184
#endif
185
#if defined(ARCH_m68hc11) || defined(ARCH_m68hc12)
186
    case bfd_arch_m68hc11:
187
      disassemble = print_insn_m68hc11;
188
      break;
189
    case bfd_arch_m68hc12:
190
      disassemble = print_insn_m68hc12;
191
      break;
192
#endif
193
#ifdef ARCH_m68k
194
    case bfd_arch_m68k:
195
      disassemble = print_insn_m68k;
196
      break;
197
#endif
198
#ifdef ARCH_m88k
199
    case bfd_arch_m88k:
200
      disassemble = print_insn_m88k;
201
      break;
202
#endif
203
#ifdef ARCH_ns32k
204
    case bfd_arch_ns32k:
205
      disassemble = print_insn_ns32k;
206
      break;
207
#endif
208
#ifdef ARCH_mcore
209
    case bfd_arch_mcore:
210
      disassemble = print_insn_mcore;
211
      break;
212
#endif
213
#ifdef ARCH_mips
214
    case bfd_arch_mips:
215
      if (bfd_big_endian (abfd))
216
        disassemble = print_insn_big_mips;
217
      else
218
        disassemble = print_insn_little_mips;
219
      break;
220
#endif
221
#ifdef ARCH_mn10200
222
    case bfd_arch_mn10200:
223
      disassemble = print_insn_mn10200;
224
      break;
225
#endif
226
#ifdef ARCH_mn10300
227
    case bfd_arch_mn10300:
228
      disassemble = print_insn_mn10300;
229
      break;
230
#endif
231
#ifdef ARCH_openrisc
232
    case bfd_arch_openrisc:
233
      disassemble = print_insn_openrisc;
234
      break;
235
#endif
236
#ifdef ARCH_or1k
237
    case bfd_arch_or1k:
238
      if (bfd_big_endian (abfd))
239
        disassemble = print_insn_big_or1k;
240
      else
241
        disassemble = print_insn_little_or1k;
242
      break;
243
#endif
244
#ifdef ARCH_or32
245
    case bfd_arch_or32:
246
      if (bfd_big_endian (abfd))
247
        disassemble = print_insn_big_or32;
248
      else
249
        disassemble = print_insn_little_or32;
250
      break;
251
#endif
252
#ifdef ARCH_pdp11
253
    case bfd_arch_pdp11:
254
      disassemble = print_insn_pdp11;
255
      break;
256
#endif
257
#ifdef ARCH_pj
258
    case bfd_arch_pj:
259
      disassemble = print_insn_pj;
260
      break;
261
#endif
262
#ifdef ARCH_powerpc
263
    case bfd_arch_powerpc:
264
      if (bfd_big_endian (abfd))
265
        disassemble = print_insn_big_powerpc;
266
      else
267
        disassemble = print_insn_little_powerpc;
268
      break;
269
#endif
270
#ifdef ARCH_rs6000
271
    case bfd_arch_rs6000:
272
      if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
273
        disassemble = print_insn_big_powerpc;
274
      else
275
        disassemble = print_insn_rs6000;
276
      break;
277
#endif
278
#ifdef ARCH_s390
279
    case bfd_arch_s390:
280
      disassemble = print_insn_s390;
281
      break;
282
#endif
283
#ifdef ARCH_sh
284
    case bfd_arch_sh:
285
      if (bfd_big_endian (abfd))
286
        disassemble = print_insn_sh;
287
      else
288
        disassemble = print_insn_shl;
289
      break;
290
#endif
291
#ifdef ARCH_sparc
292
    case bfd_arch_sparc:
293
      disassemble = print_insn_sparc;
294
      break;
295
#endif
296
#ifdef ARCH_tic30
297
    case bfd_arch_tic30:
298
      disassemble = print_insn_tic30;
299
      break;
300
#endif
301
#ifdef ARCH_tic54x
302
    case bfd_arch_tic54x:
303
      disassemble = print_insn_tic54x;
304
      break;
305
#endif
306
#ifdef ARCH_tic80
307
    case bfd_arch_tic80:
308
      disassemble = print_insn_tic80;
309
      break;
310
#endif
311
#ifdef ARCH_v850
312
    case bfd_arch_v850:
313
      disassemble = print_insn_v850;
314
      break;
315
#endif
316
#ifdef ARCH_w65
317
    case bfd_arch_w65:
318
      disassemble = print_insn_w65;
319
      break;
320
#endif
321
#ifdef ARCH_z8k
322
    case bfd_arch_z8k:
323
      if (bfd_get_mach(abfd) == bfd_mach_z8001)
324
        disassemble = print_insn_z8001;
325
      else
326
        disassemble = print_insn_z8002;
327
      break;
328
#endif
329
#ifdef ARCH_vax
330
    case bfd_arch_vax:
331
      disassemble = print_insn_vax;
332
      break;
333
#endif
334
    default:
335
      return 0;
336
    }
337
  return disassemble;
338
}
339
 
340
void
341
disassembler_usage (stream)
342
     FILE * stream ATTRIBUTE_UNUSED;
343
{
344
#ifdef ARCH_arm
345
  print_arm_disassembler_options (stream);
346
#endif
347
 
348
  return;
349
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.