cpu-powerpc.c revision 77298
1/* BFD PowerPC CPU definition
2   Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
3   Contributed by Ian Lance Taylor, Cygnus Support.
4
5This file is part of BFD, the Binary File Descriptor library.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, 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/* The common PowerPC architecture is compatible with the RS/6000.  */
26
27static const bfd_arch_info_type *powerpc_compatible
28  PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
29
30static const bfd_arch_info_type *
31powerpc_compatible (a,b)
32     const bfd_arch_info_type *a;
33     const bfd_arch_info_type *b;
34{
35  BFD_ASSERT (a->arch == bfd_arch_powerpc);
36  switch (b->arch)
37    {
38    default:
39      return NULL;
40    case bfd_arch_powerpc:
41      return bfd_default_compatible (a, b);
42    case bfd_arch_rs6000:
43      if (a->mach == 0)
44	return a;
45      return NULL;
46    }
47  /*NOTREACHED*/
48}
49
50static const bfd_arch_info_type arch_info_struct[] =
51{
52  {
53    32,	/* 32 bits in a word */
54    32,	/* 32 bits in an address */
55    8,	/* 8 bits in a byte */
56    bfd_arch_powerpc,
57    bfd_mach_ppc_603,
58    "powerpc",
59    "powerpc:603",
60    3,
61    false, /* not the default */
62    powerpc_compatible,
63    bfd_default_scan,
64    &arch_info_struct[1]
65  },
66  {
67    32,	/* 32 bits in a word */
68    32,	/* 32 bits in an address */
69    8,	/* 8 bits in a byte */
70    bfd_arch_powerpc,
71    bfd_mach_ppc_ec603e,
72    "powerpc",
73    "powerpc:EC603e",
74    3,
75    false, /* not the default */
76    powerpc_compatible,
77    bfd_default_scan,
78    &arch_info_struct[2]
79  },
80  {
81    32,	/* 32 bits in a word */
82    32,	/* 32 bits in an address */
83    8,	/* 8 bits in a byte */
84    bfd_arch_powerpc,
85    bfd_mach_ppc_604,
86    "powerpc",
87    "powerpc:604",
88    3,
89    false, /* not the default */
90    powerpc_compatible,
91    bfd_default_scan,
92    &arch_info_struct[3]
93  },
94  {
95    32,	/* 32 bits in a word */
96    32,	/* 32 bits in an address */
97    8,	/* 8 bits in a byte */
98    bfd_arch_powerpc,
99    bfd_mach_ppc_403,
100    "powerpc",
101    "powerpc:403",
102    3,
103    false, /* not the default */
104    powerpc_compatible,
105    bfd_default_scan,
106    &arch_info_struct[4]
107  },
108  {
109    32,	/* 32 bits in a word */
110    32,	/* 32 bits in an address */
111    8,	/* 8 bits in a byte */
112    bfd_arch_powerpc,
113    bfd_mach_ppc_601,
114    "powerpc",
115    "powerpc:601",
116    3,
117    false, /* not the default */
118    powerpc_compatible,
119    bfd_default_scan,
120    &arch_info_struct[5]
121  },
122  {
123    64,	/* 64 bits in a word */
124    64,	/* 64 bits in an address */
125    8,	/* 8 bits in a byte */
126    bfd_arch_powerpc,
127    bfd_mach_ppc_620,
128    "powerpc",
129    "powerpc:620",
130    3,
131    false, /* not the default */
132    powerpc_compatible,
133    bfd_default_scan,
134    &arch_info_struct[6]
135  },
136  {
137    64,	/* 64 bits in a word */
138    64,	/* 64 bits in an address */
139    8,	/* 8 bits in a byte */
140    bfd_arch_powerpc,
141    bfd_mach_ppc_630,
142    "powerpc",
143    "powerpc:630",
144    3,
145    false, /* not the default */
146    powerpc_compatible,
147    bfd_default_scan,
148    &arch_info_struct[7]
149  },
150  {
151    64,	/* 64 bits in a word */
152    64,	/* 64 bits in an address */
153    8,	/* 8 bits in a byte */
154    bfd_arch_powerpc,
155    bfd_mach_ppc_a35,
156    "powerpc",
157    "powerpc:a35",
158    3,
159    false, /* not the default */
160    powerpc_compatible,
161    bfd_default_scan,
162    &arch_info_struct[8]
163  },
164  {
165    64,	/* 64 bits in a word */
166    64,	/* 64 bits in an address */
167    8,	/* 8 bits in a byte */
168    bfd_arch_powerpc,
169    bfd_mach_ppc_rs64ii,
170    "powerpc",
171    "powerpc:rs64ii",
172    3,
173    false, /* not the default */
174    powerpc_compatible,
175    bfd_default_scan,
176    &arch_info_struct[9]
177  },
178  {
179    64,	/* 64 bits in a word */
180    64,	/* 64 bits in an address */
181    8,	/* 8 bits in a byte */
182    bfd_arch_powerpc,
183    bfd_mach_ppc_rs64iii,
184    "powerpc",
185    "powerpc:rs64iii",
186    3,
187    false, /* not the default */
188    powerpc_compatible,
189    bfd_default_scan,
190    &arch_info_struct[10]
191  },
192  {
193    32,	/* 32 bits in a word */
194    32,	/* 32 bits in an address */
195    8,	/* 8 bits in a byte */
196    bfd_arch_powerpc,
197    bfd_mach_ppc_7400,
198    "powerpc",
199    "powerpc:7400",
200    3,
201    false, /* not the default */
202    powerpc_compatible,
203    bfd_default_scan,
204    &arch_info_struct[11]
205  },
206  {
207    32,       /* 32 bits in a word */
208    32,       /* 32 bits in an address */
209    8,        /* 8 bits in a byte */
210    bfd_arch_powerpc,
211    bfd_mach_ppc_860,
212    "powerpc",
213    "powerpc:MPC8XX",
214    3,
215    false, /* not the default */
216    powerpc_compatible,
217    bfd_default_scan,
218    0
219  }
220};
221
222const bfd_arch_info_type bfd_powerpc_arch =
223  {
224    32,	/* 32 bits in a word */
225    32,	/* 32 bits in an address */
226    8,	/* 8 bits in a byte */
227    bfd_arch_powerpc,
228    bfd_mach_ppc, /* for the POWER/PowerPC common architecture */
229    "powerpc",
230    "powerpc:common",
231    3,
232    true, /* the default */
233    powerpc_compatible,
234    bfd_default_scan,
235    &arch_info_struct[0]
236  };
237