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