1 /* The common simulator framework for GDB, the GNU Debugger.
3 Copyright 2002-2019 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/>. */
28 /* INTEGER QUANTITIES:
32 signed* signed type of the given size
33 unsigned* The corresponding insigned type
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)
50 # define UNSIGNED32(X) (X##ui32)
51 # define UNSIGNED64(X) (X##ui64)
52 # define SIGNED32(X) (X##i32)
53 # define SIGNED64(X) (X##i64)
55 # define UNSIGNED32(X) ((unsigned32) X##UL)
56 # define UNSIGNED64(X) ((unsigned64) X##ULL)
57 # define SIGNED32(X) ((signed32) X##L)
58 # define SIGNED64(X) ((signed64) X##LL)
61 typedef int8_t signed8
;
62 typedef int16_t signed16
;
63 typedef int32_t signed32
;
64 typedef int64_t signed64
;
66 typedef uint8_t unsigned8
;
67 typedef uint16_t unsigned16
;
68 typedef uint32_t unsigned32
;
69 typedef uint64_t unsigned64
;
71 typedef struct { unsigned64 a
[2]; } unsigned128
;
72 typedef struct { signed64 a
[2]; } signed128
;
77 typedef signed8 signed_1
;
78 typedef signed16 signed_2
;
79 typedef signed32 signed_4
;
80 typedef signed64 signed_8
;
81 typedef signed128 signed_16
;
83 typedef unsigned8 unsigned_1
;
84 typedef unsigned16 unsigned_2
;
85 typedef unsigned32 unsigned_4
;
86 typedef unsigned64 unsigned_8
;
87 typedef unsigned128 unsigned_16
;
90 /* Macros for printf. Usage is restricted to this header. */
91 #define SIM_PRI_TB(t, b) XCONCAT3 (PRI,t,b)
94 /* for general work, the following are defined */
95 /* unsigned: >= 32 bits */
96 /* signed: >= 32 bits */
97 /* long: >= 32 bits, sign undefined */
98 /* int: small indicator */
100 /* target architecture based */
101 #if (WITH_TARGET_WORD_BITSIZE == 64)
102 typedef unsigned64 unsigned_word
;
103 typedef signed64 signed_word
;
105 #if (WITH_TARGET_WORD_BITSIZE == 32)
106 typedef unsigned32 unsigned_word
;
107 typedef signed32 signed_word
;
109 #if (WITH_TARGET_WORD_BITSIZE == 16)
110 typedef unsigned16 unsigned_word
;
111 typedef signed16 signed_word
;
114 #define PRI_TW(t) SIM_PRI_TB (t, WITH_TARGET_WORD_BITSIZE)
115 #define PRIiTW PRI_TW (i)
116 #define PRIxTW PRI_TW (x)
119 /* Other instructions */
120 #if (WITH_TARGET_ADDRESS_BITSIZE == 64)
121 typedef unsigned64 unsigned_address
;
122 typedef signed64 signed_address
;
124 #if (WITH_TARGET_ADDRESS_BITSIZE == 32)
125 typedef unsigned32 unsigned_address
;
126 typedef signed32 signed_address
;
128 #if (WITH_TARGET_ADDRESS_BITSIZE == 16)
129 typedef unsigned16 unsigned_address
;
130 typedef signed16 signed_address
;
132 typedef unsigned_address address_word
;
134 #define PRI_TA(t) SIM_PRI_TB (t, WITH_TARGET_ADDRESS_BITSIZE)
135 #define PRIiTA PRI_TA (i)
136 #define PRIxTA PRI_TA (x)
139 /* IEEE 1275 cell size */
140 #if (WITH_TARGET_CELL_BITSIZE == 64)
141 typedef unsigned64 unsigned_cell
;
142 typedef signed64 signed_cell
;
144 #if (WITH_TARGET_CELL_BITSIZE == 32)
145 typedef unsigned32 unsigned_cell
;
146 typedef signed32 signed_cell
;
148 typedef signed_cell cell_word
; /* cells are normally signed */
150 #define PRI_TC(t) SIM_PRI_TB (t, WITH_TARGET_CELL_BITSIZE)
151 #define PRIiTC PRI_TC (i)
152 #define PRIxTC PRI_TC (x)
155 /* Floating point registers */
156 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 64)
157 typedef unsigned64 fp_word
;
159 #if (WITH_TARGET_FLOATING_POINT_BITSIZE == 32)
160 typedef unsigned32 fp_word
;
163 #define PRI_TF(t) SIM_PRI_TB (t, WITH_TARGET_FLOATING_POINT_BITSIZE)
164 #define PRIiTF PRI_TF (i)
165 #define PRIxTF PRI_TF (x)