Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – /branches/tendra5-amd64/src/installers/sparc/common/guard.c – Rev 5

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | 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/guard.c,v 1.1.1.1 1998/01/17 15:55:54 release Exp $
39
--------------------------------------------------------------------------
40
$Log: guard.c,v $
41
 * Revision 1.1.1.1  1998/01/17  15:55:54  release
42
 * First version to be checked into rolling release.
43
 *
44
 * Revision 1.4  1997/08/23  13:53:45  pwe
45
 * initial ANDF-DE
46
 *
47
 * Revision 1.3  1996/03/20  16:14:00  john
48
 * Reformatting
49
 *
50
 * Revision 1.2  1995/05/26  12:58:30  john
51
 * Reformatting
52
 *
53
 * Revision 1.1.1.1  1995/03/13  10:18:37  john
54
 * Entered into CVS
55
 *
56
 * Revision 1.4  1994/07/07  16:11:33  djch
57
 * Jul94 tape
58
 *
59
 * Revision 1.3  1994/05/19  08:58:10  djch
60
 * added empty {} to pacify tcc
61
 *
62
 * Revision 1.2  1994/05/13  12:29:31  djch
63
 * Incorporates improvements from expt version
64
 *
65
 * Revision 1.1  1994/05/03  14:49:37  djch
66
 * Initial revision
67
 *
68
 * Revision 1.2  93/08/13  14:37:04  14:37:04  ra (Robert Andrews)
69
 * Reformatted.
70
 * 
71
 * Revision 1.1  93/06/24  14:58:26  14:58:26  ra (Robert Andrews)
72
 * Initial revision
73
 * 
74
--------------------------------------------------------------------------
75
*/
76
 
77
 
78
#define SPARCTRANS_CODE
79
 
80
/*
81
    These routine involve protecting registers from future use.  The
82
    type space consists of two bitmasks, one representing the fixed
83
    registers and one the floating registers.  A bit is set to indicate
84
    that the corresponding register is in use.  These guard routines
85
    just set the right bit to indicate that the given register is in
86
    use.
87
*/
88
 
89
#include "config.h"
90
#include "common_types.h"
91
#include "regmacs.h"
92
#include "procrec.h"
93
#include "addrtypes.h"
94
#include "tempdecs.h"
95
#include "comment.h"
96
#include "guard.h"
97
 
98
 
99
/*
100
    GUARD THE FIXED REGISTER r IN sp
101
*/
102
 
103
space guardreg 
104
    PROTO_N ( ( r, sp ) )
105
    PROTO_T ( int r X space sp )
106
{
107
    if ( IS_TREG ( r ) ) sp.fixed |= RMASK ( r ) ;
108
    return ( sp ) ;
109
}
110
 
111
 
112
/*
113
    GUARD THE FLOATING REGISTER r IN sp
114
*/
115
 
116
space guardfreg 
117
    PROTO_N ( ( r, sp ) )
118
    PROTO_T ( int r X space sp )
119
{
120
    if ( IS_FLT_TREG ( r ) ) sp.flt |= RMASK ( r ) ;
121
    return ( sp ) ;
122
}
123
 
124
 
125
/*
126
  GUARD THE FIXED REGISTER r IN sp
127
  This routine is like guardreg, but fails if r has already 
128
  been used.
129
*/
130
 
131
space needreg 
132
    PROTO_N ( ( r, sp ) )
133
    PROTO_T ( int r X space sp )
134
{
135
#if 0
136
    if ( !( tempdecopt && IS_TREG ( r ) ) &&
137
	  ( sp.fixed & RMASK ( r ) ) != 0 ) {
138
	fail ( "needreg : fixed register already in use" ) ;
139
    }
140
#endif
141
    return ( guardreg ( r, sp ) ) ;
142
}
143
 
144
 
145
/*
146
    GUARD THE FLOATING REGISTER r IN sp
147
 
148
    This routine is like guardfreg, but fails if r has already been used.
149
*/
150
 
151
space needfreg 
152
    PROTO_N ( ( r, sp ) )
153
    PROTO_T ( int r X space sp )
154
{
155
#if 0
156
    if ( !( tempdecopt && IS_FLT_TREG ( r ) ) &&
157
	  ( sp.flt & RMASK ( r ) ) != 0 ) {
158
	fail ( "needfreg : float register already in use" ) ;
159
    }
160
#endif
161
    return ( guardfreg ( r, sp ) ) ;
162
}
163
 
164
 
165
/*
166
    GUARD ANY REGISTERS FROM w IN sp
167
*/
168
 
169
space guard 
170
    PROTO_N ( ( w, sp ) )
171
    PROTO_T ( where w X space sp ){
172
  switch ( discrim ( w.answhere ) ) {
173
    case inreg : {
174
      /* guard fixed registers */
175
      int r = regalt ( w.answhere ) ;
176
      if ( IS_TREG ( r ) ) sp.fixed |= RMASK ( r ) ;
177
      return ( sp ) ;
178
    }
179
    case infreg : {
180
      /* guard floating registers */
181
      int r = fregalt ( w.answhere ).fr ;
182
      if ( IS_FLT_TREG ( r ) ) sp.flt |= RMASK ( r ) ;
183
      return ( sp ) ;
184
    }
185
    /*	case bitad :*/
186
    case notinreg : {
187
      /* guard base register */
188
      int r = insalt ( w.answhere ).b.base ;
189
      if ( IS_TREG ( r ) ) sp.fixed |= RMASK ( r ) ;
190
      return ( sp ) ;
191
    }
192
    default: {
193
      /* fall through to fail */
194
    }	
195
  }
196
  fail ( "Bad guard register" ) ;
197
  return ( sp ) ;
198
}	
199
 
200
 
201