aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-basics.h
blob: a7d7a1ed47289cc41865952ec08e607a35f8d3bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*  This file is part of the program psim.

    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
    Copyright (C) 1997, 1998, Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
    */


#ifndef _SIM_BASICS_H_
#define _SIM_BASICS_H_


/* Basic configuration */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

/* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
   bring potential conflicts out in the open */

#include <stdarg.h>
#include <stdio.h>
#include <setjmp.h>

#ifdef __CYGWIN32__
extern int vasprintf (char **result, const char *format, va_list args);
extern int asprintf (char **result, const char *format, ...);
#endif


#ifndef NULL
#define NULL 0
#endif


	
/* Some versions of GCC include an attribute operator, define it */

#if !defined (__attribute__)
#if (!defined(__GNUC__) || (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
#define __attribute__(arg)
#endif
#endif


/* Global types that code manipulates */

typedef struct _device device;
struct hw;
struct _sim_fpu;


/* Generic address space (maps) and access attributes */

enum {
  read_map = 0,
  write_map = 1,
  exec_map = 2,
  io_map = 3,
  nr_maps = 32, /* something small */
};

enum {
  access_invalid = 0,
  access_read = 1 << read_map,
  access_write = 1 << write_map,
  access_exec = 1 << exec_map,
  access_io = 1 << io_map,
};

enum {
  access_read_write = (access_read | access_write),
  access_read_exec = (access_read | access_exec),
  access_write_exec = (access_write | access_exec),
  access_read_write_exec = (access_read | access_write | access_exec),
  access_read_io = (access_read | access_io),
  access_write_io = (access_write | access_io),
  access_read_write_io = (access_read | access_write | access_io),
  access_exec_io = (access_exec | access_io),
  access_read_exec_io = (access_read | access_exec | access_io),
  access_write_exec_io = (access_write | access_exec | access_io),
  access_read_write_exec_io = (access_read | access_write | access_exec | access_io),
};


/* disposition of an object when things are reset */

typedef enum {
  permenant_object,
  temporary_object,
} object_disposition;


/* Memory transfer types */

typedef enum _transfer_type {
  read_transfer,
  write_transfer,
} transfer_type;


/* directions */

typedef enum {
  bidirect_port,
  input_port,
  output_port,
} port_direction;



/* Basic definitions - ordered so that nothing calls what comes after it.  */

/* FIXME: conditionalizing tconfig.h on HAVE_CONFIG_H seems wrong.  */
#ifdef HAVE_CONFIG_H
#include "tconfig.h"
#endif

#include "ansidecl.h"
#include "gdb/callback.h"
#include "gdb/remote-sim.h"

#include "sim-config.h"

#include "sim-inline.h"

#include "sim-types.h"
#include "sim-bits.h"
#include "sim-endian.h"
#include "sim-signal.h"
#include "sim-arange.h"

#include "sim-utils.h"

/* Note: Only the simpler interfaces are defined here.  More heavy
   weight objects, such as core and events, are defined in the more
   serious sim-base.h header. */

#endif /* _SIM_BASICS_H_ */