aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc/basics.h
blob: 057cf1ab0e454055fb7e3aa5537ee8118e3e6545 (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
/*  This file is part of the program psim.

    Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>

    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 3 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, see <http://www.gnu.org/licenses/>.
 
    */


#ifndef _BASICS_H_
#define _BASICS_H_

/* This must come before any other includes.  */
#include "defs.h"

/* from Michael Meissner, macro's to handle concating symbols better */

#if defined(__STDC__) || defined(ALMOST_STDC)
#define CONCAT2(a,b)	 a##b
#define CONCAT3(a,b,c)	 a##b##c
#define CONCAT4(a,b,c,d) a##b##c##d
#else
#define CONCAT2(a,b)	 a/**/b
#define CONCAT3(a,b,c)	 a/**/b/**/c
#define CONCAT4(a,b,c,d) a/**/b/**/c/**/d
#endif

#define XCONCAT2(a,b)     CONCAT2(a,b)
#define XCONCAT3(a,b,c)   CONCAT3(a,b,c)
#define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d)


/* many things pass around the cpu and psim object with out knowing
   what it is */

typedef struct _cpu cpu;
typedef struct _psim psim;
typedef struct _device device;
typedef struct _device_instance device_instance;
typedef struct _event_queue event_queue;
typedef struct _event_entry_tag *event_entry_tag;


/* many things are moving data between the host and target */

typedef enum {
  cooked_transfer,
  raw_transfer,
} transfer_mode;


/* possible exit statuses */

typedef enum {
  was_continuing, was_trap, was_exited, was_signalled
} stop_reason;


/* disposition of an object when things are next restarted */

typedef enum {
  permenant_object,
  tempoary_object,
} object_disposition;


/* directions */

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



/* Basic configuration */

#include "ppc-config.h"
#include "inline.h"


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

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


#ifndef NORETURN
#define NORETURN
#endif

#ifndef NULL
#define NULL 0
#endif

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

#if !defined (UNUSED)
#if (!defined(__GNUC__) \
     || (__GNUC__ < 2) \
     || (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
#define UNUSED
#else
#define UNUSED __attribute__((__unused__))
#endif
#endif


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

#include "sim_callbacks.h"

#include "debug.h"

#include "words.h"
#include "bits.h"
#include "sim-endian.h"

#endif /* _BASICS_H_ */