2 |
7u83 |
1 |
/*
|
|
|
2 |
Crown Copyright (c) 1996
|
|
|
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 |
VERSION INFORMATION
|
|
|
31 |
===================
|
|
|
32 |
|
|
|
33 |
--------------------------------------------------------------------------
|
|
|
34 |
$Header: /u/g/release/CVSROOT/Source/src/installers/680x0/common/mach.h,v 1.1.1.1 1998/01/17 15:55:49 release Exp $
|
|
|
35 |
--------------------------------------------------------------------------
|
|
|
36 |
$Log: mach.h,v $
|
|
|
37 |
* Revision 1.1.1.1 1998/01/17 15:55:49 release
|
|
|
38 |
* First version to be checked into rolling release.
|
|
|
39 |
*
|
|
|
40 |
Revision 1.1.1.1 1997/10/13 12:42:55 ma
|
|
|
41 |
First version.
|
|
|
42 |
|
|
|
43 |
Revision 1.2 1997/06/18 10:09:35 ma
|
|
|
44 |
Checking in before merging with Input Baseline changes.
|
|
|
45 |
|
|
|
46 |
Revision 1.1.1.1 1997/03/14 07:50:14 ma
|
|
|
47 |
Imported from DRA
|
|
|
48 |
|
|
|
49 |
* Revision 1.2 1996/09/20 13:51:37 john
|
|
|
50 |
* *** empty log message ***
|
|
|
51 |
*
|
|
|
52 |
* Revision 1.1.1.1 1996/09/20 10:56:55 john
|
|
|
53 |
*
|
|
|
54 |
* Revision 1.1.1.1 1996/03/26 15:45:14 john
|
|
|
55 |
*
|
|
|
56 |
* Revision 1.1 93/02/22 17:16:00 17:16:00 ra (Robert Andrews)
|
|
|
57 |
* Initial revision
|
|
|
58 |
*
|
|
|
59 |
--------------------------------------------------------------------------
|
|
|
60 |
*/
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
#ifndef MACH_INCLUDED
|
|
|
64 |
#define MACH_INCLUDED
|
|
|
65 |
|
|
|
66 |
#include "flpttypes.h"
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
/*
|
|
|
70 |
STRUCTURE REPRESENTING MACHINE OPERANDS
|
|
|
71 |
|
|
|
72 |
A machine operand consists of a type, the meaning of which is explained
|
|
|
73 |
below, a value, which can be a number, a string or a floating-point
|
|
|
74 |
number, and two pointers to further machine operands, plus and of.
|
|
|
75 |
*/
|
|
|
76 |
|
|
|
77 |
typedef struct tag_mach_op {
|
|
|
78 |
char type ;
|
|
|
79 |
union {
|
|
|
80 |
long num ;
|
|
|
81 |
char *str ;
|
|
|
82 |
flt *fp ;
|
|
|
83 |
} def ;
|
|
|
84 |
struct tag_mach_op *plus ;
|
|
|
85 |
struct tag_mach_op *of ;
|
|
|
86 |
#ifndef tdf3
|
|
|
87 |
#ifdef EBUG
|
|
|
88 |
int id ;
|
|
|
89 |
#endif
|
|
|
90 |
#endif
|
|
|
91 |
} mach_op ;
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
/*
|
|
|
95 |
STRUCTURE REPRESENTING MACHINE INSTRUCTIONS
|
|
|
96 |
|
|
|
97 |
A machine instruction consists of an instruction number, which can
|
|
|
98 |
take the values given in instrs.h, two machine operands, giving
|
|
|
99 |
the operands of this instruction, a register mask, giving all the
|
|
|
100 |
registers changed by this instruction, and a pointer to the next
|
|
|
101 |
instruction.
|
|
|
102 |
*/
|
|
|
103 |
|
|
|
104 |
typedef struct tag_mach_ins {
|
|
|
105 |
short ins_no ;
|
|
|
106 |
mach_op *op1 ;
|
|
|
107 |
mach_op *op2 ;
|
|
|
108 |
bitpattern changed ;
|
|
|
109 |
struct tag_mach_ins *next ;
|
|
|
110 |
#ifndef tdf3
|
|
|
111 |
#ifdef EBUG
|
|
|
112 |
int id ;
|
|
|
113 |
#endif
|
|
|
114 |
#endif
|
|
|
115 |
} mach_ins ;
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
/*
|
|
|
119 |
OPERAND TYPES
|
|
|
120 |
|
|
|
121 |
These are the possible values for the type of a machine operand.
|
|
|
122 |
The meanings are given below.
|
|
|
123 |
*/
|
|
|
124 |
|
|
|
125 |
#define MACH_BF 0
|
|
|
126 |
#define MACH_CONT 1
|
|
|
127 |
#define MACH_DEC 2
|
|
|
128 |
#define MACH_EXT 3
|
|
|
129 |
#define MACH_EXTQ 4
|
|
|
130 |
#define MACH_FLOATQ 5
|
|
|
131 |
#define MACH_HEX 6
|
|
|
132 |
#define MACH_HEXQ 7
|
|
|
133 |
#define MACH_INC 8
|
|
|
134 |
#define MACH_LAB 9
|
|
|
135 |
#define MACH_LABQ 10
|
|
|
136 |
#define MACH_NEG 11
|
|
|
137 |
#define MACH_REG 12
|
|
|
138 |
#define MACH_RPAIR 13
|
|
|
139 |
#define MACH_SCALE 14
|
|
|
140 |
#define MACH_SPEC 15
|
|
|
141 |
#define MACH_SPECQ 16
|
|
|
142 |
#define MACH_VAL 17
|
|
|
143 |
#define MACH_VALQ 18
|
|
|
144 |
|
|
|
145 |
#ifndef tdf3
|
|
|
146 |
#ifdef EBUG
|
|
|
147 |
#define MACH_COMMENT 19
|
|
|
148 |
#endif
|
|
|
149 |
#endif
|
|
|
150 |
|
|
|
151 |
/*
|
|
|
152 |
REGISTER NUMBERS
|
|
|
153 |
|
|
|
154 |
Each register is identified by a register number.
|
|
|
155 |
*/
|
|
|
156 |
|
|
|
157 |
#define REG_D0 0
|
|
|
158 |
#define REG_D1 1
|
|
|
159 |
#define REG_D2 2
|
|
|
160 |
#define REG_D3 3
|
|
|
161 |
#define REG_D4 4
|
|
|
162 |
#define REG_D5 5
|
|
|
163 |
#define REG_D6 6
|
|
|
164 |
#define REG_D7 7
|
|
|
165 |
#define REG_A0 8
|
|
|
166 |
#define REG_A1 9
|
|
|
167 |
#define REG_A2 10
|
|
|
168 |
#define REG_A3 11
|
|
|
169 |
#define REG_A4 12
|
|
|
170 |
#define REG_A5 13
|
|
|
171 |
#define REG_AP 14
|
|
|
172 |
#define REG_SP 15
|
|
|
173 |
#define REG_FP0 16
|
|
|
174 |
#define REG_FP1 17
|
|
|
175 |
#define REG_FP2 18
|
|
|
176 |
#define REG_FP3 19
|
|
|
177 |
#define REG_FP4 20
|
|
|
178 |
#define REG_FP5 21
|
|
|
179 |
#define REG_FP6 22
|
|
|
180 |
#define REG_FP7 23
|
|
|
181 |
#define REG_PC 24
|
|
|
182 |
#define REG_CCR 25
|
|
|
183 |
#define REG_FPCR 26
|
|
|
184 |
#define REG_FPSR 27
|
|
|
185 |
#define REG_FPIAR 28
|
|
|
186 |
#define REG_ZA0 29
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
/*
|
|
|
190 |
TESTS ON REGISTER NUMBERS
|
|
|
191 |
|
|
|
192 |
These test whether a given register number represents a D-register
|
|
|
193 |
or an A-register.
|
|
|
194 |
*/
|
|
|
195 |
|
|
|
196 |
#define is_dreg( X ) ( ( X ) < REG_A0 )
|
|
|
197 |
#define is_areg( X ) ( ( X ) >= REG_A0 && ( X ) < REG_FP0 )
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
/*
|
|
|
201 |
CONVERSION FROM REGISTER NUMBERS TO MASKS
|
|
|
202 |
|
|
|
203 |
Given a register mask, reg returns the smallest register number
|
|
|
204 |
involved in that mask. Given a register number, regmsk gives the
|
|
|
205 |
corresponding register mask.
|
|
|
206 |
*/
|
|
|
207 |
|
|
|
208 |
#define reg( X ) bit_one ( X )
|
|
|
209 |
#define regmsk( X ) ( ( ( bitpattern ) 1 ) << ( X ) )
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
/*
|
|
|
213 |
USEFUL MASKS ETC.
|
|
|
214 |
|
|
|
215 |
dreg_msk gives all D-registers, areg_msk gives all A-registers,
|
|
|
216 |
save_msk gives all registers preserved across procedure calls.
|
|
|
217 |
regs extracts all the D- and A-registers from a mask. fregs
|
|
|
218 |
extracts all the F-registers.
|
|
|
219 |
*/
|
|
|
220 |
|
|
|
221 |
#define dreg_msk ( ( bitpattern ) 0x000000ff )
|
|
|
222 |
#define areg_msk ( ( bitpattern ) 0x0000ff00 )
|
|
|
223 |
#define save_msk ( ( bitpattern ) 0xfffc3cfc )
|
|
|
224 |
#define regs( X ) ( ( X ) & ( ( bitpattern ) 0xffff ) )
|
|
|
225 |
#define fregs( X ) ( ( X ) & ( ( bitpattern ) 0xff0000 ) )
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
/*
|
|
|
229 |
MEANINGS OF OPERAND TYPES
|
|
|
230 |
|
|
|
231 |
MACH_BF is used to represent bitfield operands. Its of field is
|
|
|
232 |
the basic operand, the def field is a number, giving the bitfield
|
|
|
233 |
offset, the plus field is a dummy operand whose def field is a
|
|
|
234 |
number, giving the bitfield size.
|
|
|
235 |
|
|
|
236 |
MACH_CONT is used to represent contents operands. The of field
|
|
|
237 |
gives the operand the contents of which are meant. The plus field
|
|
|
238 |
may give another operand to be added. The def field is a number
|
|
|
239 |
giving all the registers used in this operand and all its sub-operands.
|
|
|
240 |
|
|
|
241 |
MACH_DEC is used to represent pre-decremented registers. Its def
|
|
|
242 |
field is the register number involved.
|
|
|
243 |
|
|
|
244 |
MACH_EXT and MACH_EXTQ are used to represent external names. Their
|
|
|
245 |
def field is a string giving the external name.
|
|
|
246 |
|
|
|
247 |
MACH_FLOATQ is used to represent floating-point numbers. Its def
|
|
|
248 |
field is a pointer to the internal representation of the number.
|
|
|
249 |
|
|
|
250 |
MACH_HEX, MACH_HEXQ, MACH_VAL and MACH_VALQ are used to represent
|
|
|
251 |
integer constants. Their def field gives the value. The different
|
|
|
252 |
types allow different numbers to be expressed in decimal or hex.
|
|
|
253 |
|
|
|
254 |
MACH_INC is used to represent post-incremented registers. Its def
|
|
|
255 |
field is the register number involved.
|
|
|
256 |
|
|
|
257 |
MACH_LAB and MACH_LABQ are used to represent labels. Their def
|
|
|
258 |
field is the label number.
|
|
|
259 |
|
|
|
260 |
MACH_NEG is used to indicate that an operand should be negated.
|
|
|
261 |
The operand to be negated is given by the plus field.
|
|
|
262 |
|
|
|
263 |
MACH_REG is used to represent registers. Its def field gives the
|
|
|
264 |
register number.
|
|
|
265 |
|
|
|
266 |
MACH_RPAIR is used to represent register pairs. Its def field
|
|
|
267 |
gives the first register number, the plus field is a dummy operand
|
|
|
268 |
whose def field gives the second register number.
|
|
|
269 |
|
|
|
270 |
MACH_SCALE is used to represent scaled operands. Its def field
|
|
|
271 |
is a number, giving the scaling factor, and its of field gives
|
|
|
272 |
the operand being scaled.
|
|
|
273 |
|
|
|
274 |
MACH_SPEC and MACH_SPECQ are used to represent special labels.
|
|
|
275 |
Their def field is a string giving the special identifier.
|
|
|
276 |
|
|
|
277 |
Most 680x0 operands and constants can be expressed by using the
|
|
|
278 |
plus and of fields to connect the basic operands. A special use
|
|
|
279 |
of the of field is to string together a list of constants
|
|
|
280 |
(which do not otherwise use it - see evaluate.c and output.c).
|
|
|
281 |
|
|
|
282 |
For example, the register indirect operand 4(%a0) is represented
|
|
|
283 |
by the machine operand a given by :
|
|
|
284 |
|
|
|
285 |
a = { MACH_CONT, regmsk ( REG_A0 ), null, &b }
|
|
|
286 |
b = { MACH_REG, REG_A0, &c, null }
|
|
|
287 |
c = { MACH_VAL, 4, null, null }
|
|
|
288 |
*/
|
|
|
289 |
|
|
|
290 |
#endif
|