Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: tlu_halt_modint.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 | #define H_HT0_Modular_Arithmetic_Interrupt_0x3d | |
39 | #define My_H_HT0_Modular_Arithmetic_Interrupt_0x3d \ | |
40 | mov 0x80, %g1 ;\ | |
41 | stxa %g0 ,[%g1]0x40 ;\ | |
42 | retry | |
43 | ||
44 | ||
45 | #define MAIN_PAGE_HV_ALSO | |
46 | ||
47 | #include "hboot.s" | |
48 | ||
49 | /************************************************************************ | |
50 | Test case code start | |
51 | ************************************************************************/ | |
52 | ||
53 | .text | |
54 | .global main | |
55 | ||
56 | main: /* test begin */ | |
57 | ||
58 | ||
59 | ta T_CHANGE_HPRIV | |
60 | ||
61 | ! If MT, then park all threads based on park_mask | |
62 | ! Unpark the next thread when finished with this one.. | |
63 | ! %l1 contains is_mt, %l2 contains address of is_mt | |
64 | ! %l3 contains park_mask, %l4 contains address of park_mask | |
65 | ! % l5 is mutex address | |
66 | ||
67 | setup_for_mt: ! {{{ | |
68 | setx is_mt, %g1, %l2 | |
69 | add %l2, 8, %l4 | |
70 | add %l4, 8, %l5 | |
71 | ldx [%l5], %g1 | |
72 | ldstub [%l5], %g1 | |
73 | get_mutex: | |
74 | ldx [%l5], %g2 | |
75 | brnz,a %g1, get_mutex | |
76 | ldstub [%l5], %g1 | |
77 | ||
78 | check_is_mt_set: | |
79 | ldx [%l2], %l1 | |
80 | brnz %l1, continue | |
81 | mov 0x58, %g3 | |
82 | is_mt_not_set: | |
83 | ldxa [%g3]0x41, %l1 | |
84 | popc %l1, %l1 | |
85 | dec %l1 | |
86 | brz %l1, continue | |
87 | nop | |
88 | is_mt_and_first: | |
89 | mov 0x50, %g3 | |
90 | stxa %g0, [%g3] 0x41 ! Park all threads | |
91 | mov 50, %g1 | |
92 | wait: | |
93 | brnz,a %g1, wait | |
94 | dec %g1 | |
95 | ||
96 | stx %l1, [%l2] ! Set the MT flag | |
97 | mov 1, %g1 | |
98 | stx %g0, [%l5] ! release mutex | |
99 | stxa %g1, [%g3] 0x41 ! Start with T0 | |
100 | ||
101 | continue: | |
102 | stx %g0, [%l5] ! release mutex | |
103 | ||
104 | ! }}} | |
105 | ||
106 | test1: | |
107 | wrpr %g0, 0x0, %pstate ! disable IE | |
108 | ||
109 | ||
110 | !# Write bit 9 of MACTL (causes interrupt upon completion) | |
111 | !# 21:0 == 00 0010 0000 0000 0011 1111 | |
112 | !# 20:18 TID == 0..7 | |
113 | !# 17 cause interrupt | |
114 | !# 12:08 modular addition (1001) | |
115 | !# 12:08 load MA mem (0000) | |
116 | !# 07:00 length = 63 | |
117 | ||
118 | wr %g0, 0x40, %asi | |
119 | setx 0x2003f, %g1, %g3 | |
120 | ldxa [%g0]0x63, %g1 ! get my TID for interrupt steering .. | |
121 | sllx %g1, 18, %g1 | |
122 | or %g3, %g1, %g3 | |
123 | #ifdef INJECT_ERR | |
124 | ! $EV trig_pc_d(1, @VA(.MAIN.test1)) -> errCpxPkt(*,2,1, *, 180, 1) | |
125 | mov 1, %g1 | |
126 | sllx %g1, 17, %g1 | |
127 | xor %g3, %g1, %g3 | |
128 | #endif | |
129 | stxa %g3, [%g0 + 0x80] %asi | |
130 | ||
131 | ||
132 | mov 100, %g1 | |
133 | wait_for_int: | |
134 | brnz,a %g1, wait_for_int | |
135 | dec %g1 | |
136 | ||
137 | halt1: | |
138 | wrhpr %g0, 0x0, %halt | |
139 | ||
140 | test2: | |
141 | ldxa [%g0]0x4c, %g0 ! clear DESR | |
142 | wrpr %g0, 2, %pstate ! Enable IE | |
143 | ||
144 | setx 0x2003f, %g1, %g3 | |
145 | ldxa [%g0]0x63, %g1 ! get my TID for interrupt steering .. | |
146 | sllx %g1, 18, %g1 | |
147 | or %g3, %g1, %g3 | |
148 | #ifdef INJECT_ERR | |
149 | ! $EV trig_pc_d(1, @VA(.MAIN.test1)) -> errCpxPkt(*,2,1, *, 180, 1) | |
150 | mov 1, %g1 | |
151 | sllx %g1, 17, %g1 | |
152 | xor %g3, %g1, %g3 | |
153 | #endif | |
154 | stxa %g3, [%g0 + 0x80] %asi | |
155 | ||
156 | halt2: | |
157 | wrhpr %g0, 0x0, %halt | |
158 | ldxa [%g0]0x4c, %g0 ! clear DESR | |
159 | nop | |
160 | nop | |
161 | nop | |
162 | ||
163 | ! Finish if not MT | |
164 | brz %l1, done_thread | |
165 | nop | |
166 | ||
167 | ! If MT, shift mask, unpark next thread and finish | |
168 | ldx [%l4], %l3 | |
169 | sllx %l3, 1, %l3 | |
170 | mov 0x60, %g1 | |
171 | stxa %l3, [%g1]0x41 | |
172 | stx %l3, [%l4] | |
173 | nop | |
174 | ||
175 | ||
176 | /******************************************************* | |
177 | * Exit code | |
178 | *******************************************************/ | |
179 | ||
180 | done_thread: | |
181 | nop | |
182 | ta T_GOOD_TRAP | |
183 | nop | |
184 | ||
185 | /************************************************************************ | |
186 | Test case data start | |
187 | ************************************************************************/ | |
188 | .data | |
189 | is_mt : | |
190 | .xword 0x0 | |
191 | park_mask: | |
192 | .xword 0x1 | |
193 | mutex: | |
194 | .xword 0 | |
195 | .end |