]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/common/sim-config.h
New file common/sim-config.c sets/checks simulator configuration options.
[thirdparty/binutils-gdb.git] / sim / common / sim-config.h
1 /* This file is part of the program psim.
2
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 */
20
21
22 #ifndef _PSIM_CONFIG_H_
23 #define _PSIM_CONFIG_H_
24
25
26 /* endianness of the host/target:
27
28 If the build process is aware (at compile time) of the endianness
29 of the host/target it is able to eliminate slower generic endian
30 handling code.
31
32 Possible values are 0 (unknown), LITTLE_ENDIAN, BIG_ENDIAN */
33
34 #ifndef WITH_HOST_BYTE_ORDER
35 #define WITH_HOST_BYTE_ORDER 0 /*unknown*/
36 #endif
37
38 #ifndef WITH_TARGET_BYTE_ORDER
39 #define WITH_TARGET_BYTE_ORDER 0 /*unknown*/
40 #endif
41
42 extern int current_host_byte_order;
43 #define CURRENT_HOST_BYTE_ORDER (WITH_HOST_BYTE_ORDER \
44 ? WITH_HOST_BYTE_ORDER \
45 : current_host_byte_order)
46 extern int current_target_byte_order;
47 #define CURRENT_TARGET_BYTE_ORDER (WITH_TARGET_BYTE_ORDER \
48 ? WITH_TARGET_BYTE_ORDER \
49 : current_target_byte_order)
50
51
52
53 /* XOR endian.
54
55 In addition to the above, the simulator can support the's horrible
56 XOR endian mode (for instance implemented by the PowerPC). This
57 feature makes it possible to control the endian mode of a processor
58 using the MSR. */
59
60 /* #define WITH_XOR_ENDIAN 8 */
61
62
63
64 /* Intel host BSWAP support:
65
66 Whether to use bswap on the 486 and pentiums rather than the 386
67 sequence that uses xchgb/rorl/xchgb */
68 #ifndef WITH_BSWAP
69 #define WITH_BSWAP 0
70 #endif
71
72
73
74 /* SMP support:
75
76 Sets a limit on the number of processors that can be simulated. If
77 WITH_SMP is set to zero (0), the simulator is restricted to
78 suporting only on processor (and as a consequence leaves the SMP
79 code out of the build process).
80
81 The actual number of processors is taken from the device
82 /options/smp@<nr-cpu> */
83
84 #if defined (WITH_SMP)
85
86 #if WITH_SMP
87 #define MAX_NR_PROCESSORS WITH_SMP
88 #else
89 #define MAX_NR_PROCESSORS 1
90 #endif
91
92 #endif
93
94
95
96 /* Word size of host/target:
97
98 Set these according to your host and target requirements. At this
99 point in time, I've only compiled (not run) for a 64bit and never
100 built for a 64bit host. This will always remain a compile time
101 option */
102
103 #ifndef WITH_TARGET_WORD_BITSIZE
104 #define WITH_TARGET_WORD_BITSIZE 32 /* compiled only */
105 #endif
106
107 #ifndef WITH_HOST_WORD_BITSIZE
108 #define WITH_HOST_WORD_BITSIZE 32 /* 64bit ready? */
109 #endif
110
111
112
113 /* Program environment:
114
115 Three environments are available - UEA (user), VEA (virtual) and
116 OEA (perating). The former two are environment that users would
117 expect to see (VEA includes things like coherency and the time
118 base) while OEA is what an operating system expects to see. By
119 setting these to specific values, the build process is able to
120 eliminate non relevent environment code
121
122 CURRENT_ENVIRONMENT specifies which of vea or oea is required for
123 the current runtime. */
124
125 #if defined (WITH_ENVIRONMENT)
126
127 #define USER_ENVIRONMENT 1
128 #define VIRTUAL_ENVIRONMENT 2
129 #define OPERATING_ENVIRONMENT 3
130
131 extern int current_environment;
132 #define CURRENT_ENVIRONMENT (WITH_ENVIRONMENT \
133 ? WITH_ENVIRONMENT \
134 : current_environment)
135
136 #endif
137
138
139
140 /* Callback/Default Memory.
141
142 Core includes a builtin memory type (raw_memory) that is
143 implemented using an array. raw_memory does not require any
144 additional functions etc.
145
146 Callback memory is where the core calls a core device for the data
147 it requires.
148
149 Default memory is an extenstion of this where for addresses that do
150 not map into either a callback or core memory range a default map
151 can be used.
152
153 The OEA model uses callback memory for devices and default memory
154 for buses.
155
156 The VEA model uses callback memory to capture `page faults'.
157
158 While it may be possible to eliminate callback/default memory (and
159 hence also eliminate an additional test per memory fetch) it
160 probably is not worth the effort.
161
162 BTW, while raw_memory could have been implemented as a callback,
163 profiling has shown that there is a biger win (at least for the
164 x86) in eliminating a function call for the most common
165 (raw_memory) case. */
166
167 #ifndef WITH_CALLBACK_MEMORY
168 #define WITH_CALLBACK_MEMORY 1
169 #endif
170
171
172
173 /* Alignment:
174
175 The PowerPC may or may not handle miss aligned transfers. An
176 implementation normally handles miss aligned transfers in big
177 endian mode but generates an exception in little endian mode.
178
179 This model. Instead allows both little and big endian modes to
180 either take exceptions or handle miss aligned transfers.
181
182 If 0 is specified then for big-endian mode miss alligned accesses
183 are permitted (NONSTRICT_ALIGNMENT) while in little-endian mode the
184 processor will fault on them (STRICT_ALIGNMENT). */
185
186 #if defined (WITH_ALIGNMENT)
187
188 #define NONSTRICT_ALIGNMENT 1
189 #define STRICT_ALIGNMENT 2
190
191 extern int current_alignment;
192 #define CURRENT_ALIGNMENT (WITH_ALIGNMENT \
193 ? WITH_ALIGNMENT \
194 : current_alignment)
195
196 #endif
197
198
199
200 /* Floating point suport:
201
202 Should the processor trap for all floating point instructions (as
203 if the hardware wasn't implemented) or implement the floating point
204 instructions directly. */
205
206 #if defined (WITH_FLOATING_POINT)
207
208 #define SOFT_FLOATING_POINT 1
209 #define HARD_FLOATING_POINT 2
210
211 extern int current_floating_point;
212 #define CURRENT_FLOATING_POINT (WITH_FLOATING_POINT \
213 ? WITH_FLOATING_POINT \
214 : current_floating_point)
215
216 #endif
217
218
219
220 /* Debugging:
221
222 Control the inclusion of debugging code. */
223
224 /* Include the tracing code. Disabling this eliminates all tracing
225 code */
226
227 #ifndef WITH_TRACE
228 #define WITH_TRACE 1
229 #endif
230
231
232 /* include code that checks assertions scattered through out the
233 program */
234
235 #ifndef WITH_ASSERT
236 #define WITH_ASSERT 1
237 #endif
238
239
240 /* Whether to check instructions for reserved bits being set */
241
242 /* #define WITH_RESERVED_BITS 1 */
243
244
245
246 /* include monitoring code */
247
248 #define MONITOR_INSTRUCTION_ISSUE 1
249 #define MONITOR_LOAD_STORE_UNIT 2
250 /* do not define WITH_MON by default */
251 #define DEFAULT_WITH_MON (MONITOR_LOAD_STORE_UNIT \
252 | MONITOR_INSTRUCTION_ISSUE)
253
254
255 /* Current CPU model (models are in the generated models.h include file) */
256 #ifndef WITH_MODEL
257 #define WITH_MODEL 0
258 #endif
259
260 #define CURRENT_MODEL (WITH_MODEL \
261 ? WITH_MODEL \
262 : current_model)
263
264 #ifndef WITH_DEFAULT_MODEL
265 #define WITH_DEFAULT_MODEL DEFAULT_MODEL
266 #endif
267
268 #define MODEL_ISSUE_IGNORE (-1)
269 #define MODEL_ISSUE_PROCESS 1
270
271 #ifndef WITH_MODEL_ISSUE
272 #define WITH_MODEL_ISSUE 0
273 #endif
274
275 extern int current_model_issue;
276 #define CURRENT_MODEL_ISSUE (WITH_MODEL_ISSUE \
277 ? WITH_MODEL_ISSUE \
278 : current_model_issue)
279
280
281
282 /* Whether or not input/output just uses stdio, or uses printf_filtered for
283 output, and polling input for input. */
284
285 #define DONT_USE_STDIO 2
286 #define DO_USE_STDIO 1
287
288 #ifndef WITH_STDIO
289 #define WITH_STDIO 0
290 #endif
291
292 extern int current_stdio;
293 #define CURRENT_STDIO (WITH_STDIO \
294 ? WITH_STDIO \
295 : current_stdio)
296
297
298
299 /* Specify that configured calls pass parameters in registers when the
300 convention is that they are placed on the stack */
301
302 #ifndef WITH_REGPARM
303 #define WITH_REGPARM 0
304 #endif
305
306 /* Specify that configured calls use an alternative calling mechanism */
307
308 #ifndef WITH_STDCALL
309 #define WITH_STDCALL 0
310 #endif
311
312
313 /* complete/verify/print the simulator configuration */
314
315
316 /* For prefered_target_byte_order arugment */
317
318 #if defined (bfd_little_endian)
319 #define PREFERED_TARGET_BYTE_ORDER(IMAGE) ((IMAGE) == NULL \
320 ? 0 \
321 : bfd_little_endian(IMAGE) \
322 ? LITTLE_ENDIAN \
323 : BIG_ENDIAN)
324 #else
325 #define PREFERED_TARGET_BYTE_ORDER(IMAGE) ((IMAGE) == NULL \
326 ? 0 \
327 : !(IMAGE)->xvec->byteorder_big_p \
328 ? LITTLE_ENDIAN \
329 : BIG_ENDIAN)
330 #endif
331
332
333 extern void sim_config (SIM_DESC sd,
334 int prefered_target_byte_order);
335
336 extern void print_sim_config (SIM_DESC sd);
337
338
339 #endif /* _PSIM_CONFIG_H */