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/ops_shared.h,v 1.1.1.1 1998/01/17 15:55:50 release Exp $
|
|
|
35 |
--------------------------------------------------------------------------
|
|
|
36 |
$Log: ops_shared.h,v $
|
|
|
37 |
* Revision 1.1.1.1 1998/01/17 15:55:50 release
|
|
|
38 |
* First version to be checked into rolling release.
|
|
|
39 |
*
|
|
|
40 |
Revision 1.1.1.1 1997/10/13 12:42:57 ma
|
|
|
41 |
First version.
|
|
|
42 |
|
|
|
43 |
Revision 1.3 1997/10/13 08:50:06 ma
|
|
|
44 |
Made all pl_tests for general proc & exception handling pass.
|
|
|
45 |
|
|
|
46 |
Revision 1.2 1997/09/25 06:45:30 ma
|
|
|
47 |
All general_proc tests passed
|
|
|
48 |
|
|
|
49 |
Revision 1.1.1.1 1997/03/14 07:50:16 ma
|
|
|
50 |
Imported from DRA
|
|
|
51 |
|
|
|
52 |
* Revision 1.1.1.1 1996/09/20 10:56:57 john
|
|
|
53 |
*
|
|
|
54 |
* Revision 1.2 1996/07/05 14:25:35 john
|
|
|
55 |
* Changes for spec 3.1
|
|
|
56 |
*
|
|
|
57 |
* Revision 1.1.1.1 1996/03/26 15:45:16 john
|
|
|
58 |
*
|
|
|
59 |
* Revision 1.2 93/03/03 14:50:17 14:50:17 ra (Robert Andrews)
|
|
|
60 |
* Added support for jump_overflow routine.
|
|
|
61 |
*
|
|
|
62 |
* Revision 1.1 93/02/22 17:16:28 17:16:28 ra (Robert Andrews)
|
|
|
63 |
* Initial revision
|
|
|
64 |
*
|
|
|
65 |
--------------------------------------------------------------------------
|
|
|
66 |
*/
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
#ifndef OPS_SHARED_INCLUDED
|
|
|
70 |
#define OPS_SHARED_INCLUDED
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
/*
|
|
|
74 |
KEY TO OVERFLOW JUMPS
|
|
|
75 |
|
|
|
76 |
The argument to jump_overflow is one of the following.
|
|
|
77 |
*/
|
|
|
78 |
|
|
|
79 |
typedef enum {
|
|
|
80 |
UNCONDITIONAL,
|
|
|
81 |
ON_OVERFLOW,
|
|
|
82 |
ON_CARRY,
|
|
|
83 |
ON_FP_OVERFLOW,
|
|
|
84 |
ON_FP_CARRY,
|
|
|
85 |
ON_FP_OPERAND_ERROR
|
|
|
86 |
} overflow_type ;
|
|
|
87 |
|
|
|
88 |
#define ON_SHAPE( s ) ( is_signed ( s ) ? ON_OVERFLOW : ON_CARRY )
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
/*
|
|
|
92 |
PROTOTYPES
|
|
|
93 |
|
|
|
94 |
This file is a relic of the old operations.c which was split into
|
|
|
95 |
the four ops_*.c files. These routines were previously static but
|
|
|
96 |
now must be external.
|
|
|
97 |
*/
|
|
|
98 |
|
|
|
99 |
extern void branch PROTO_S ( ( long, exp, int, int, int ) ) ;
|
|
|
100 |
extern int branch_ins PROTO_S ( ( long, int, int, int ) ) ;
|
|
|
101 |
extern void jump_overflow PROTO_S ( ( int ) ) ;
|
|
|
102 |
extern void test_overflow PROTO_S ( ( overflow_type ) ) ;
|
|
|
103 |
extern void test_overflow2 PROTO_S ( ( int ) ) ;
|
|
|
104 |
extern void push PROTO_S ( ( shape, long, where ) ) ;
|
|
|
105 |
extern void push_float PROTO_S ( ( long, where ) ) ;
|
|
|
106 |
extern void pop PROTO_S ( ( shape, long, where ) ) ;
|
|
|
107 |
extern void pop_float PROTO_S ( ( long, where ) ) ;
|
|
|
108 |
extern void shift_aux PROTO_S ( ( shape, where, where, where, int, int ) ) ;
|
|
|
109 |
extern void checkalloc_stack PROTO_S ( (where, int) );
|
|
|
110 |
extern int set_overflow PROTO_S ( ( exp ) );
|
|
|
111 |
extern int have_overflow PROTO_S ( ( void ) );
|
|
|
112 |
extern void clear_overflow PROTO_S ( ( int ) );
|
|
|
113 |
extern void reset_round_mode PROTO_S ( ( void ) );
|
|
|
114 |
extern void cmp_zero PROTO_S ( ( shape, long, where ) ) ;
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
/*
|
|
|
118 |
CONDITION CODES
|
|
|
119 |
|
|
|
120 |
These condition codes are used to eliminate unnecessary comparison
|
|
|
121 |
instructions.
|
|
|
122 |
*/
|
|
|
123 |
|
|
|
124 |
extern where last_cond ;
|
|
|
125 |
extern where last_cond2 ;
|
|
|
126 |
extern where last_cond_alt ;
|
|
|
127 |
extern long last_cond_sz ;
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
/*
|
|
|
131 |
SET CONDITION CODES
|
|
|
132 |
|
|
|
133 |
This macro is used to set the condition codes for the where X of
|
|
|
134 |
size Y.
|
|
|
135 |
*/
|
|
|
136 |
|
|
|
137 |
#define set_cond( X, Y ) \
|
|
|
138 |
{ \
|
|
|
139 |
have_cond = 1 ; \
|
|
|
140 |
last_cond = ( X ) ; \
|
|
|
141 |
last_cond_sz = ( Y ) ; \
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
/*
|
|
|
146 |
SET ALTERNATIVE CONDITION CODES
|
|
|
147 |
|
|
|
148 |
This macro is used to set the alterative last condition to X.
|
|
|
149 |
*/
|
|
|
150 |
|
|
|
151 |
#define set_cond_alt( X ) \
|
|
|
152 |
{ \
|
|
|
153 |
have_cond = 3 ; \
|
|
|
154 |
last_cond_alt = ( X ) ; \
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
/*
|
|
|
159 |
OUTPUT A COMPARISON INSTRUCTION
|
|
|
160 |
|
|
|
161 |
Some assemblers (e.g. HP) reverse the order of the operands in
|
|
|
162 |
comparison instructions. This macro handles this fact.
|
|
|
163 |
*/
|
|
|
164 |
|
|
|
165 |
#ifndef asm_cmp_reversed
|
|
|
166 |
#define ins2_cmp( I, S1, S2, X1, X2, M ) ins2 ( I, S1, S2, X1, X2, M )
|
|
|
167 |
#else
|
|
|
168 |
#define ins2_cmp( I, S1, S2, X1, X2, M ) ins2 ( I, S2, S1, X2, X1, M )
|
|
|
169 |
#endif
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
#endif
|