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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [opcodes/] [disassemble.c] - Blame information for rev 826

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

Line No. Rev Author Line
1 38 julius
/* Select disassembly routine for specified architecture.
2
   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
3
   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4
 
5
   This file is part of the GNU opcodes library.
6
 
7
   This library is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program; if not, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20
   MA 02110-1301, USA.  */
21
 
22
#include "sysdep.h"
23
#include "dis-asm.h"
24
 
25
#ifdef ARCH_all
26
#define ARCH_alpha
27
#define ARCH_arc
28
#define ARCH_arm
29
#define ARCH_avr
30
#define ARCH_bfin
31
#define ARCH_cr16
32
#define ARCH_cris
33
#define ARCH_crx
34
#define ARCH_d10v
35
#define ARCH_d30v
36
#define ARCH_dlx
37
#define ARCH_fr30
38
#define ARCH_frv
39
#define ARCH_h8300
40
#define ARCH_h8500
41
#define ARCH_hppa
42
#define ARCH_i370
43
#define ARCH_i386
44
#define ARCH_i860
45
#define ARCH_i960
46
#define ARCH_ia64
47
#define ARCH_ip2k
48
#define ARCH_iq2000
49
#define ARCH_m32c
50
#define ARCH_m32r
51
#define ARCH_m68hc11
52
#define ARCH_m68hc12
53
#define ARCH_m68k
54
#define ARCH_m88k
55
#define ARCH_maxq
56
#define ARCH_mcore
57
#define ARCH_mep
58
#define ARCH_mips
59
#define ARCH_mmix
60
#define ARCH_mn10200
61
#define ARCH_mn10300
62
#define ARCH_mt
63
#define ARCH_msp430
64
#define ARCH_ns32k
65
#define ARCH_or32
66
#define ARCH_pdp11
67
#define ARCH_pj
68
#define ARCH_powerpc
69
#define ARCH_rs6000
70
#define ARCH_s390
71
#define ARCH_score
72
#define ARCH_sh
73
#define ARCH_sparc
74
#define ARCH_spu
75
#define ARCH_tic30
76
#define ARCH_tic4x
77
#define ARCH_tic54x
78
#define ARCH_tic80
79
#define ARCH_v850
80
#define ARCH_vax
81
#define ARCH_w65
82
#define ARCH_xstormy16
83
#define ARCH_xc16x
84
#define ARCH_xtensa
85
#define ARCH_z80
86
#define ARCH_z8k
87
#define INCLUDE_SHMEDIA
88
#endif
89
 
90
#ifdef ARCH_m32c
91
#include "m32c-desc.h"
92
#endif
93
 
94
disassembler_ftype
95
disassembler (abfd)
96
     bfd *abfd;
97
{
98
  enum bfd_architecture a = bfd_get_arch (abfd);
99
  disassembler_ftype disassemble;
100
 
101
  switch (a)
102
    {
103
      /* If you add a case to this table, also add it to the
104
         ARCH_all definition right above this function.  */
105
#ifdef ARCH_alpha
106
    case bfd_arch_alpha:
107
      disassemble = print_insn_alpha;
108
      break;
109
#endif
110
#ifdef ARCH_arc
111
    case bfd_arch_arc:
112
      {
113
        disassemble = arc_get_disassembler (abfd);
114
        break;
115
      }
116
#endif
117
#ifdef ARCH_arm
118
    case bfd_arch_arm:
119
      if (bfd_big_endian (abfd))
120
        disassemble = print_insn_big_arm;
121
      else
122
        disassemble = print_insn_little_arm;
123
      break;
124
#endif
125
#ifdef ARCH_avr
126
    case bfd_arch_avr:
127
      disassemble = print_insn_avr;
128
      break;
129
#endif
130
#ifdef ARCH_bfin
131
    case bfd_arch_bfin:
132
      disassemble = print_insn_bfin;
133
      break;
134
#endif
135
#ifdef ARCH_cr16
136
    case bfd_arch_cr16:
137
      disassemble = print_insn_cr16;
138
      break;
139
#endif
140
#ifdef ARCH_cris
141
    case bfd_arch_cris:
142
      disassemble = cris_get_disassembler (abfd);
143
      break;
144
#endif
145
#ifdef ARCH_crx
146
    case bfd_arch_crx:
147
      disassemble = print_insn_crx;
148
      break;
149
#endif
150
#ifdef ARCH_d10v
151
    case bfd_arch_d10v:
152
      disassemble = print_insn_d10v;
153
      break;
154
#endif
155
#ifdef ARCH_d30v
156
    case bfd_arch_d30v:
157
      disassemble = print_insn_d30v;
158
      break;
159
#endif
160
#ifdef ARCH_dlx
161
    case bfd_arch_dlx:
162
      /* As far as I know we only handle big-endian DLX objects.  */
163
      disassemble = print_insn_dlx;
164
      break;
165
#endif
166
#ifdef ARCH_h8300
167
    case bfd_arch_h8300:
168
      if (bfd_get_mach (abfd) == bfd_mach_h8300h
169
          || bfd_get_mach (abfd) == bfd_mach_h8300hn)
170
        disassemble = print_insn_h8300h;
171
      else if (bfd_get_mach (abfd) == bfd_mach_h8300s
172
               || bfd_get_mach (abfd) == bfd_mach_h8300sn
173
               || bfd_get_mach (abfd) == bfd_mach_h8300sx
174
               || bfd_get_mach (abfd) == bfd_mach_h8300sxn)
175
        disassemble = print_insn_h8300s;
176
      else
177
        disassemble = print_insn_h8300;
178
      break;
179
#endif
180
#ifdef ARCH_h8500
181
    case bfd_arch_h8500:
182
      disassemble = print_insn_h8500;
183
      break;
184
#endif
185
#ifdef ARCH_hppa
186
    case bfd_arch_hppa:
187
      disassemble = print_insn_hppa;
188
      break;
189
#endif
190
#ifdef ARCH_i370
191
    case bfd_arch_i370:
192
      disassemble = print_insn_i370;
193
      break;
194
#endif
195
#ifdef ARCH_i386
196
    case bfd_arch_i386:
197
      disassemble = print_insn_i386;
198
      break;
199
#endif
200
#ifdef ARCH_i860
201
    case bfd_arch_i860:
202
      disassemble = print_insn_i860;
203
      break;
204
#endif
205
#ifdef ARCH_i960
206
    case bfd_arch_i960:
207
      disassemble = print_insn_i960;
208
      break;
209
#endif
210
#ifdef ARCH_ia64
211
    case bfd_arch_ia64:
212
      disassemble = print_insn_ia64;
213
      break;
214
#endif
215
#ifdef ARCH_ip2k
216
    case bfd_arch_ip2k:
217
      disassemble = print_insn_ip2k;
218
      break;
219
#endif
220
#ifdef ARCH_fr30
221
    case bfd_arch_fr30:
222
      disassemble = print_insn_fr30;
223
      break;
224
#endif
225
#ifdef ARCH_m32r
226
    case bfd_arch_m32r:
227
      disassemble = print_insn_m32r;
228
      break;
229
#endif
230
#if defined(ARCH_m68hc11) || defined(ARCH_m68hc12)
231
    case bfd_arch_m68hc11:
232
      disassemble = print_insn_m68hc11;
233
      break;
234
    case bfd_arch_m68hc12:
235
      disassemble = print_insn_m68hc12;
236
      break;
237
#endif
238
#ifdef ARCH_m68k
239
    case bfd_arch_m68k:
240
      disassemble = print_insn_m68k;
241
      break;
242
#endif
243
#ifdef ARCH_m88k
244
    case bfd_arch_m88k:
245
      disassemble = print_insn_m88k;
246
      break;
247
#endif
248
#ifdef ARCH_maxq
249
    case bfd_arch_maxq:
250
      disassemble = print_insn_maxq_little;
251
      break;
252
#endif
253
#ifdef ARCH_mt
254
    case bfd_arch_mt:
255
      disassemble = print_insn_mt;
256
      break;
257
#endif
258
#ifdef ARCH_msp430
259
    case bfd_arch_msp430:
260
      disassemble = print_insn_msp430;
261
      break;
262
#endif
263
#ifdef ARCH_ns32k
264
    case bfd_arch_ns32k:
265
      disassemble = print_insn_ns32k;
266
      break;
267
#endif
268
#ifdef ARCH_mcore
269
    case bfd_arch_mcore:
270
      disassemble = print_insn_mcore;
271
      break;
272
#endif
273
#ifdef ARCH_mep
274
    case bfd_arch_mep:
275
      disassemble = print_insn_mep;
276
      break;
277
#endif
278
#ifdef ARCH_mips
279
    case bfd_arch_mips:
280
      if (bfd_big_endian (abfd))
281
        disassemble = print_insn_big_mips;
282
      else
283
        disassemble = print_insn_little_mips;
284
      break;
285
#endif
286
#ifdef ARCH_mmix
287
    case bfd_arch_mmix:
288
      disassemble = print_insn_mmix;
289
      break;
290
#endif
291
#ifdef ARCH_mn10200
292
    case bfd_arch_mn10200:
293
      disassemble = print_insn_mn10200;
294
      break;
295
#endif
296
#ifdef ARCH_mn10300
297
    case bfd_arch_mn10300:
298
      disassemble = print_insn_mn10300;
299
      break;
300
#endif
301
#ifdef ARCH_or32
302
    case bfd_arch_or32:
303
      if (bfd_big_endian (abfd))
304
        disassemble = print_insn_big_or32;
305
      else
306
        disassemble = print_insn_little_or32;
307
      break;
308
#endif
309
#ifdef ARCH_pdp11
310
    case bfd_arch_pdp11:
311
      disassemble = print_insn_pdp11;
312
      break;
313
#endif
314
#ifdef ARCH_pj
315
    case bfd_arch_pj:
316
      disassemble = print_insn_pj;
317
      break;
318
#endif
319
#ifdef ARCH_powerpc
320
    case bfd_arch_powerpc:
321
      if (bfd_big_endian (abfd))
322
        disassemble = print_insn_big_powerpc;
323
      else
324
        disassemble = print_insn_little_powerpc;
325
      break;
326
#endif
327
#ifdef ARCH_rs6000
328
    case bfd_arch_rs6000:
329
      if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
330
        disassemble = print_insn_big_powerpc;
331
      else
332
        disassemble = print_insn_rs6000;
333
      break;
334
#endif
335
#ifdef ARCH_s390
336
    case bfd_arch_s390:
337
      disassemble = print_insn_s390;
338
      break;
339
#endif
340
#ifdef ARCH_score
341
    case bfd_arch_score:
342
      if (bfd_big_endian (abfd))
343
        disassemble = print_insn_big_score;
344
      else
345
        disassemble = print_insn_little_score;
346
     break;
347
#endif
348
#ifdef ARCH_sh
349
    case bfd_arch_sh:
350
      disassemble = print_insn_sh;
351
      break;
352
#endif
353
#ifdef ARCH_sparc
354
    case bfd_arch_sparc:
355
      disassemble = print_insn_sparc;
356
      break;
357
#endif
358
#ifdef ARCH_spu
359
    case bfd_arch_spu:
360
      disassemble = print_insn_spu;
361
      break;
362
#endif
363
#ifdef ARCH_tic30
364
    case bfd_arch_tic30:
365
      disassemble = print_insn_tic30;
366
      break;
367
#endif
368
#ifdef ARCH_tic4x
369
    case bfd_arch_tic4x:
370
      disassemble = print_insn_tic4x;
371
      break;
372
#endif
373
#ifdef ARCH_tic54x
374
    case bfd_arch_tic54x:
375
      disassemble = print_insn_tic54x;
376
      break;
377
#endif
378
#ifdef ARCH_tic80
379
    case bfd_arch_tic80:
380
      disassemble = print_insn_tic80;
381
      break;
382
#endif
383
#ifdef ARCH_v850
384
    case bfd_arch_v850:
385
      disassemble = print_insn_v850;
386
      break;
387
#endif
388
#ifdef ARCH_w65
389
    case bfd_arch_w65:
390
      disassemble = print_insn_w65;
391
      break;
392
#endif
393
#ifdef ARCH_xstormy16
394
    case bfd_arch_xstormy16:
395
      disassemble = print_insn_xstormy16;
396
      break;
397
#endif
398
#ifdef ARCH_xc16x
399
    case bfd_arch_xc16x:
400
      disassemble = print_insn_xc16x;
401
      break;
402
#endif
403
#ifdef ARCH_xtensa
404
    case bfd_arch_xtensa:
405
      disassemble = print_insn_xtensa;
406
      break;
407
#endif
408
#ifdef ARCH_z80
409
    case bfd_arch_z80:
410
      disassemble = print_insn_z80;
411
      break;
412
#endif
413
#ifdef ARCH_z8k
414
    case bfd_arch_z8k:
415
      if (bfd_get_mach(abfd) == bfd_mach_z8001)
416
        disassemble = print_insn_z8001;
417
      else
418
        disassemble = print_insn_z8002;
419
      break;
420
#endif
421
#ifdef ARCH_vax
422
    case bfd_arch_vax:
423
      disassemble = print_insn_vax;
424
      break;
425
#endif
426
#ifdef ARCH_frv
427
    case bfd_arch_frv:
428
      disassemble = print_insn_frv;
429
      break;
430
#endif
431
#ifdef ARCH_iq2000
432
    case bfd_arch_iq2000:
433
      disassemble = print_insn_iq2000;
434
      break;
435
#endif
436
#ifdef ARCH_m32c
437
    case bfd_arch_m32c:
438
      disassemble = print_insn_m32c;
439
      break;
440
#endif
441
    default:
442
      return 0;
443
    }
444
  return disassemble;
445
}
446
 
447
void
448
disassembler_usage (stream)
449
     FILE * stream ATTRIBUTE_UNUSED;
450
{
451
#ifdef ARCH_arm
452
  print_arm_disassembler_options (stream);
453
#endif
454
#ifdef ARCH_mips
455
  print_mips_disassembler_options (stream);
456
#endif
457
#ifdef ARCH_powerpc
458
  print_ppc_disassembler_options (stream);
459
#endif
460
#ifdef ARCH_i386
461
  print_i386_disassembler_options (stream);
462
#endif
463
#ifdef ARCH_s390
464
  print_s390_disassembler_options (stream);
465
#endif
466
 
467
  return;
468
}
469
 
470
void
471
disassemble_init_for_target (struct disassemble_info * info)
472
{
473
  if (info == NULL)
474
    return;
475
 
476
  switch (info->arch)
477
    {
478
#ifdef ARCH_arm
479
    case bfd_arch_arm:
480
      info->symbol_is_valid = arm_symbol_is_valid;
481
      info->disassembler_needs_relocs = TRUE;
482
      break;
483
#endif
484
#ifdef ARCH_ia64
485
    case bfd_arch_ia64:
486
      info->skip_zeroes = 16;
487
      break;
488
#endif
489
#ifdef ARCH_tic4x
490
    case bfd_arch_tic4x:
491
      info->skip_zeroes = 32;
492
      break;
493
#endif
494
#ifdef ARCH_mep
495
    case bfd_arch_mep:
496
      info->skip_zeroes = 256;
497
      info->skip_zeroes_at_end = 0;
498
      break;
499
#endif
500
#ifdef ARCH_m32c
501
    case bfd_arch_m32c:
502
      info->endian = BFD_ENDIAN_BIG;
503
      if (! info->insn_sets)
504
        {
505
          info->insn_sets = cgen_bitset_create (ISA_MAX);
506
          if (info->mach == bfd_mach_m16c)
507
            cgen_bitset_set (info->insn_sets, ISA_M16C);
508
          else
509
            cgen_bitset_set (info->insn_sets, ISA_M32C);
510
        }
511
      break;
512
#endif
513
    default:
514
      break;
515
    }
516
}

powered by: WebSVN 2.1.0

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