Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    Copyright (c) 1993 Open Software Foundation, Inc.
32
    Copyright (c) 1993 Open Software Foundation, Inc.
3
 
33
 
4
 
34
 
5
    All Rights Reserved
35
    All Rights Reserved
Line 14... Line 44...
14
 
44
 
15
    OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING
45
    OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING
16
    ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
46
    ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
17
    PARTICULAR PURPOSE.
47
    PARTICULAR PURPOSE.
18
 
48
 
19
 
49
 
20
    IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
50
    IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
21
    CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
51
    CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
22
    LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
52
    LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
23
    NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
53
    NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
24
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
54
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25
*/
55
*/
26
 
56
 
27
/*
57
/*
28
    		 Crown Copyright (c) 1997
58
    		 Crown Copyright (c) 1997
29
    
59
 
30
    This TenDRA(r) Computer Program is subject to Copyright
60
    This TenDRA(r) Computer Program is subject to Copyright
31
    owned by the United Kingdom Secretary of State for Defence
61
    owned by the United Kingdom Secretary of State for Defence
32
    acting through the Defence Evaluation and Research Agency
62
    acting through the Defence Evaluation and Research Agency
33
    (DERA).  It is made available to Recipients with a
63
    (DERA).  It is made available to Recipients with a
34
    royalty-free licence for its use, reproduction, transfer
64
    royalty-free licence for its use, reproduction, transfer
35
    to other parties and amendment for any purpose not excluding
65
    to other parties and amendment for any purpose not excluding
36
    product development provided that any such use et cetera
66
    product development provided that any such use et cetera
37
    shall be deemed to be acceptance of the following conditions:-
67
    shall be deemed to be acceptance of the following conditions:-
38
    
68
 
39
        (1) Its Recipients shall ensure that this Notice is
69
        (1) Its Recipients shall ensure that this Notice is
40
        reproduced upon any copies or amended versions of it;
70
        reproduced upon any copies or amended versions of it;
41
    
71
 
42
        (2) Any amended version of it shall be clearly marked to
72
        (2) Any amended version of it shall be clearly marked to
43
        show both the nature of and the organisation responsible
73
        show both the nature of and the organisation responsible
44
        for the relevant amendment or amendments;
74
        for the relevant amendment or amendments;
45
    
75
 
46
        (3) Its onward transfer from a recipient to another
76
        (3) Its onward transfer from a recipient to another
47
        party shall be deemed to be that party's acceptance of
77
        party shall be deemed to be that party's acceptance of
48
        these conditions;
78
        these conditions;
49
    
79
 
50
        (4) DERA gives no warranty or assurance as to its
80
        (4) DERA gives no warranty or assurance as to its
51
        quality or suitability for any purpose and DERA accepts
81
        quality or suitability for any purpose and DERA accepts
52
        no liability whatsoever in relation to any use to which
82
        no liability whatsoever in relation to any use to which
53
        it may be put.
83
        it may be put.
54
*/
84
*/
Line 91... Line 121...
91
static char * spr_rtcl = "SPR_RTCL";
121
static char * spr_rtcl = "SPR_RTCL";
92
static char * spr_dec = "SPR_DEC";
122
static char * spr_dec = "SPR_DEC";
93
static char * spr_lr = "SPR_LR";
123
static char * spr_lr = "SPR_LR";
94
static char * spr_ctr = "SPR_CTR";
124
static char * spr_ctr = "SPR_CTR";
95
 
125
 
96
static char * number_array[32]={
126
static char * number_array[32] ={
97
    "0","1","2","3","4","5","6","7","8","9","10","11","12","13","14",
127
    "0","1","2","3","4","5","6","7","8","9","10","11","12","13","14",
98
    "15","16","17","18","19","20","21","22","23","24","25","26","27",
128
    "15","16","17","18","19","20","21","22","23","24","25","26","27",
99
    "28","29","30","31"
129
    "28","29","30","31"
100
};
130
};
101
 
131
 
Line 113... Line 143...
113
};
143
};
114
 
144
 
115
static char * cr_array[8] = {
145
static char * cr_array[8] = {
116
    "cr0","cr1","cr2","cr3","cr4","cr5","cr6","cr7"
146
    "cr0","cr1","cr2","cr3","cr4","cr5","cr6","cr7"
117
};
147
};
118
 
148
 
119
static void init_spr_macros PROTO_S ((void));
149
static void init_spr_macros(void);
120
 
150
 
121
int do_macros = 0;
151
int do_macros = 0;
122
void init_macros  PROTO_Z ()
152
void init_macros(void)
123
{
153
{
124
  int r;
154
  int r;
125
  int number_per_line =0;
155
  int number_per_line =0;
126
  fprintf(as_file,"#\tRegister macros for easier reading and debugging\n");
156
  fprintf(as_file,"#\tRegister macros for easier reading and debugging\n");
127
  
157
 
128
#define NUMBER_OF_MACROS_PER_LINE 5
158
#define NUMBER_OF_MACROS_PER_LINE 5
129
  for (r = 0;r<=31;r++)
159
  for (r = 0;r<=31;r++)
130
  {
160
  {
131
    fprintf(as_file,".set %s,%d",reg_array[r],r);
161
    fprintf(as_file,".set %s,%d",reg_array[r],r);
132
    number_per_line ++;
162
    number_per_line ++;
133
    if(number_per_line ==NUMBER_OF_MACROS_PER_LINE)
163
    if (number_per_line ==NUMBER_OF_MACROS_PER_LINE)
134
    {
164
    {
135
      fprintf(as_file,"\n");
165
      fprintf(as_file,"\n");
136
      number_per_line = 0;
166
      number_per_line = 0;
137
    }
167
    }
138
    else
168
    else
139
    {
169
    {
140
      fprintf(as_file,";");
170
      fprintf(as_file,";");
141
    }
171
    }
142
  }
172
  }
143
  fprintf(as_file,"\n");
173
  fprintf(as_file,"\n");
144
  
174
 
145
  number_per_line=0;
175
  number_per_line=0;
146
  
176
 
147
  for(r = 0;r<=31;r++)
177
  for (r = 0;r<=31;r++)
148
  {
178
  {
149
    fprintf(as_file,".set %s,%d",freg_array[r],r);
179
    fprintf(as_file,".set %s,%d",freg_array[r],r);
150
    number_per_line ++;
180
    number_per_line ++;
151
    if(number_per_line ==NUMBER_OF_MACROS_PER_LINE)
181
    if (number_per_line ==NUMBER_OF_MACROS_PER_LINE)
152
    {
182
    {
153
      fprintf(as_file,"\n");
183
      fprintf(as_file,"\n");
154
      number_per_line = 0;
184
      number_per_line = 0;
155
    }
185
    }
156
    else
186
    else
157
    {
187
    {
158
      fprintf(as_file,";");
188
      fprintf(as_file,";");
159
    }
189
    }
160
  }
190
  }
161
  fprintf(as_file,"\n");
191
  fprintf(as_file,"\n");
162
  number_per_line=0;
192
  number_per_line=0;
163
  
193
 
164
  for(r = 0;r<=7;r++)
194
  for (r = 0;r<=7;r++)
165
  {
195
  {
166
    fprintf(as_file,".set %s,%d",cr_array[r],r);
196
    fprintf(as_file,".set %s,%d",cr_array[r],r);
167
    number_per_line ++;
197
    number_per_line ++;
168
    if(number_per_line ==NUMBER_OF_MACROS_PER_LINE)
198
    if (number_per_line ==NUMBER_OF_MACROS_PER_LINE)
169
    {
199
    {
170
      fprintf(as_file,"\n");
200
      fprintf(as_file,"\n");
171
      number_per_line = 0;
201
      number_per_line = 0;
172
    }
202
    }
173
    else
203
    else
174
    {
204
    {
175
      fprintf(as_file,";");
205
      fprintf(as_file,";");
176
    }
206
    }
177
  }
207
  }
178
  fprintf(as_file,"\n");
208
  fprintf(as_file,"\n");
179
  init_spr_macros();
209
  init_spr_macros();
180
#ifdef SHOW_FRAME_POINTER
210
#ifdef SHOW_FRAME_POINTER
181
  fprintf(as_file,".set %s,31\n",frame_pointer);
211
  fprintf(as_file,".set %s,31\n",frame_pointer);
182
  fprintf(as_file,".set %s,30\n",top_pointer);
212
  fprintf(as_file,".set %s,30\n",top_pointer);
183
#endif
213
#endif
184
  return;
214
  return;
185
}
215
}
186
 
216
 
187
char * reg_macro PROTO_N ((reg)) PROTO_T (int reg)
217
char * reg_macro(int reg)
188
{
218
{
189
  if (!do_macros)
219
  if (!do_macros)
190
    return number_array[reg];
220
    return number_array[reg];
191
  else
221
  else
192
  {
222
  {
193
#ifdef SHOW_FRAME_POINTER
223
#ifdef SHOW_FRAME_POINTER
194
    if (reg == 31 && p_has_fp)
224
    if (reg == 31 && p_has_fp)
195
      return frame_pointer;
225
      return frame_pointer;
Line 198... Line 228...
198
#endif
228
#endif
199
    return reg_array[reg];
229
    return reg_array[reg];
200
  }
230
  }
201
}
231
}
202
 
232
 
203
char * freg_macro PROTO_N ((reg)) PROTO_T (int reg)
233
char * freg_macro(int reg)
204
{    
234
{
205
  if (!do_macros)
235
  if (!do_macros)
206
    return number_array[reg];
236
    return number_array[reg];
207
  else
237
  else
208
    return freg_array[reg];
238
    return freg_array[reg];
209
}
239
}
210
char * cr_macro PROTO_N ((creg)) PROTO_T (int creg)
240
char * cr_macro(int creg)
211
{ 
241
{
212
  if (!do_macros)
242
  if (!do_macros)
213
    return number_array[creg];
243
    return number_array[creg];
214
  else
244
  else
215
    return cr_array[creg];
245
    return cr_array[creg];
216
}
246
}
217
char * spr_macro PROTO_N ((spr)) PROTO_T (int spr)
247
char * spr_macro(int spr)
218
{
248
{
219
  if (!do_macros)
249
  if (!do_macros)
220
    return number_array[spr];
250
    return number_array[spr];
221
  else
251
  else
222
  {
252
  {
Line 234... Line 264...
234
    }
264
    }
235
  }
265
  }
236
  return 0;
266
  return 0;
237
}
267
}
238
 
268
 
239
static void init_spr_macros PROTO_Z ()
269
static void init_spr_macros(void)
240
{
270
{
241
  fprintf(as_file,".set %s,%d;",spr_mq,SPR_MQ);
271
  fprintf(as_file,".set %s,%d;",spr_mq,SPR_MQ);
242
  fprintf(as_file,".set %s,%d;",spr_xer,SPR_XER);
272
  fprintf(as_file,".set %s,%d;",spr_xer,SPR_XER);
243
  fprintf(as_file,".set %s,%d;",spr_rtcu,SPR_RTCU);
273
  fprintf(as_file,".set %s,%d;",spr_rtcu,SPR_RTCU);
244
  fprintf(as_file,".set %s,%d\n",spr_rtcl,SPR_RTCL);
274
  fprintf(as_file,".set %s,%d\n",spr_rtcl,SPR_RTCL);
Line 246... Line 276...
246
  fprintf(as_file,".set %s,%d;",spr_lr,SPR_LR);
276
  fprintf(as_file,".set %s,%d;",spr_lr,SPR_LR);
247
  fprintf(as_file,".set %s,%d\n",spr_ctr,SPR_CTR);
277
  fprintf(as_file,".set %s,%d\n",spr_ctr,SPR_CTR);
248
  return;
278
  return;
249
}
279
}
250
 
280
 
251
  
281