25b7e249bd7458802cf1b82e2c5b813a438bffe2
[external/binutils.git] / bfd / cpu-i386.c
1 /* BFD support for the Intel 386 architecture.
2    Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002
3    Free Software Foundation, Inc.
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 /* Don't mix 32 bit and 64 bit files.  */
26
27 static const bfd_arch_info_type *i386_compatible
28   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
29
30 static const bfd_arch_info_type *
31 i386_compatible (a, b)
32      const bfd_arch_info_type *a;
33      const bfd_arch_info_type *b;
34 {
35   if (a->bits_per_word != b->bits_per_word)
36     return NULL;
37
38   return bfd_default_compatible (a, b);
39 }
40   
41 const bfd_arch_info_type bfd_i386_arch_intel_syntax =
42 {
43   32,   /* 32 bits in a word */
44   32,   /* 32 bits in an address */
45   8,    /* 8 bits in a byte */
46   bfd_arch_i386,
47   bfd_mach_i386_i386_intel_syntax,
48   "i386:intel",
49   "i386:intel",
50   3,
51   true,
52   i386_compatible,
53   bfd_default_scan ,
54   0,
55 };
56 const bfd_arch_info_type bfd_x86_64_arch_intel_syntax =
57 {
58   64, /* 64 bits in a word */
59   64, /* 64 bits in an address */
60   8,  /* 8 bits in a byte */
61   bfd_arch_i386,
62   bfd_mach_x86_64_intel_syntax,
63   "x86-64:intel",
64   "x86-64:intel",
65   3,
66   true,
67   i386_compatible,
68   bfd_default_scan ,
69   &bfd_i386_arch_intel_syntax,
70 };
71 static const bfd_arch_info_type i8086_arch =
72 {
73   32,   /* 32 bits in a word */
74   32,   /* 32 bits in an address (well, not really) */
75   8,    /* 8 bits in a byte */
76   bfd_arch_i386,
77   bfd_mach_i386_i8086,
78   "i8086",
79   "i8086",
80   3,
81   false,
82   i386_compatible,
83   bfd_default_scan ,
84   &bfd_x86_64_arch_intel_syntax,
85 };
86
87 const bfd_arch_info_type bfd_x86_64_arch =
88 {
89   64, /* 32 bits in a word */
90   64, /* 32 bits in an address */
91   8,  /* 8 bits in a byte */
92   bfd_arch_i386,
93   bfd_mach_x86_64,
94   "x86-64",
95   "x86-64",
96   3,
97   true,
98   i386_compatible,
99   bfd_default_scan ,
100   &i8086_arch,
101 };
102
103 const bfd_arch_info_type bfd_i386_arch =
104 {
105   32,   /* 32 bits in a word */
106   32,   /* 32 bits in an address */
107   8,    /* 8 bits in a byte */
108   bfd_arch_i386,
109   bfd_mach_i386_i386,
110   "i386",
111   "i386",
112   3,
113   true,
114   i386_compatible,
115   bfd_default_scan ,
116   &bfd_x86_64_arch
117 };