Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
 
32
 
33
/*
34
			    VERSION INFORMATION
35
			    ===================
36
 
37
--------------------------------------------------------------------------
38
$Header: /u/g/release/CVSROOT/Source/src/installers/sparc/common/addrtypes.h,v 1.1.1.1 1998/01/17 15:55:53 release Exp $
39
--------------------------------------------------------------------------
40
$Log: addrtypes.h,v $
41
 * Revision 1.1.1.1  1998/01/17  15:55:53  release
42
 * First version to be checked into rolling release.
43
 *
44
 * Revision 1.1.1.1  1995/03/13  10:18:27  john
45
 * Entered into CVS
46
 *
47
 * Revision 1.4  1994/07/04  09:24:17  djch
48
 * Jun94 tape version
49
 *
50
 * Revision 1.3  1994/05/25  14:17:48  djch
51
 * Added CREATE_instore_bits to shut up tcc
52
 *
53
 * Revision 1.2  1994/05/13  12:25:08  djch
54
 * Incorporates improvements from expt version
55
 * Separated instore and instore_bits -  macros to convert bits<->bytes etc.
56
 *
57
 * Revision 1.1  1994/05/03  14:50:03  djch
58
 * Initial revision
59
 *
60
 * Revision 1.1  94/05/03  14:47:38  djch
61
 * Initial revision
62
 * 
63
 * Revision 1.1  94/05/03  14:45:48  djch
64
 * Initial revision
65
 * 
66
 * Revision 1.2  93/08/27  11:20:17  11:20:17  ra (Robert Andrews)
67
 * Added comments, reordered fields in union to match disriminant
68
 * enumeration type.
69
 * 
70
 * Revision 1.1  93/06/24  14:57:56  14:57:56  ra (Robert Andrews)
71
 * Initial revision
72
 * 
73
--------------------------------------------------------------------------
74
*/
75
 
76
 
77
#ifndef ADDRTYPES_INCLUDED
78
#define ADDRTYPES_INCLUDED
79
 
80
#include "common_types.h"
81
 
82
#define NOREG	100
83
 
84
typedef int reg_num;		/* so we can distinguish regs */
85
 
86
/*
87
    TYPES REPRESENTING ADDRESSING MODES
88
 
89
    Each of these types represent a different way of representing data.
90
    The type ans is a discriminated union of these types.
91
*/
92
 
93
typedef struct {
94
    int lab ;
95
    reg_num regmove ;
96
} makeans ;
97
 
98
typedef struct {
99
    reg_num base ;
100
    long offset ;		/* in BYTES (bits/8) */
101
} baseoff ;
102
 
103
typedef struct {
104
    baseoff b ;
105
    bool adval ;		/*  */
106
} instore ;
107
 
108
typedef struct {
109
    reg_num base ;
110
    long offset_bits ;		/* in BITS */
111
} baseoff_bits ;
112
 
113
typedef struct {
114
    baseoff_bits b ;
115
    bool adval ;		/*  */
116
} instore_bits ;
117
 
118
typedef struct {
119
    reg_num fr ;
120
    bool dble ;
121
} freg ;
122
 
123
typedef struct {
124
    reg_num *fr ;
125
    bool dble ;
126
} somefreg ;
127
 
128
typedef struct {
129
    reg_num *r ;
130
} somereg ;
131
 
132
typedef struct {
133
    enum ansdiscrim {
134
	inreg,
135
	infreg,
136
	notinreg,
137
	insomereg,
138
	insomefreg
139
    } d ;
140
    union {
141
	reg_num regans ;
142
	freg fregans ;
143
	instore instoreans ;
144
	somereg someregans ;
145
	somefreg somefregans ;
146
    } val ;
147
} ans ;
148
 
149
#if __GNUC__
150
#define  CREATE_instore_bits(a,x) instore_bits a = {{(x).b.base, -1},(x).adval}
151
#else
152
#define  CREATE_instore_bits(a,x) instore_bits a;\
153
  a.b.base = (x).b.base;\
154
  a.b.offset_bits = -1;\
155
  a.adval = (x).adval
156
#endif
157
 
158
#define BITS2BYTES(x) 	((x) >> 3)
159
#define BYTES2BITS(x) 	((x) << 3)
160
				/* bottom 6 bits are used for reg number,
161
				 offset is aligned 32 bits, and doubled, 
162
				 so that bottom6 are clear*/
163
#define REG_PART(x) 	((x) & 0x3f)
164
				/* value (bits) was doubled, so shift by 4,
165
				   and ensure bottom two are clear 
166
				   (cos the old code did this...) */
167
#define BYTE_OFFSET_PART(x) 	(((x) >> 4) & ~0x3)
168
				/* globals and locals use the part above
169
				 REG_PART */
170
#define ADDR_PART(x)	((x) >> 6)
171
/*
172
    TYPE REPRESENTING A STORED VALUE
173
*/
174
 
175
typedef struct {
176
    ans answhere ;
177
    ash ashwhere ;
178
} where ;
179
 
180
 
181
/*
182
    TYPE REPRESENTING A DATA STORAGE TYPE
183
*/
184
 
185
typedef struct {
186
    long maxi ;
187
    long mini ;
188
    char *fmt ;
189
} mm ;
190
 
191
 
192
/*
193
    MACROS FOR SETTING AND ADDRESSING THE COMPONENTS OF AN ANS
194
*/
195
 
196
#define discrim( x )		( x ).d
197
#define regalt( x )		( x ).val.regans
198
#define fregalt( x )		( x ).val.fregans
199
#define insalt( x )		( x ).val.instoreans
200
#define someregalt( x )		( x ).val.someregans.r
201
#define somefregalt( x )	( x ).val.somefregans
202
 
203
#define setregalt( x, y )	( x ).d = inreg ; regalt ( x ) = ( y )
204
#define setfregalt( x, y )	( x ).d = infreg ; fregalt ( x ) = ( y )
205
#define setinsalt( x, y )	( x ).d = notinreg ; insalt ( x ) = ( y )
206
#define setsomeregalt( x, y )	( x ).d = insomereg ; someregalt ( x ) = ( y )
207
#define setsomefregalt( x, y )	( x ).d = insomefreg ; somefregalt ( x ) = ( y )
208
 
209
 
210
#endif