Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / include / tlu_custom_trap_handlers.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: tlu_custom_trap_handlers.s
5* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
6* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
7*
8* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9*
10* This program is free software; you can redistribute it and/or modify
11* it under the terms of the GNU General Public License as published by
12* the Free Software Foundation; version 2 of the License.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License
20* along with this program; if not, write to the Free Software
21* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*
23* For the avoidance of doubt, and except that if any non-GPL license
24* choice is available it will apply instead, Sun elects to use only
25* the General Public License version 2 (GPLv2) at this time for any
26* software where a choice of GPL license versions is made
27* available with the language indicating that GPLv2 or any later version
28* may be used, or where a choice of which version of the GPL is applied is
29* otherwise unspecified.
30*
31* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
32* CA 95054 USA or visit www.sun.com if you need additional information or
33* have any questions.
34*
35*
36* ========== Copyright Header End ============================================
37*/
38#ifndef T_HANDLER_RAND4_1
39#define T_HANDLER_RAND4_1 b .+16;\
40 sdiv %r1, %r0, %l4;nop;nop
41#endif
42#ifndef T_HANDLER_RAND7_1
43#define T_HANDLER_RAND7_1 b .+28;\
44 pdist %f4, %f6, %f20; \
45 nop; nop ; nop; nop; illtrap
46#endif
47#ifndef T_HANDLER_RAND4_2
48#define T_HANDLER_RAND4_2 save %i7, %g0, %i7; \
49 save %i7, %g0, %i7; \
50 restore %i7, %g0, %i7;\
51 restore %i7, %g0, %i7;
52#endif
53#ifndef T_HANDLER_RAND7_2
54#define T_HANDLER_RAND7_2 b .+8 ;\
55 rdpr %pstate, %l2;\
56 b .+8 ;\
57 rdpr %tstate, %l3;\
58 b .+12 ;\
59 wrpr %l3, %r0, %tstate; nop
60#endif
61#ifndef T_HANDLER_RAND4_3
62#define T_HANDLER_RAND4_3 save %i7, %g0, %i7;\
63 restore %i7, %g0, %i7;\
64 save %i7, %g0, %i7; \
65 restore %i7, %g0, %i7;
66#endif
67#ifndef T_HANDLER_RAND7_3
68#define T_HANDLER_RAND7_3 b .+8 ;\
69 rdpr %tnpc, %l2;\
70 and %l2, 0xfc0, %l2;\
71 add %i7, %l2, %l2;\
72 stda %f16,[%i7]ASI_BLOCK_AS_IF_USER_PRIMARY ;\
73 b .+8 ;\
74 stda %f0,[%i7]ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE ;
75#endif
76#ifndef T_HANDLER_RAND4_4
77#define T_HANDLER_RAND4_4 b .+4 ; b .+4; b .+4; b .+4
78#endif
79#ifndef T_HANDLER_RAND7_4
80#define T_HANDLER_RAND7_4 b .+8;\
81 save %i7, %g0, %i7; \
82 b,a .+8;\
83 b .+12;\
84 stw %i7, [%i7];\
85 b .-8;;\
86 restore %i7, %g0, %i7;
87
88#endif
89#ifndef T_HANDLER_RAND4_5
90#define T_HANDLER_RAND4_5 ldda [%r31]ASI_NUCLEUS_QUAD_LDD, %f16;\
91 sdiv %l4, %l5, %l7;\
92 add %r31, 128, %l5;\
93 stda %l4, [%i7]ASI_BLOCK_PRIMARY_LITTLE;
94#endif
95#ifndef T_HANDLER_RAND7_5
96#define T_HANDLER_RAND7_5 save %i7, %g0, %i7;\
97 rdpr %tnpc, %l2;\
98 wrpr %l2, %tpc;\
99 add %l2, 4, %l2;\
100 wrpr %l2, %tnpc;\
101 restore %i7, %g0, %i7;\
102 retry;
103#endif
104#ifndef T_HANDLER_RAND4_6
105#define T_HANDLER_RAND4_6 ldda [%r31]ASI_BLOCK_AS_IF_USER_PRIMARY, %f32;\
106 rd %fprs, %l2; \
107 wr %l2, 0x4, %fprs ;\
108 stda %f0,[%r31]ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE;
109#endif
110#ifndef T_HANDLER_RAND7_6
111#define T_HANDLER_RAND7_6 umul %o4, 2, %o5;\
112 rdpr %tnpc, %l2;\
113 wrpr %l2, %tpc;\
114 add %l2, 4, %l2;\
115 wrpr %l2, %tnpc;\
116 stw %l2, [%i7];\
117 retry;
118#endif
119!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
120#ifndef HT_HANDLER_RAND4_1
121#define HT_HANDLER_RAND4_1 mov 0x80, %l3;\
122 b .+12;\
123 stxa %l3, [%l3]0x57 ;\
124 nop
125#endif
126#ifndef HT_HANDLER_RAND7_1
127#define HT_HANDLER_RAND7_1 b .+28;\
128 pdist %f4, %f4, %f20;\
129 nop; nop ; nop; nop; illtrap
130#endif
131#ifndef HT_HANDLER_RAND4_2
132#define HT_HANDLER_RAND4_2 rdpr %tstate, %l2;\
133 b .+12;\
134 wrpr %l2, 0x800, %tstate;\
135 nop;
136#endif
137#ifndef HT_HANDLER_RAND7_2
138#define HT_HANDLER_RAND7_2 b .+8 ;\
139 rdhpr %hpstate, %l2;\
140 b .+8 ;\
141 rdhpr %htstate, %l3;\
142 b .+12 ;\
143 wrhpr %l3, %r0, %htstate; nop
144#endif
145#ifndef HT_HANDLER_RAND4_3
146#define HT_HANDLER_RAND4_3 stxa %l4, [%r31]ASI_AS_IF_USER_PRIMARY;\
147 mov 0x80, %l3;\
148 stxa %l3, [%l3]0x5f ;\
149 b .+8 ;\
150 ldxa [%r31]ASI_AS_IF_USER_PRIMARY, %l4;
151#endif
152#ifndef HT_HANDLER_RAND7_3
153#define HT_HANDLER_RAND7_3 b .+8 ;\
154 rdpr %tnpc, %l2;\
155 and %l2, 0xfc0, %l2;\
156 add %i7, %l2, %l2;\
157 stda %f16,[%i7]ASI_BLOCK_AS_IF_USER_PRIMARY ;\
158 b .+8 ;\
159 stda %f0,[%i7]ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE ;
160#endif
161#ifndef HT_HANDLER_RAND4_4
162#define HT_HANDLER_RAND4_4 ldda [%i7]ASI_BLOCK_PRIMARY_LITTLE, %f0;\
163 b .+12 ;\
164 stxa %l3, [%g0]ASI_LSU_CONTROL; nop
165#endif
166#ifndef HT_HANDLER_RAND7_4
167#define HT_HANDLER_RAND7_4 rdpr %tnpc, %l3;\
168 and %l3, 0xff, %l3;\
169 sllx %l3, 26, %l3;\
170 ldxa [%g0]0x45, %l4;\
171 or %l3, %l4, %l3 ;\
172 stxa %l3, [%g0]0x45 ;\
173 nop;
174#endif
175#ifndef HT_HANDLER_RAND4_5
176#define HT_HANDLER_RAND4_5 ldda [%r31]ASI_NUCLEUS_QUAD_LDD, %f48;\
177 sdiv %l4, %l5, %l6;\
178 sdiv %l3, %l6, %l7;\
179 stda %f32, [%r31]ASI_BLOCK_PRIMARY_LITTLE;
180#endif
181#ifndef HT_HANDLER_RAND7_5
182#define HT_HANDLER_RAND7_5 save %i7, %g0, %i7;\
183 rdpr %tnpc, %l2;\
184 wrpr %l2, %tpc;\
185 add %l2, 4, %l2;\
186 wrpr %l2, %tnpc;\
187 restore %i7, %g0, %i7;\
188 retry;
189#endif
190#ifndef HT_HANDLER_RAND4_6
191#define HT_HANDLER_RAND4_6 ld [%r31], %l2;\
192 rd %fprs, %l2; \
193 wr %l2, 0x4, %fprs ;\
194 stda %f0,[%i7]ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE;
195#endif
196#ifndef HT_HANDLER_RAND7_6
197#define HT_HANDLER_RAND7_6 rdhpr %htstate, %o4;\
198 rdpr %tnpc, %l2;\
199 wrpr %l2, %tpc;\
200 add %l2, 4, %l2;\
201 wrpr %l2, %tnpc;\
202 wrhpr %o4, %r0, %htstate;\
203 retry;
204#endif
205
206!!!!!!!!!!!!!!!!!!!!!!!!!
207!! Disable trap checking
208#define NO_TRAPCHECK
209
210! Enable Traps
211#define ENABLE_T1_Privileged_Opcode_0x11
212#define ENABLE_T1_Fp_Disabled_0x20
213#define ENABLE_HT0_Watchdog_Reset_0x02
214
215#define FILL_TRAP_RETRY
216#define SPILL_TRAP_RETRY
217#define CLEAN_WIN_RETRY
218
219#define My_RED_Mode_Other_Reset
220#define My_RED_Mode_Other_Reset \
221 ba red_other_ext;\
222 nop;retry;nop;nop;nop;nop;nop
223
224#define H_HT0_Software_Initiated_Reset_0x04
225#define SUN_H_HT0_Software_Initiated_Reset_0x04 \
226 setx Software_Reset_Handler, %g1, %g2 ;\
227 jmp %g2 ;\
228 nop
229
230
231#define H_T1_Clean_Window_0x24
232#define SUN_H_T1_Clean_Window_0x24 \
233 rdpr %cleanwin, %l1;\
234 add %l1,1,%l1;\
235 wrpr %l1, %g0, %cleanwin;\
236 retry; nop; nop; nop; nop
237
238#define H_T1_Clean_Window_0x25
239#define SUN_H_T1_Clean_Window_0x25 \
240 rdpr %cleanwin, %l1;\
241 add %l1,1,%l1;\
242 wrpr %l1, %g0, %cleanwin;\
243 retry; nop; nop; nop; nop
244
245#define H_T1_Clean_Window_0x26
246#define SUN_H_T1_Clean_Window_0x26 \
247 rdpr %cleanwin, %l1;\
248 add %l1,1,%l1;\
249 wrpr %l1, %g0, %cleanwin;\
250 retry; nop; nop; nop; nop
251
252#define H_T1_Clean_Window_0x27
253#define SUN_H_T1_Clean_Window_0x27 \
254 rdpr %cleanwin, %l1;\
255 add %l1,1,%l1;\
256 wrpr %l1, %g0, %cleanwin;\
257 retry; nop; nop; nop; nop
258
259
260#define H_HT0_Tag_Overflow
261#define My_HT0_Tag_Overflow \
262 HT_HANDLER_RAND7_1 ;\
263 done
264
265#define H_T0_Tag_Overflow
266#define My_T0_Tag_Overflow \
267 T_HANDLER_RAND7_2 ;\
268 done
269
270#define H_T1_Tag_Overflow_0x23
271#define SUN_H_T1_Tag_Overflow_0x23 \
272 T_HANDLER_RAND7_3 ;\
273 done
274
275#define H_T0_Window_Spill_0_Normal_Trap
276#define SUN_H_T0_Window_Spill_0_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
277
278#define H_T0_Window_Spill_1_Normal_Trap
279#define SUN_H_T0_Window_Spill_1_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
280
281#define H_T0_Window_Spill_2_Normal_Trap
282#define SUN_H_T0_Window_Spill_2_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
283
284#define H_T0_Window_Spill_3_Normal_Trap
285#define SUN_H_T0_Window_Spill_3_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
286
287#define H_T0_Window_Spill_4_Normal_Trap
288#define SUN_H_T0_Window_Spill_4_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
289
290#define H_T0_Window_Spill_5_Normal_Trap
291#define SUN_H_T0_Window_Spill_5_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
292
293#define H_T0_Window_Spill_6_Normal_Trap
294#define SUN_H_T0_Window_Spill_6_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
295
296#define H_T0_Window_Spill_7_Normal_Trap
297#define SUN_H_T0_Window_Spill_7_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
298
299#define H_T0_Window_Spill_0_Other_Trap
300#define SUN_H_T0_Window_Spill_0_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
301
302#define H_T0_Window_Spill_1_Other_Trap
303#define SUN_H_T0_Window_Spill_1_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
304
305#define H_T0_Window_Spill_2_Other_Trap
306#define SUN_H_T0_Window_Spill_2_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
307
308#define H_T0_Window_Spill_3_Other_Trap
309#define SUN_H_T0_Window_Spill_3_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
310
311#define H_T0_Window_Spill_4_Other_Trap
312#define SUN_H_T0_Window_Spill_4_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
313
314#define H_T0_Window_Spill_5_Other_Trap
315#define SUN_H_T0_Window_Spill_5_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
316
317#define H_T0_Window_Spill_6_Other_Trap
318#define SUN_H_T0_Window_Spill_6_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
319
320#define H_T0_Window_Spill_7_Other_Trap
321#define SUN_H_T0_Window_Spill_7_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
322
323#define H_T0_Window_Fill_0_Normal_Trap
324#define SUN_H_T0_Window_Fill_0_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
325
326#define H_T0_Window_Fill_1_Normal_Trap
327#define SUN_H_T0_Window_Fill_1_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
328
329#define H_T0_Window_Fill_2_Normal_Trap
330#define SUN_H_T0_Window_Fill_2_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
331
332#define H_T0_Window_Fill_3_Normal_Trap
333#define SUN_H_T0_Window_Fill_3_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
334
335#define H_T0_Window_Fill_4_Normal_Trap
336#define SUN_H_T0_Window_Fill_4_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
337
338#define H_T0_Window_Fill_5_Normal_Trap
339#define SUN_H_T0_Window_Fill_5_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
340
341#define H_T0_Window_Fill_6_Normal_Trap
342#define SUN_H_T0_Window_Fill_6_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
343
344#define H_T0_Window_Fill_7_Normal_Trap
345#define SUN_H_T0_Window_Fill_7_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
346
347#define H_T0_Window_Fill_0_Other_Trap
348#define SUN_H_T0_Window_Fill_0_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
349
350#define H_T0_Window_Fill_1_Other_Trap
351#define SUN_H_T0_Window_Fill_1_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
352
353#define H_T0_Window_Fill_2_Other_Trap
354#define SUN_H_T0_Window_Fill_2_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
355
356#define H_T0_Window_Fill_3_Other_Trap
357#define SUN_H_T0_Window_Fill_3_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
358
359#define H_T0_Window_Fill_4_Other_Trap
360#define SUN_H_T0_Window_Fill_4_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
361
362#define H_T0_Window_Fill_5_Other_Trap
363#define SUN_H_T0_Window_Fill_5_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
364
365#define H_T0_Window_Fill_6_Other_Trap
366#define SUN_H_T0_Window_Fill_6_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
367
368#define H_T0_Window_Fill_7_Other_Trap
369#define SUN_H_T0_Window_Fill_7_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
370
371
372#define H_T1_Window_Spill_0_Normal_Trap
373#define SUN_H_T1_Window_Spill_0_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
374
375#define H_T1_Window_Spill_1_Normal_Trap
376#define SUN_H_T1_Window_Spill_1_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
377
378#define H_T1_Window_Spill_2_Normal_Trap
379#define SUN_H_T1_Window_Spill_2_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
380
381#define H_T1_Window_Spill_3_Normal_Trap
382#define SUN_H_T1_Window_Spill_3_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
383
384#define H_T1_Window_Spill_4_Normal_Trap
385#define SUN_H_T1_Window_Spill_4_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
386
387#define H_T1_Window_Spill_5_Normal_Trap
388#define SUN_H_T1_Window_Spill_5_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
389
390#define H_T1_Window_Spill_6_Normal_Trap
391#define SUN_H_T1_Window_Spill_6_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
392
393#define H_T1_Window_Spill_7_Normal_Trap
394#define SUN_H_T1_Window_Spill_7_Normal_Trap saved; retry; nop;nop;nop;nop;nop;nop;
395
396#define H_T1_Window_Spill_0_Other_Trap
397#define SUN_H_T1_Window_Spill_0_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
398
399#define H_T1_Window_Spill_1_Other_Trap
400#define SUN_H_T1_Window_Spill_1_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
401
402#define H_T1_Window_Spill_2_Other_Trap
403#define SUN_H_T1_Window_Spill_2_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
404
405#define H_T1_Window_Spill_3_Other_Trap
406#define SUN_H_T1_Window_Spill_3_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
407
408#define H_T1_Window_Spill_4_Other_Trap
409#define SUN_H_T1_Window_Spill_4_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
410
411#define H_T1_Window_Spill_5_Other_Trap
412#define SUN_H_T1_Window_Spill_5_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
413
414#define H_T1_Window_Spill_6_Other_Trap
415#define SUN_H_T1_Window_Spill_6_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
416
417#define H_T1_Window_Spill_7_Other_Trap
418#define SUN_H_T1_Window_Spill_7_Other_Trap saved; retry; nop;nop;nop;nop;nop;nop;
419
420#define H_T1_Window_Fill_0_Normal_Trap
421#define SUN_H_T1_Window_Fill_0_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
422
423#define H_T1_Window_Fill_1_Normal_Trap
424#define SUN_H_T1_Window_Fill_1_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
425
426#define H_T1_Window_Fill_2_Normal_Trap
427#define SUN_H_T1_Window_Fill_2_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
428
429#define H_T1_Window_Fill_3_Normal_Trap
430#define SUN_H_T1_Window_Fill_3_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
431
432#define H_T1_Window_Fill_4_Normal_Trap
433#define SUN_H_T1_Window_Fill_4_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
434
435#define H_T1_Window_Fill_5_Normal_Trap
436#define SUN_H_T1_Window_Fill_5_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
437
438#define H_T1_Window_Fill_6_Normal_Trap
439#define SUN_H_T1_Window_Fill_6_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
440
441#define H_T1_Window_Fill_7_Normal_Trap
442#define SUN_H_T1_Window_Fill_7_Normal_Trap restored; retry; nop;nop;nop;nop;nop;nop;
443
444#define H_T1_Window_Fill_0_Other_Trap
445#define SUN_H_T1_Window_Fill_0_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
446
447#define H_T1_Window_Fill_1_Other_Trap
448#define SUN_H_T1_Window_Fill_1_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
449
450#define H_T1_Window_Fill_2_Other_Trap
451#define SUN_H_T1_Window_Fill_2_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
452
453#define H_T1_Window_Fill_3_Other_Trap
454#define SUN_H_T1_Window_Fill_3_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
455
456#define H_T1_Window_Fill_4_Other_Trap
457#define SUN_H_T1_Window_Fill_4_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
458
459#define H_T1_Window_Fill_5_Other_Trap
460#define SUN_H_T1_Window_Fill_5_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
461
462#define H_T1_Window_Fill_6_Other_Trap
463#define SUN_H_T1_Window_Fill_6_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
464
465#define H_T1_Window_Fill_7_Other_Trap
466#define SUN_H_T1_Window_Fill_7_Other_Trap restored; retry; nop;nop;nop;nop;nop;nop;
467
468#define H_T0_Trap_Instruction_0
469#define My_T0_Trap_Instruction_0 \
470 T_HANDLER_RAND7_5 ;\
471 done;
472
473#define H_T0_Trap_Instruction_1
474#define My_T0_Trap_Instruction_1 \
475 T_HANDLER_RAND7_6 ;\
476 done;
477
478#define H_T0_Trap_Instruction_2
479#define My_T0_Trap_Instruction_2 \
480 inc %o3;\
481 umul %o3, 2, %o4;\
482 ba 1f; \
483 save %i7, %g0, %i7; \
484 2: done; \
485 nop; \
486 1: ba 2b; \
487 restore %i7, %g0, %i7
488#define H_T0_Trap_Instruction_3
489#define My_T0_Trap_Instruction_3 \
490 save %i7, %g0, %i7 ;\
491 T_HANDLER_RAND4_5;\
492 stw %o4, [%i7];\
493 restore %i7, %g0, %i7 ;\
494 done
495#define H_T0_Trap_Instruction_4
496#define My_T0_Trap_Instruction_4 \
497 T_HANDLER_RAND7_6 ;\
498 done;
499
500#define H_T0_Trap_Instruction_5
501#define My_T0_Trap_Instruction_5 \
502 T_HANDLER_RAND4_5;\
503 done;
504
505#define H_T1_Trap_Instruction_0
506#define My_T1_Trap_Instruction_0 \
507 inc %o4;\
508 umul %o4, 2, %o5;\
509 ba 3f; \
510 save %i7, %g0, %i7; \
511 4: done; \
512 nop; \
513 3: ba 4b; \
514 restore %i7, %g0, %i7
515#define H_T1_Trap_Instruction_1
516#define My_T1_Trap_Instruction_1 \
517 T_HANDLER_RAND7_3;\
518 done
519#define H_T1_Trap_Instruction_2
520#define My_T1_Trap_Instruction_2 \
521 inc %o3;\
522 umul %o3, 2, %o4;\
523 ba 5f; \
524 save %i7, %g0, %i7; \
525 6: done; \
526 nop; \
527 5: ba 6b; \
528 restore %i7, %g0, %i7
529#define H_T1_Trap_Instruction_3
530#define My_T1_Trap_Instruction_3 \
531 T_HANDLER_RAND4_1;\
532 done;
533
534#define H_T1_Trap_Instruction_4
535#define My_T1_Trap_Instruction_4 \
536 T_HANDLER_RAND7_1;\
537 done;
538#define H_T1_Trap_Instruction_5
539#define My_T1_Trap_Instruction_5 \
540 T_HANDLER_RAND7_2;\
541 done
542#define H_HT0_Trap_Instruction_0
543#define My_HT0_Trap_Instruction_0 \
544 HT_HANDLER_RAND4_1 ;\
545 done;
546#define H_HT0_Trap_Instruction_1
547#define My_HT0_Trap_Instruction_1 \
548 HT_HANDLER_RAND4_3 ;\
549 done
550#define H_HT0_Trap_Instruction_2
551#define My_HT0_Trap_Instruction_2 \
552 HT_HANDLER_RAND7_5 ;\
553 done;
554#define H_HT0_Trap_Instruction_3
555#define My_HT0_Trap_Instruction_3 \
556 HT_HANDLER_RAND4_5 ;\
557 done
558#define H_HT0_Trap_Instruction_4
559#define My_HT0_Trap_Instruction_4 \
560 HT_HANDLER_RAND7_4 ;\
561 done
562#define H_HT0_Trap_Instruction_5
563#define My_HT0_Trap_Instruction_5 \
564 ba htrap_5_ext;\
565 nop; retry;\
566 nop; nop; nop; nop; nop
567
568#define H_HT0_Mem_Address_Not_Aligned_0x34
569#define My_HT0_Mem_Address_Not_Aligned_0x34 \
570 HT_HANDLER_RAND4_2 ;\
571 done ;
572#define H_HT0_Illegal_instruction_0x10
573#define My_HT0_Illegal_instruction_0x10 \
574 done;
575
576#define H_HT0_DAE_so_page_0x30
577#define My_HT0_DAE_so_page_0x30 \
578 done;
579#define H_HT0_DAE_invalid_asi_0x14
580#define SUN_H_HT0_DAE_invalid_asi_0x14 \
581 done
582#define H_HT0_DAE_privilege_violation_0x15
583#define SUN_H_HT0_DAE_privilege_violation_0x15 \
584 done;
585#define H_HT0_Privileged_Action_0x37
586#define My_HT0_Privileged_Action_0x37 \
587 done; \
588 nop; nop
589#define H_HT0_Lddf_Mem_Address_Not_Aligned_0x35
590#define My_HT0_Lddf_Mem_Address_Not_Aligned_0x35 \
591 HT_HANDLER_RAND4_3 ;\
592 done
593#define H_HT0_Stdf_Mem_Address_Not_Aligned_0x36
594#define My_HT0_Stdf_Mem_Address_Not_Aligned_0x36 \
595 HT_HANDLER_RAND7_1;\
596 done
597#define H_HT0_Fp_exception_ieee_754_0x21
598#define My_HT0_Fp_exception_ieee_754_0x21 \
599 HT_HANDLER_RAND4_2 ;\
600 done
601#define H_HT0_Fp_exception_other_0x22
602#define My_HT0_Fp_exception_other_0x22 \
603 HT_HANDLER_RAND7_2 ;\
604 done
605#define H_HT0_Division_By_Zero
606#define My_HT0_Division_By_Zero \
607 HT_HANDLER_RAND4_6;\
608 done
609#define H_T0_Division_By_Zero
610#define My_T0_Division_By_Zero \
611 T_HANDLER_RAND4_3;\
612 done
613#define H_T1_Division_By_Zero_0x28
614#define My_H_T1_Division_By_Zero_0x28 \
615 T_HANDLER_RAND4_3;\
616 done
617#define H_T0_Division_By_Zero
618#define My_T0_Division_By_Zero\
619 T_HANDLER_RAND4_4 ;\
620 done
621#define H_T0_Fp_exception_ieee_754_0x21
622#define My_T0_Fp_exception_ieee_754_0x21 \
623 T_HANDLER_RAND4_3 ;\
624 done
625#define H_T1_Fp_Exception_Ieee_754_0x21
626#define My_H_T1_Fp_Exception_Ieee_754_0x21 \
627 T_HANDLER_RAND4_4 ;\
628 done
629#define H_T1_Fp_Exception_Other_0x22
630#define My_H_T1_Fp_Exception_Other_0x22 \
631 T_HANDLER_RAND4_5 ;\
632 done
633#define H_T1_Privileged_Opcode_0x11
634#define SUN_H_T1_Privileged_Opcode_0x11 \
635 T_HANDLER_RAND4_6 ;\
636 done
637
638#define H_HT0_Privileged_opcode_0x11
639#define My_HT0_Privileged_opcode_0x11 \
640 HT_HANDLER_RAND4_1;\
641 done;
642
643#define H_HT0_Fp_disabled_0x20
644#define My_HT0_Fp_disabled_0x20 \
645 mov 0x4, %l2 ;\
646 wr %l2, 0x0, %fprs ;\
647 sllx %l2, 10, %l3; \
648 rdpr %tstate, %l2;\
649 or %l2, %l3, %l2 ;\
650 stw %l2, [%i7];\
651 wrpr %l2, 0x0, %tstate;\
652 retry;
653
654#define H_T0_Fp_disabled_0x20
655#define My_T0_Fp_disabled_0x20 \
656 mov 0x4, %l2 ;\
657 wr %l2, 0x0, %fprs ;\
658 sllx %l2, 10, %l3; \
659 rdpr %tstate, %l2;\
660 or %l2, %l3, %l2 ;\
661 wrpr %l2, 0x0, %tstate;\
662 retry; nop
663
664#define H_T1_Fp_Disabled_0x20
665#define My_H_T1_Fp_Disabled_0x20 \
666 mov 0x4, %l2 ;\
667 wr %l2, 0x0, %fprs ;\
668 sllx %l2, 10, %l3; \
669 rdpr %tstate, %l2;\
670 or %l2, %l3, %l2 ;\
671 wrpr %l2, 0x0, %tstate;\
672 stw %l2, [%i7];\
673 retry
674
675#define H_HT0_Watchdog_Reset_0x02
676#define My_HT0_Watchdog_Reset_0x02 \
677 ba wdog_2_ext;\
678 nop;retry;nop;nop;nop;nop;nop
679
680#define H_T0_Privileged_opcode_0x11
681#define My_T0_Privileged_opcode_0x11 \
682 T_HANDLER_RAND4_4;\
683 done
684
685#define H_T1_Fp_exception_other_0x22
686#define My_T1_Fp_exception_other_0x22 \
687 T_HANDLER_RAND7_3 ;\
688 done;
689
690#define H_T0_Fp_exception_other_0x22
691#define My_T0_Fp_exception_other_0x22 \
692 T_HANDLER_RAND7_4;\
693 done
694
695#define H_HT0_Trap_Level_Zero_0x5f
696#define My_HT0_Trap_Level_Zero_0x5f \
697 not %g0, %r13; \
698 rdhpr %hpstate, %l3;\
699 jmp %r13;\
700 rdhpr %htstate, %l3;\
701 and %l3, 0xfe, %l3;\
702 wrhpr %l3, 0, %htstate;\
703 stw %r13, [%i7];\
704 retry
705
706#define My_Watchdog_Reset
707#define My_Watchdog_Reset \
708 ba wdog_red_ext;\
709 nop;retry;nop;nop;nop;nop;nop
710
711#define H_HT0_Control_Transfer_Instr_0x74
712#define My_H_HT0_Control_Transfer_Instr_0x74 \
713 rdpr %tstate, %l3;\
714 mov 1, %l4;\
715 sllx %l4, 20, %l4;\
716 wrpr %l3, %l4, %tstate ;\
717 retry;nop;
718
719#define H_T0_Control_Transfer_Instr_0x74
720#define My_H_T0_Control_Transfer_Instr_0x74 \
721 rdpr %tstate, %l3;\
722 mov 1, %l4;\
723 sllx %l4, 20, %l4;\
724 wrpr %l3, %l4, %tstate ;\
725 retry;nop;
726
727#define H_T1_Control_Transfer_Instr_0x74
728#define My_H_T1_Control_Transfer_Instr_0x74 \
729 rdpr %tstate, %l3;\
730 mov 1, %l4;\
731 sllx %l4, 20, %l4;\
732 wrpr %l3, %l4, %tstate ;\
733 retry;nop;
734
735
736#define H_HT0_data_access_protection_0x6c
737#define SUN_H_HT0_data_access_protection_0x6c ba daccess_prot_handler; nop
738
739#define H_HT0_PA_Watchpoint_0x61
740#define My_H_HT0_PA_Watchpoint_0x61 \
741 HT_HANDLER_RAND7_4;\
742 done
743
744#ifndef H_HT0_Data_access_error_0x32
745#define H_HT0_Data_access_error_0x32
746#define SUN_H_HT0_Data_access_error_0x32 \
747 done;nop
748#endif
749
750
751#define H_T0_VA_Watchpoint_0x62
752#define My_T0_VA_Watchpoint_0x62 \
753 T_HANDLER_RAND7_5;\
754 done
755
756#define H_T1_VA_Watchpoint_0x62
757#define SUN_H_T1_VA_Watchpoint_0x62 \
758 T_HANDLER_RAND7_3;\
759 done
760
761#define H_HT0_VA_Watchpoint_0x62
762#define My_H_HT0_VA_Watchpoint_0x62 \
763 HT_HANDLER_RAND7_5;\
764 done
765
766#define H_HT0_Instruction_VA_Watchpoint_0x75
767#define SUN_H_HT0_Instruction_VA_Watchpoint_0x75 \
768 done;
769
770#define H_HT0_Instruction_Breakpoint_0x76
771#define SUN_H_HT0_Instruction_Breakpoint_0x76 \
772 rdhpr %htstate, %g1;\
773 wrhpr %g1, 0x400, %htstate;\
774 retry;nop
775
776
777#define H_HT0_Instruction_address_range_0x0d
778#define SUN_H_HT0_Instruction_address_range_0x0d \
779 HT_HANDLER_RAND4_1;\
780 done;
781
782#define H_HT0_Instruction_real_range_0x0e
783#define SUN_H_HT0_Instruction_real_range_0x0e \
784 HT_HANDLER_RAND4_1;\
785 done;
786
787#define H_HT0_mem_real_range_0x2d
788#define SUN_H_HT0_mem_real_range_0x2d \
789 HT_HANDLER_RAND4_2;\
790 done;
791
792
793#define H_HT0_mem_address_range_0x2e
794#define SUN_H_HT0_mem_address_range_0x2e \
795 HT_HANDLER_RAND4_3;\
796 done;
797
798#define H_HT0_DAE_nc_page_0x16
799#define SUN_H_HT0_DAE_nc_page_0x16 \
800 done;
801
802#define H_HT0_DAE_nfo_page_0x17
803#define SUN_H_HT0_DAE_nfo_page_0x17 \
804 done;
805
806
807#define H_HT0_IAE_unauth_access_0x0b
808#define SUN_H_HT0_IAE_unauth_access_0x0b \
809 HT_HANDLER_RAND7_3;\
810 done;
811
812
813#define H_HT0_IAE_nfo_page_0x0c
814#define SUN_H_HT0_IAE_nfo_page_0x0c \
815 HT_HANDLER_RAND7_6;\
816 done;
817
818
819#define H_HT0_Reserved_0x3b
820#define SUN_H_HT0_Reserved_0x3b \
821 mov 0x80, %l3;\
822 stxa %l3, [%l3]0x5f ;\
823 stxa %l3, [%l3]0x57 ;\
824 done;
825
826
827
828
829#define H_HT0_IAE_privilege_violation_0x08
830#define My_HT0_IAE_privilege_violation_0x08 \
831 HT_HANDLER_RAND7_2;\
832 done;
833
834#ifndef H_HT0_Instruction_Access_MMU_Error_0x71
835#define H_HT0_Instruction_Access_MMU_Error_0x71
836#define SUN_H_HT0_Instruction_Access_MMU_Error_0x71 \
837 mov 0x80, %l3;\
838 stxa %l3, [%l3]0x5f ;\
839 stxa %l3, [%l3]0x57 ;\
840 retry;
841#endif
842
843#ifndef H_HT0_Data_Access_MMU_Error_0x72
844#define H_HT0_Data_Access_MMU_Error_0x72
845#define SUN_H_HT0_Data_Access_MMU_Error_0x72 \
846 mov 0x80, %l3;\
847 stxa %l3, [%l3]0x5f ;\
848 stxa %l3, [%l3]0x57 ;\
849 retry;
850#endif
851
852!!!!!!!!!!!!!!!!!!!!!! END of all handlers !!!!!!!!!!!!!!!!!!!
853
854