* aclocal.m4: Check for headers time.h, sys/time.h, sys/resource.h.
[external/binutils.git] / sim / common / sim-basics.h
1 /*  This file is part of the program psim.
2
3     Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
4     Copyright (C) 1997, Free Software Foundation, Inc.
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15  
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  
20     */
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 #ifndef NULL
41 #define NULL 0
42 #endif
43
44
45
46         
47 /* Some versions of GCC include an attribute operator, define it */
48
49 #if !defined (__attribute__)
50 #if (!defined(__GNUC__) \
51      || (__GNUC__ < 2) \
52      || (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
53 #define __attribute__(arg)
54 #endif
55 #endif
56
57
58
59 /* Memory management with an allocator that clears memory before use. */
60
61 void *zalloc (unsigned long size);
62
63 #define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE))
64
65 void zfree(void*);
66
67
68 /* Utilities for elapsed time reporting.  */
69 /* Opaque type, known only inside sim_elapsed_time_foo fns.  */
70 typedef unsigned long SIM_ELAPSED_TIME;
71 /* Get reference point for future call to sim_time_elapsed.  */
72 SIM_ELAPSED_TIME sim_elapsed_time_get (void);
73 /* Elapsed time in milliseconds since START.  */
74 unsigned long sim_elapsed_time_since (SIM_ELAPSED_TIME start);
75
76
77 /* Global types that code manipulates */
78
79 typedef struct _device device;
80
81
82 /* Address access attributes */
83 typedef enum _access_type {
84   access_invalid = 0,
85   access_read = 1,
86   access_write = 2,
87   access_read_write = 3,
88   access_exec = 4,
89   access_read_exec = 5,
90   access_write_exec = 6,
91   access_read_write_exec = 7,
92 } access_type;
93
94
95 /* Address attachement types */
96 typedef enum _attach_type {
97   attach_invalid,
98   attach_raw_memory,
99   attach_callback,
100   /* ... */
101 } attach_type;
102
103
104
105 /* Basic definitions - ordered so that nothing calls what comes after
106    it */
107
108 #ifdef HAVE_CONFIG_H
109 #include "tconfig.h"
110 #endif
111 #include "ansidecl.h"
112 #include "callback.h"
113 #include "remote-sim.h"
114
115 #include "sim-config.h"
116
117 #include "sim-base.h"
118 #include "sim-trace.h"
119
120 #include "sim-inline.h"
121
122 #include "sim-types.h"
123 #include "sim-bits.h"
124 #include "sim-endian.h"
125
126 #endif /* _SIM_BASICS_H_ */