This commit was generated by cvs2svn to track changes on a CVS vendor
[external/binutils.git] / sim / common / sim-basics.h
1 /* The common simulator framework for GDB, the GNU Debugger.
2
3    Copyright 2002, 2004 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 2 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, write to the Free Software
21    Foundation, Inc., 59 Temple Place - Suite 330,
22    Boston, MA 02111-1307, USA.  */
23
24
25 #ifndef _SIM_BASICS_H_
26 #define _SIM_BASICS_H_
27
28
29 /* Basic configuration */
30
31 #ifdef HAVE_CONFIG_H
32 #include "cconfig.h"
33 #endif
34
35 /* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
36    bring potential conflicts out in the open */
37
38 #include <stdarg.h>
39 #include <stdio.h>
40 #include <setjmp.h>
41
42 #ifdef __CYGWIN32__
43 extern int vasprintf (char **result, const char *format, va_list args);
44 extern int asprintf (char **result, const char *format, ...);
45 #endif
46
47
48 #ifndef NULL
49 #define NULL 0
50 #endif
51
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 typedef struct _device device;
66 struct hw;
67 struct _sim_fpu;
68
69
70 /* Generic address space (maps) and access attributes */
71
72 enum {
73   read_map = 0,
74   write_map = 1,
75   exec_map = 2,
76   io_map = 3,
77   nr_maps = 32, /* something small */
78 };
79
80 enum {
81   access_invalid = 0,
82   access_read = 1 << read_map,
83   access_write = 1 << write_map,
84   access_exec = 1 << exec_map,
85   access_io = 1 << io_map,
86 };
87
88 enum {
89   access_read_write = (access_read | access_write),
90   access_read_exec = (access_read | access_exec),
91   access_write_exec = (access_write | access_exec),
92   access_read_write_exec = (access_read | access_write | access_exec),
93   access_read_io = (access_read | access_io),
94   access_write_io = (access_write | access_io),
95   access_read_write_io = (access_read | access_write | access_io),
96   access_exec_io = (access_exec | access_io),
97   access_read_exec_io = (access_read | access_exec | access_io),
98   access_write_exec_io = (access_write | access_exec | access_io),
99   access_read_write_exec_io = (access_read | access_write | access_exec | access_io),
100 };
101
102
103 /* disposition of an object when things are reset */
104
105 typedef enum {
106   permenant_object,
107   temporary_object,
108 } object_disposition;
109
110
111 /* Memory transfer types */
112
113 typedef enum _transfer_type {
114   read_transfer,
115   write_transfer,
116 } transfer_type;
117
118
119 /* directions */
120
121 typedef enum {
122   bidirect_port,
123   input_port,
124   output_port,
125 } port_direction;
126
127
128 \f
129 /* Basic definitions - ordered so that nothing calls what comes after it.  */
130
131 /* FIXME: conditionalizing tconfig.h on HAVE_CONFIG_H seems wrong.  */
132 #ifdef HAVE_CONFIG_H
133 #include "tconfig.h"
134 #endif
135
136 #include "ansidecl.h"
137 #include "gdb/callback.h"
138 #include "gdb/remote-sim.h"
139
140 #include "sim-config.h"
141
142 #include "sim-inline.h"
143
144 #include "sim-types.h"
145 #include "sim-bits.h"
146 #include "sim-endian.h"
147 #include "sim-signal.h"
148 #include "sim-arange.h"
149
150 #include "sim-utils.h"
151
152 /* Note: Only the simpler interfaces are defined here.  More heavy
153    weight objects, such as core and events, are defined in the more
154    serious sim-base.h header. */
155
156 #endif /* _SIM_BASICS_H_ */