1 /* The common simulator framework for GDB, the GNU Debugger.
2 
3    Copyright 2002 Free Software Foundation, Inc.
4 
5    Contributed by Andrew Cagney and Red Hat.
6 
7    This file is part of GDB.
8 
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 2 of the License, or
12    (at your option) any later version.
13 
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.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 59 Temple Place - Suite 330,
22    Boston, MA 02111-1307, USA.  */
23 
24 
25 #ifndef SIM_TYPES_H
26 /* #define SIM_TYPES_H */
27 
28 /* INTEGER QUANTITIES:
29 
30    TYPES:
31 
32      signed*    signed type of the given size
33      unsigned*  The corresponding insigned type
34 
35    SIZES
36 
37      *NN	Size based on the number of bits
38      *_NN       Size according to the number of bytes
39      *_word     Size based on the target architecture's word
40      		word size (32/64 bits)
41      *_cell     Size based on the target architecture's
42      		IEEE 1275 cell size (almost always 32 bits)
43 
44 */
45 
46 
47 #if !defined (SIM_TYPES_H) && defined (__GNUC__)
48 #define SIM_TYPES_H
49 
50 /* bit based */
51 
52 #define UNSIGNED32(X) ((unsigned32) X##UL)
53 #define UNSIGNED64(X) ((unsigned64) X##ULL)
54 
55 #define SIGNED32(X) ((signed32) X##L)
56 #define SIGNED64(X) ((signed64) X##LL)
57 
58 typedef signed int signed8 __attribute__ ((__mode__ (__QI__)));
59 typedef signed int signed16 __attribute__ ((__mode__ (__HI__)));
60 typedef signed int signed32 __attribute__ ((__mode__ (__SI__)));
61 typedef signed int signed64 __attribute__ ((__mode__ (__DI__)));
62 
63 typedef unsigned int unsigned8 __attribute__ ((__mode__ (__QI__)));
64 typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__)));
65 typedef unsigned int unsigned32 __attribute__ ((__mode__ (__SI__)));
66 typedef unsigned int unsigned64 __attribute__ ((__mode__ (__DI__)));
67 
68 typedef struct { unsigned64 a[2]; } unsigned128;
69 typedef struct { signed64 a[2]; } signed128;
70 
71 #endif
72 
73 
74 #if !defined (SIM_TYPES_H) && defined (_MSC_VER)
75 #define SIM_TYPES_H
76 
77 /* bit based */
78 
79 #define UNSIGNED32(X) (X##ui32)
80 #define UNSIGNED64(X) (X##ui64)
81 
82 #define SIGNED32(X) (X##i32)
83 #define SIGNED64(X) (X##i64)
84 
85 typedef signed char signed8;
86 typedef signed short signed16;
87 typedef signed int signed32;
88 typedef signed __int64 signed64;
89 
90 typedef unsigned int unsigned8;
91 typedef unsigned int unsigned16;
92 typedef unsigned int unsigned32;
93 typedef unsigned __int64 unsigned64;
94 
95 typedef struct { unsigned64 a[2]; } unsigned128;
96 typedef struct { signed64 a[2]; } signed128;
97 
98 #endif /* _MSC_VER */
99 
100 
101 #if !defined (SIM_TYPES_H)
102 #define SIM_TYPES_H
103 
104 /* bit based */
105 
106 #define UNSIGNED32(X) (X##UL)
107 #define UNSIGNED64(X) (X##ULL)
108 
109 #define SIGNED32(X) (X##L)
110 #define SIGNED64(X) (X##LL)
111 
112 typedef signed char signed8;
113 typedef signed short signed16;
114 #if defined (__ALPHA__)
115 typedef signed int unsigned32;
116 typedef signed long unsigned64;
117 #else
118 typedef signed long unsigned32;
119 typedef signed long long unsigned64;
120 #endif
121 
122 typedef unsigned char unsigned8;
123 typedef unsigned short unsigned16;
124 #if defined (__ALPHA__)
125 typedef unsigned int unsigned32;
126 typedef unsigned long unsigned64;
127 #else
128 typedef unsigned long unsigned32;
129 typedef unsigned long long unsigned64;
130 #endif
131 
132 typedef struct { unsigned64 a[2]; } unsigned128;
133 typedef struct { signed64 a[2]; } signed128;
134 
135 #endif
136 
137 
138 /* byte based */
139 
140 typedef signed8 signed_1;
141 typedef signed16 signed_2;
142 typedef signed32 signed_4;
143 typedef signed64 signed_8;
144 typedef signed128 signed_16;
145 
146 typedef unsigned8 unsigned_1;
147 typedef unsigned16 unsigned_2;
148 typedef unsigned32 unsigned_4;
149 typedef unsigned64 unsigned_8;
150 typedef unsigned128 unsigned_16;
151 
152 
153 /* for general work, the following are defined */
154 /* unsigned: >= 32 bits */
155 /* signed:   >= 32 bits */
156 /* long:     >= 32 bits, sign undefined */
157 /* int:      small indicator */
158 
159 /* target architecture based */
160 #if (WITH_TARGET_WORD_BITSIZE == 64)
161 typedef unsigned64 unsigned_word;
162 typedef signed64 signed_word;
163 #endif
164 #if (WITH_TARGET_WORD_BITSIZE == 32)
165 typedef unsigned32 unsigned_word;
166 typedef signed32 signed_word;
167 #endif
168 #if (WITH_TARGET_WORD_BITSIZE == 16)
169 typedef unsigned16 unsigned_word;
170 typedef signed16 signed_word;
171 #endif
172 
173 
174 /* Other instructions */
175 #if (WITH_TARGET_ADDRESS_BITSIZE == 64)
176 typedef unsigned64 unsigned_address;
177 typedef signed64 signed_address;
178 #endif
179 #if (WITH_TARGET_ADDRESS_BITSIZE == 32)
180 typedef unsigned32 unsigned_address;
181 typedef signed32 signed_address;
182 #endif
183 #if (WITH_TARGET_ADDRESS_BITSIZE == 16)
184 typedef unsigned16 unsigned_address;
185 typedef signed16 signed_address;
186 #endif
187 typedef unsigned_address address_word;
188 
189 
190 /* IEEE 1275 cell size */
191 #if (WITH_TARGET_CELL_BITSIZE == 64)
192 typedef unsigned64 unsigned_cell;
193 typedef signed64 signed_cell;
194 #endif
195 #if (WITH_TARGET_CELL_BITSIZE == 32)
196 typedef unsigned32 unsigned_cell;
197 typedef signed32 signed_cell;
198 #endif
199 typedef signed_cell cell_word; /* cells are normally signed */
200 
201 
202 /* Floating point registers */
203 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
204 typedef unsigned64 fp_word;
205 #endif
206 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
207 typedef unsigned32 fp_word;
208 #endif
209 
210 #endif
211