home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / opcodes / disassemble.c < prev    next >
C/C++ Source or Header  |  1996-09-28  |  4KB  |  167 lines

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