]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/common/sim-basics.h
sim: common: clean up asprintf includes a bit
[thirdparty/binutils-gdb.git] / sim / common / sim-basics.h
1 /* The common simulator framework for GDB, the GNU Debugger.
2
3 Copyright 2002-2021 Free Software Foundation, Inc.
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
11 the Free Software Foundation; either version 3 of the License, or
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
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22
23 #ifndef SIM_BASICS_H
24 #define SIM_BASICS_H
25
26
27 /* Basic configuration */
28
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32
33 /* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
34 bring potential conflicts out in the open */
35
36 #include <stdarg.h>
37 #include <stdio.h>
38 #include <setjmp.h>
39
40
41 #ifndef NULL
42 #define NULL 0
43 #endif
44
45
46 #ifndef min
47 #define min(a, b) ((a) < (b) ? (a) : (b))
48 #endif
49 #ifndef max
50 #define max(a, b) ((a) > (b) ? (a) : (b))
51 #endif
52
53
54 /* Some versions of GCC include an attribute operator, define it */
55
56 #if !defined (__attribute__)
57 #if (!defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
58 #define __attribute__(arg)
59 #endif
60 #endif
61
62
63 /* Global types that code manipulates */
64
65 struct hw;
66 struct _sim_fpu;
67
68
69 /* Generic address space (maps) and access attributes */
70
71 enum {
72 read_map = 0,
73 write_map = 1,
74 exec_map = 2,
75 io_map = 3,
76 nr_maps = 32, /* something small */
77 };
78
79 enum {
80 access_invalid = 0,
81 access_read = 1 << read_map,
82 access_write = 1 << write_map,
83 access_exec = 1 << exec_map,
84 access_io = 1 << io_map,
85 };
86
87 enum {
88 access_read_write = (access_read | access_write),
89 access_read_exec = (access_read | access_exec),
90 access_write_exec = (access_write | access_exec),
91 access_read_write_exec = (access_read | access_write | access_exec),
92 access_read_io = (access_read | access_io),
93 access_write_io = (access_write | access_io),
94 access_read_write_io = (access_read | access_write | access_io),
95 access_exec_io = (access_exec | access_io),
96 access_read_exec_io = (access_read | access_exec | access_io),
97 access_write_exec_io = (access_write | access_exec | access_io),
98 access_read_write_exec_io = (access_read | access_write | access_exec | access_io),
99 };
100
101
102 /* disposition of an object when things are reset */
103
104 typedef enum {
105 permenant_object,
106 temporary_object,
107 } object_disposition;
108
109
110 /* Memory transfer types */
111
112 typedef enum _transfer_type {
113 read_transfer,
114 write_transfer,
115 } transfer_type;
116
117
118 /* directions */
119
120 typedef enum {
121 bidirect_port,
122 input_port,
123 output_port,
124 } port_direction;
125
126
127 \f
128 /* Basic definitions - ordered so that nothing calls what comes after it. */
129
130 #include "ansidecl.h"
131 #include "gdb/callback.h"
132 #include "gdb/remote-sim.h"
133
134 #include "sim-config.h"
135
136 #include "sim-inline.h"
137
138 #include "sim-types.h"
139 #include "sim-bits.h"
140 #include "sim-endian.h"
141 #include "sim-signal.h"
142
143 #include "sim-utils.h"
144
145 #include "libiberty.h"
146
147 /* Note: Only the simpler interfaces are defined here. More heavy
148 weight objects, such as core and events, are defined in the more
149 serious sim-base.h header. */
150
151 #endif /* SIM_BASICS_H */