fpregs.c
10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
/*
* fpu/fpregs.c
*
*
*
* Copyright 1991, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
#ident "$Revision: 1.1.1.1 $"
/*
*
* Floating Point Exerciser - write/read fpu registers
*
*/
#include <ultra64.h>
#include <os_internal.h>
#include <osint.h>
#include <fpu.h>
#include "cpu.h"
extern u32 GetFP0(void); extern u32 GetFP1(void);
extern u32 GetFP2(void); extern u32 GetFP3(void);
extern u32 GetFP4(void); extern u32 GetFP5(void);
extern u32 GetFP6(void); extern u32 GetFP7(void);
extern u32 GetFP8(void); extern u32 GetFP9(void);
extern u32 GetFP10(void); extern u32 GetFP11(void);
extern u32 GetFP12(void); extern u32 GetFP13(void);
extern u32 GetFP14(void); extern u32 GetFP15(void);
extern u32 GetFP16(void); extern u32 GetFP17(void);
extern u32 GetFP18(void); extern u32 GetFP19(void);
extern u32 GetFP20(void); extern u32 GetFP21(void);
extern u32 GetFP22(void); extern u32 GetFP23(void);
extern u32 GetFP24(void); extern u32 GetFP25(void);
extern u32 GetFP26(void); extern u32 GetFP27(void);
extern u32 GetFP28(void); extern u32 GetFP29(void);
extern u32 GetFP30(void); extern u32 GetFP31(void);
extern void SetFP0(u32); extern void SetFP1(u32);
extern void SetFP2(u32); extern void SetFP3(u32);
extern void SetFP4(u32); extern void SetFP5(u32);
extern void SetFP6(u32); extern void SetFP7(u32);
extern void SetFP8(u32); extern void SetFP9(u32);
extern void SetFP10(u32); extern void SetFP11(u32);
extern void SetFP12(u32); extern void SetFP13(u32);
extern void SetFP14(u32); extern void SetFP15(u32);
extern void SetFP16(u32); extern void SetFP17(u32);
extern void SetFP18(u32); extern void SetFP19(u32);
extern void SetFP20(u32); extern void SetFP21(u32);
extern void SetFP22(u32); extern void SetFP23(u32);
extern void SetFP24(u32); extern void SetFP25(u32);
extern void SetFP26(u32); extern void SetFP27(u32);
extern void SetFP28(u32); extern void SetFP29(u32);
extern void SetFP30(u32); extern void SetFP31(u32);
int
fpregs()
{
register int fail = 0;
register long status;
/* enable cache and fpu - cache ecc errors enabled */
status = __osGetSR();
status |= SR_CU0|SR_CU1;
__osSetSR(status);
/* clear cause register */
__osSetCause(0);
/* clear fpu status register */
__osSetFpcCsr(0);
/* write and read fpu registers */
SetFP0(0);
SetFP1(1);
SetFP2(2);
SetFP3(3);
SetFP4(4);
SetFP5(5);
SetFP6(6);
SetFP7(7);
SetFP8(8);
SetFP9(9);
SetFP10(10);
SetFP11(11);
SetFP12(12);
SetFP13(13);
SetFP14(14);
SetFP15(15);
SetFP16(16);
SetFP17(17);
SetFP18(18);
SetFP19(19);
SetFP20(20);
SetFP21(21);
SetFP22(22);
SetFP23(23);
SetFP24(24);
SetFP25(25);
SetFP26(26);
SetFP27(27);
SetFP28(28);
SetFP29(29);
SetFP30(30);
SetFP31(31);
if (GetFP0() != 0){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP1() != 1){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP2() != 2){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP3() != 3){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP4() != 4){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP5() != 5){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP6() != 6){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP7() != 7){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP8() != 8){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP9() != 9){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP10() != 10){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP11() != 11){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP12() != 12){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP13() != 13){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP14() != 14){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP15() != 15){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP16() != 16){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP17() != 17){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP18() != 18){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP19() != 19){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP20() != 20){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP21() != 21){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP22() != 22){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP23() != 23){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP24() != 24){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP25() != 25){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP26() != 26){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP27() != 27){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP28() != 28){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP29() != 29){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP30() != 30){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP31() != 31){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
SetFP0(~0);
SetFP1(~1);
SetFP2(~2);
SetFP3(~3);
SetFP4(~4);
SetFP5(~5);
SetFP6(~6);
SetFP7(~7);
SetFP8(~8);
SetFP9(~9);
SetFP10(~10);
SetFP11(~11);
SetFP12(~12);
SetFP13(~13);
SetFP14(~14);
SetFP15(~15);
SetFP16(~16);
SetFP17(~17);
SetFP18(~18);
SetFP19(~19);
SetFP20(~20);
SetFP21(~21);
SetFP22(~22);
SetFP23(~23);
SetFP24(~24);
SetFP25(~25);
SetFP26(~26);
SetFP27(~27);
SetFP28(~28);
SetFP29(~29);
SetFP30(~30);
SetFP31(~31);
if (GetFP0() != ~0){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP1() != ~1){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP2() != ~2){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP3() != ~3){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP4() != ~4){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP5() != ~5){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP6() != ~6){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP7() != ~7){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP8() != ~8){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP9() != ~9){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP10() != ~10){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP11() != ~11){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP12() != ~12){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP13() != ~13){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP14() != ~14){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP15() != ~15){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP16() != ~16){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP17() != ~17){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP18() != ~18){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP19() != ~19){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP20() != ~20){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP21() != ~21){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP22() != ~22){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP23() != ~23){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP24() != ~24){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP25() != ~25){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP26() != ~26){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP27() != ~27){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP28() != ~28){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP29() != ~29){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP30() != ~30){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
if (GetFP31() != ~31){
PRINTF("%s:%d: FAILED!\n", __FILE__, __LINE__);
fail = 1;
}
/* report any error */
return(fail);
}