1/* The common simulator framework for GDB, the GNU Debugger.
2
3   Copyright 2002, 2005, 2007, 2008, 2009, 2010, 2011
4   Free Software Foundation, Inc.
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
12   the Free Software Foundation; either version 3 of the License, or
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
21   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
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
57typedef signed int signed8 __attribute__ ((__mode__ (__QI__)));
58typedef signed int signed16 __attribute__ ((__mode__ (__HI__)));
59typedef signed int signed32 __attribute__ ((__mode__ (__SI__)));
60typedef signed int signed64 __attribute__ ((__mode__ (__DI__)));
61
62typedef unsigned int unsigned8 __attribute__ ((__mode__ (__QI__)));
63typedef unsigned int unsigned16 __attribute__ ((__mode__ (__HI__)));
64typedef unsigned int unsigned32 __attribute__ ((__mode__ (__SI__)));
65typedef unsigned int unsigned64 __attribute__ ((__mode__ (__DI__)));
66
67typedef struct { unsigned64 a[2]; } unsigned128;
68typedef 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
84typedef signed char signed8;
85typedef signed short signed16;
86typedef signed int signed32;
87typedef signed __int64 signed64;
88
89typedef unsigned int unsigned8;
90typedef unsigned int unsigned16;
91typedef unsigned int unsigned32;
92typedef unsigned __int64 unsigned64;
93
94typedef struct { unsigned64 a[2]; } unsigned128;
95typedef 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
111typedef signed char signed8;
112typedef signed short signed16;
113#if defined (__ALPHA__)
114typedef signed int signed32;
115typedef signed long signed64;
116#else
117typedef signed long signed32;
118typedef signed long long signed64;
119#endif
120
121typedef unsigned char unsigned8;
122typedef unsigned short unsigned16;
123#if defined (__ALPHA__)
124typedef unsigned int unsigned32;
125typedef unsigned long unsigned64;
126#else
127typedef unsigned long unsigned32;
128typedef unsigned long long unsigned64;
129#endif
130
131typedef struct { unsigned64 a[2]; } unsigned128;
132typedef struct { signed64 a[2]; } signed128;
133
134#endif
135
136
137/* byte based */
138
139typedef signed8 signed_1;
140typedef signed16 signed_2;
141typedef signed32 signed_4;
142typedef signed64 signed_8;
143typedef signed128 signed_16;
144
145typedef unsigned8 unsigned_1;
146typedef unsigned16 unsigned_2;
147typedef unsigned32 unsigned_4;
148typedef unsigned64 unsigned_8;
149typedef 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)
160typedef unsigned64 unsigned_word;
161typedef signed64 signed_word;
162#endif
163#if (WITH_TARGET_WORD_BITSIZE == 32)
164typedef unsigned32 unsigned_word;
165typedef signed32 signed_word;
166#endif
167#if (WITH_TARGET_WORD_BITSIZE == 16)
168typedef unsigned16 unsigned_word;
169typedef signed16 signed_word;
170#endif
171
172
173/* Other instructions */
174#if (WITH_TARGET_ADDRESS_BITSIZE == 64)
175typedef unsigned64 unsigned_address;
176typedef signed64 signed_address;
177#endif
178#if (WITH_TARGET_ADDRESS_BITSIZE == 32)
179typedef unsigned32 unsigned_address;
180typedef signed32 signed_address;
181#endif
182#if (WITH_TARGET_ADDRESS_BITSIZE == 16)
183typedef unsigned16 unsigned_address;
184typedef signed16 signed_address;
185#endif
186typedef unsigned_address address_word;
187
188
189/* IEEE 1275 cell size */
190#if (WITH_TARGET_CELL_BITSIZE == 64)
191typedef unsigned64 unsigned_cell;
192typedef signed64 signed_cell;
193#endif
194#if (WITH_TARGET_CELL_BITSIZE == 32)
195typedef unsigned32 unsigned_cell;
196typedef signed32 signed_cell;
197#endif
198typedef signed_cell cell_word; /* cells are normally signed */
199
200
201/* Floating point registers */
202#if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
203typedef unsigned64 fp_word;
204#endif
205#if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
206typedef unsigned32 fp_word;
207#endif
208
209#endif
210