1 /* The common simulator framework for GDB, the GNU Debugger.
3 Copyright 2002, 2005, 2007 Free Software Foundation, Inc.
5 Contributed by Andrew Cagney and Red Hat.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 /* #define SIM_TYPES_H */
26 /* INTEGER QUANTITIES:
30 signed* signed type of the given size
31 unsigned* The corresponding insigned type
35 *NN Size based on the number of bits
36 *_NN Size according to the number of bytes
37 *_word Size based on the target architecture's word
38 word size (32/64 bits)
39 *_cell Size based on the target architecture's
40 IEEE 1275 cell size (almost always 32 bits)
45 #if !defined (SIM_TYPES_H) && defined (__GNUC__)
50 #define UNSIGNED32(X) ((unsigned32) X##UL)
51 #define UNSIGNED64(X) ((unsigned64) X##ULL)
53 #define SIGNED32(X) ((signed32) X##L)
54 #define SIGNED64(X) ((signed64) X##LL)
56 typedef signed int signed8 __attribute__ ((__mode__ (__QI__)));
57 typedef signed int signed16 __attribute__ ((__mode__ (__HI__)));
58 typedef signed int signed32 __attribute__ ((__mode__ (__SI__)));
59 typedef signed int signed64 __attribute__ ((__mode__ (__DI__)));
61 typedef unsigned int unsigned8 __attribute__ ((__mode__ (__QI__)));
62 typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__)));
63 typedef unsigned int unsigned32 __attribute__ ((__mode__ (__SI__)));
64 typedef unsigned int unsigned64 __attribute__ ((__mode__ (__DI__)));
66 typedef struct { unsigned64 a[2]; } unsigned128;
67 typedef struct { signed64 a[2]; } signed128;
72 #if !defined (SIM_TYPES_H) && defined (_MSC_VER)
77 #define UNSIGNED32(X) (X##ui32)
78 #define UNSIGNED64(X) (X##ui64)
80 #define SIGNED32(X) (X##i32)
81 #define SIGNED64(X) (X##i64)
83 typedef signed char signed8;
84 typedef signed short signed16;
85 typedef signed int signed32;
86 typedef signed __int64 signed64;
88 typedef unsigned int unsigned8;
89 typedef unsigned int unsigned16;
90 typedef unsigned int unsigned32;
91 typedef unsigned __int64 unsigned64;
93 typedef struct { unsigned64 a[2]; } unsigned128;
94 typedef struct { signed64 a[2]; } signed128;
99 #if !defined (SIM_TYPES_H)
104 #define UNSIGNED32(X) (X##UL)
105 #define UNSIGNED64(X) (X##ULL)
107 #define SIGNED32(X) (X##L)
108 #define SIGNED64(X) (X##LL)
110 typedef signed char signed8;
111 typedef signed short signed16;
112 #if defined (__ALPHA__)
113 typedef signed int signed32;
114 typedef signed long signed64;
116 typedef signed long signed32;
117 typedef signed long long signed64;
120 typedef unsigned char unsigned8;
121 typedef unsigned short unsigned16;
122 #if defined (__ALPHA__)
123 typedef unsigned int unsigned32;
124 typedef unsigned long unsigned64;
126 typedef unsigned long unsigned32;
127 typedef unsigned long long unsigned64;
130 typedef struct { unsigned64 a[2]; } unsigned128;
131 typedef struct { signed64 a[2]; } signed128;
138 typedef signed8 signed_1;
139 typedef signed16 signed_2;
140 typedef signed32 signed_4;
141 typedef signed64 signed_8;
142 typedef signed128 signed_16;
144 typedef unsigned8 unsigned_1;
145 typedef unsigned16 unsigned_2;
146 typedef unsigned32 unsigned_4;
147 typedef unsigned64 unsigned_8;
148 typedef unsigned128 unsigned_16;
151 /* for general work, the following are defined */
152 /* unsigned: >= 32 bits */
153 /* signed: >= 32 bits */
154 /* long: >= 32 bits, sign undefined */
155 /* int: small indicator */
157 /* target architecture based */
158 #if (WITH_TARGET_WORD_BITSIZE == 64)
159 typedef unsigned64 unsigned_word;
160 typedef signed64 signed_word;
162 #if (WITH_TARGET_WORD_BITSIZE == 32)
163 typedef unsigned32 unsigned_word;
164 typedef signed32 signed_word;
166 #if (WITH_TARGET_WORD_BITSIZE == 16)
167 typedef unsigned16 unsigned_word;
168 typedef signed16 signed_word;
172 /* Other instructions */
173 #if (WITH_TARGET_ADDRESS_BITSIZE == 64)
174 typedef unsigned64 unsigned_address;
175 typedef signed64 signed_address;
177 #if (WITH_TARGET_ADDRESS_BITSIZE == 32)
178 typedef unsigned32 unsigned_address;
179 typedef signed32 signed_address;
181 #if (WITH_TARGET_ADDRESS_BITSIZE == 16)
182 typedef unsigned16 unsigned_address;
183 typedef signed16 signed_address;
185 typedef unsigned_address address_word;
188 /* IEEE 1275 cell size */
189 #if (WITH_TARGET_CELL_BITSIZE == 64)
190 typedef unsigned64 unsigned_cell;
191 typedef signed64 signed_cell;
193 #if (WITH_TARGET_CELL_BITSIZE == 32)
194 typedef unsigned32 unsigned_cell;
195 typedef signed32 signed_cell;
197 typedef signed_cell cell_word; /* cells are normally signed */
200 /* Floating point registers */
201 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
202 typedef unsigned64 fp_word;
204 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
205 typedef unsigned32 fp_word;