Commit | Line | Data |
---|---|---|
b85e4829 AC |
1 | /* The common simulator framework for GDB, the GNU Debugger. |
2 | ||
ecd75fc8 | 3 | Copyright 2002-2014 Free Software Foundation, Inc. |
b85e4829 AC |
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 | |
4744ac1b | 11 | the Free Software Foundation; either version 3 of the License, or |
b85e4829 AC |
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 | |
4744ac1b | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c SS |
21 | |
22 | ||
23 | #ifndef SIM_TYPES_H | |
24 | /* #define SIM_TYPES_H */ | |
25 | ||
26 | /* INTEGER QUANTITIES: | |
27 | ||
28 | TYPES: | |
29 | ||
30 | signed* signed type of the given size | |
31 | unsigned* The corresponding insigned type | |
32 | ||
33 | SIZES | |
34 | ||
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) | |
41 | ||
42 | */ | |
43 | ||
44 | ||
45 | #if !defined (SIM_TYPES_H) && defined (__GNUC__) | |
46 | #define SIM_TYPES_H | |
47 | ||
48 | /* bit based */ | |
49 | ||
50 | #define UNSIGNED32(X) ((unsigned32) X##UL) | |
51 | #define UNSIGNED64(X) ((unsigned64) X##ULL) | |
52 | ||
53 | #define SIGNED32(X) ((signed32) X##L) | |
54 | #define SIGNED64(X) ((signed64) X##LL) | |
55 | ||
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__))); | |
60 | ||
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__))); | |
65 | ||
66 | typedef struct { unsigned64 a[2]; } unsigned128; | |
67 | typedef struct { signed64 a[2]; } signed128; | |
68 | ||
69 | #endif | |
70 | ||
71 | ||
72 | #if !defined (SIM_TYPES_H) && defined (_MSC_VER) | |
73 | #define SIM_TYPES_H | |
74 | ||
75 | /* bit based */ | |
76 | ||
77 | #define UNSIGNED32(X) (X##ui32) | |
78 | #define UNSIGNED64(X) (X##ui64) | |
79 | ||
80 | #define SIGNED32(X) (X##i32) | |
81 | #define SIGNED64(X) (X##i64) | |
82 | ||
83 | typedef signed char signed8; | |
84 | typedef signed short signed16; | |
85 | typedef signed int signed32; | |
86 | typedef signed __int64 signed64; | |
87 | ||
88 | typedef unsigned int unsigned8; | |
89 | typedef unsigned int unsigned16; | |
90 | typedef unsigned int unsigned32; | |
91 | typedef unsigned __int64 unsigned64; | |
92 | ||
93 | typedef struct { unsigned64 a[2]; } unsigned128; | |
94 | typedef struct { signed64 a[2]; } signed128; | |
95 | ||
96 | #endif /* _MSC_VER */ | |
97 | ||
98 | ||
99 | #if !defined (SIM_TYPES_H) | |
100 | #define SIM_TYPES_H | |
101 | ||
102 | /* bit based */ | |
103 | ||
104 | #define UNSIGNED32(X) (X##UL) | |
105 | #define UNSIGNED64(X) (X##ULL) | |
106 | ||
107 | #define SIGNED32(X) (X##L) | |
108 | #define SIGNED64(X) (X##LL) | |
109 | ||
110 | typedef signed char signed8; | |
111 | typedef signed short signed16; | |
112 | #if defined (__ALPHA__) | |
3f6da722 MI |
113 | typedef signed int signed32; |
114 | typedef signed long signed64; | |
c906108c | 115 | #else |
3f6da722 MI |
116 | typedef signed long signed32; |
117 | typedef signed long long signed64; | |
c906108c SS |
118 | #endif |
119 | ||
120 | typedef unsigned char unsigned8; | |
121 | typedef unsigned short unsigned16; | |
122 | #if defined (__ALPHA__) | |
123 | typedef unsigned int unsigned32; | |
124 | typedef unsigned long unsigned64; | |
125 | #else | |
126 | typedef unsigned long unsigned32; | |
127 | typedef unsigned long long unsigned64; | |
128 | #endif | |
129 | ||
130 | typedef struct { unsigned64 a[2]; } unsigned128; | |
131 | typedef struct { signed64 a[2]; } signed128; | |
132 | ||
133 | #endif | |
134 | ||
135 | ||
136 | /* byte based */ | |
137 | ||
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; | |
143 | ||
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; | |
149 | ||
150 | ||
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 */ | |
156 | ||
157 | /* target architecture based */ | |
158 | #if (WITH_TARGET_WORD_BITSIZE == 64) | |
159 | typedef unsigned64 unsigned_word; | |
160 | typedef signed64 signed_word; | |
161 | #endif | |
162 | #if (WITH_TARGET_WORD_BITSIZE == 32) | |
163 | typedef unsigned32 unsigned_word; | |
164 | typedef signed32 signed_word; | |
165 | #endif | |
3c765a54 AC |
166 | #if (WITH_TARGET_WORD_BITSIZE == 16) |
167 | typedef unsigned16 unsigned_word; | |
168 | typedef signed16 signed_word; | |
169 | #endif | |
c906108c SS |
170 | |
171 | ||
172 | /* Other instructions */ | |
173 | #if (WITH_TARGET_ADDRESS_BITSIZE == 64) | |
174 | typedef unsigned64 unsigned_address; | |
175 | typedef signed64 signed_address; | |
176 | #endif | |
177 | #if (WITH_TARGET_ADDRESS_BITSIZE == 32) | |
178 | typedef unsigned32 unsigned_address; | |
179 | typedef signed32 signed_address; | |
180 | #endif | |
3c765a54 AC |
181 | #if (WITH_TARGET_ADDRESS_BITSIZE == 16) |
182 | typedef unsigned16 unsigned_address; | |
183 | typedef signed16 signed_address; | |
184 | #endif | |
c906108c SS |
185 | typedef unsigned_address address_word; |
186 | ||
187 | ||
188 | /* IEEE 1275 cell size */ | |
189 | #if (WITH_TARGET_CELL_BITSIZE == 64) | |
190 | typedef unsigned64 unsigned_cell; | |
191 | typedef signed64 signed_cell; | |
192 | #endif | |
193 | #if (WITH_TARGET_CELL_BITSIZE == 32) | |
194 | typedef unsigned32 unsigned_cell; | |
195 | typedef signed32 signed_cell; | |
196 | #endif | |
197 | typedef signed_cell cell_word; /* cells are normally signed */ | |
198 | ||
199 | ||
200 | /* Floating point registers */ | |
201 | #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64) | |
202 | typedef unsigned64 fp_word; | |
203 | #endif | |
204 | #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32) | |
205 | typedef unsigned32 fp_word; | |
206 | #endif | |
207 | ||
208 | #endif |