home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / binutils.7 / binutils / binutils-2.7 / bfd / cpu-h8300.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-04  |  2.8 KB  |  118 lines

  1. /* BFD library support routines for the Hitachi H8/300 architecture.
  2.    Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
  3.    Hacked by Steve Chamberlain of Cygnus Support.
  4.  
  5. This file is part of BFD, the Binary File Descriptor library.
  6.  
  7. This program 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  20.  
  21. #include "bfd.h"
  22. #include "sysdep.h"
  23. #include "libbfd.h"
  24.  
  25. int bfd_default_scan_num_mach ();
  26.  
  27. static boolean
  28. h8300_scan (info, string)
  29.      const struct bfd_arch_info *info;
  30.      const char *string;
  31. {
  32.   if (*string != 'h' && *string != 'H')
  33.     return false;
  34.  
  35.   string++;
  36.   if (*string != '8')
  37.     return false;
  38.  
  39.   string++;
  40.   if (*string == '/')
  41.     string++;
  42.  
  43.   if (*string != '3')
  44.     return false;
  45.   string++;
  46.   if (*string != '0')
  47.     return false;
  48.   string++;
  49.   if (*string != '0')
  50.     return false;
  51.   string++;
  52.   if (*string == '-')
  53.     string++;
  54.   if (*string == 'h' || *string == 'H')
  55.     {
  56.       return (info->mach == bfd_mach_h8300h);
  57.     }
  58.   else
  59.     {
  60.       return info->mach == bfd_mach_h8300;
  61.     }
  62. }
  63.  
  64.  
  65. /* This routine is provided two arch_infos and works out the 
  66.    machine which would be compatible with both and returns a pointer
  67.    to its info structure */
  68.  
  69. static const bfd_arch_info_type *
  70. compatible (in, out)
  71.      const bfd_arch_info_type * in;
  72.      const bfd_arch_info_type * out;
  73. {
  74.   /* It's really not a good idea to mix and match modes.  */
  75.   if (in->mach != out->mach)
  76.     return 0;
  77.   else
  78.     return in;
  79. }
  80.  
  81. #define H8300H_INFO_STRUCT bfd_h8300_arch
  82. static const bfd_arch_info_type h8300_info_struct =
  83. {
  84.   16,                /* 16 bits in a word */
  85.   16,                /* 16 bits in an address */
  86.   8,                /* 8 bits in a byte */
  87.   bfd_arch_h8300,
  88.   bfd_mach_h8300,
  89.   "h8300",            /* arch_name  */
  90.   "h8300",            /* printable name */
  91.   1,
  92.   true,                /* the default machine */
  93.   compatible,
  94.   h8300_scan,
  95. /*    local_bfd_reloc_type_lookup, */
  96.   0,
  97. };
  98.  
  99. const bfd_arch_info_type H8300H_INFO_STRUCT =
  100. {
  101.   32,                /* 32 bits in a word */
  102.   32,                /* 32 bits in an address */
  103.   8,                /* 8 bits in a byte */
  104.   bfd_arch_h8300,
  105.   bfd_mach_h8300h,
  106.   "h8300h",            /* arch_name  */
  107.   "h8300h",            /* printable name */
  108.   1,
  109.   false,            /* the default machine */
  110.   compatible,
  111.   h8300_scan,
  112. /*    local_bfd_reloc_type_lookup, */
  113.   &h8300_info_struct,
  114. };
  115.  
  116.  
  117. #undef H8300_INFO_STRUCT
  118.