Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: exu_irf_global_n2.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 NUM_PATTERNS 35 | |
39 | #define NUM_GLOBAL_LVLS 4 | |
40 | #define NUM_GLOBAL_TRANS 9 | |
41 | ||
42 | #define MAIN_PAGE_HV_ALSO | |
43 | #define MAIN_PAGE_NUCLEUS_ALSO | |
44 | #include "hboot.s" | |
45 | ||
46 | .global main | |
47 | main: | |
48 | th_fork(th_main,%l0) ! start up to four threads. | |
49 | ! No need to run more than one core. | |
50 | ! All threads do the same thing, except for this one bit of setup... | |
51 | th_main_0: | |
52 | th_main_1: | |
53 | th_main_2: | |
54 | th_main_3: | |
55 | ||
56 | ! the code has already been through the boot code, so we know the registers | |
57 | ! are not too badly broken | |
58 | ||
59 | !********************************************************** | |
60 | ! Trap level 0, all global levels, data integrity | |
61 | !********************************************************** | |
62 | add %g0,NUM_GLOBAL_LVLS,%l5 | |
63 | sub %g0,1,%l3 ! negative one for xor mask | |
64 | setx lz,%l0,%l4 | |
65 | globals_tl0_loop: | |
66 | ! for %gl=0 to 3, check %g0 thru %g7 | |
67 | setx pattern_start,%l0,%l1 | |
68 | add %g0,NUM_PATTERNS,%l2 | |
69 | ||
70 | ! just for completeness... | |
71 | ldx [%l1],%g0 | |
72 | brnz %g0,bad_end | |
73 | xor %l3,%g0,%g0 | |
74 | brnz %g0,bad_end | |
75 | nop | |
76 | ||
77 | loop_gltl0: | |
78 | ldx [%l1],%g1 | |
79 | xor %g0,0x1fff,%g1 ! ^data | |
80 | stx %g1,[%l4+0x0] ! store 1s complement for each reg g1-g7 | |
81 | ||
82 | mova %icc,%g1,%g2 | |
83 | stx %g2,[%l4+0x8] | |
84 | xor %g2,0x1fff,%g2 ! data | |
85 | ||
86 | mova %icc,%g2,%g3 | |
87 | xor %g3,0x1fff,%g3 ! ^data | |
88 | stx %g3,[%l4+0x10] | |
89 | ||
90 | mova %icc,%g3,%g4 | |
91 | stx %g4,[%l4+0x18] | |
92 | xor %g4,0x1fff,%g4 ! data | |
93 | ||
94 | mova %icc,%g4,%g5 | |
95 | xor %g5,0x1fff,%g5 ! ^data | |
96 | stx %g1,[%l4+0x20] | |
97 | ||
98 | mova %icc,%g5,%g6 | |
99 | stx %g6,[%l4+0x28] | |
100 | xor %g6,0x1fff,%g6 ! data | |
101 | ||
102 | mova %icc,%g6,%g7 | |
103 | xor %g7,0x1fff,%g7 ! ^data | |
104 | stx %g7,[%l4+0x30] | |
105 | ||
106 | sub %l2,1,%l2 | |
107 | brgz %l2,loop_gltl0 ! next data pattern | |
108 | add %l1,8,%l1 | |
109 | ||
110 | sub %l5,1,%l5 | |
111 | brz %l5,done_gltl0 | |
112 | nop | |
113 | ta T_CHANGE_HPRIV | |
114 | rdpr %gl,%l0 | |
115 | add %l0,1,%l0 | |
116 | wrpr %l0,0,%gl ! %gl++ | |
117 | subcc %l0,3,%g0 | |
118 | tneg T_CHANGE_PRIV ! stay in hpriv if %gl=3, else goto priv mode | |
119 | brgz %l5,globals_tl0_loop | |
120 | nop | |
121 | ||
122 | done_gltl0: | |
123 | ! ta T_CHANGE_HPRIV was already done last time through inner loop | |
124 | wrpr %g0,0,%gl ! go back to GL=0 | |
125 | ta T_CHANGE_NONPRIV | |
126 | ||
127 | !********************************************************** | |
128 | ! Trap level 0, check remaining global state transistions | |
129 | !********************************************************** | |
130 | setx next_global,%l0,%l1 | |
131 | add %g0,NUM_GLOBAL_TRANS,%l2 | |
132 | setx unique_values,%l0,%l4 | |
133 | ta T_CHANGE_HPRIV | |
134 | loop_transitions: | |
135 | ldub [%l1],%l3 | |
136 | wrpr %l3,0,%gl | |
137 | add %g1,%g2,%g3 ! use the globals at this level | |
138 | add %g4,%g5,%g6 | |
139 | add %g0,%g7,%g1 | |
140 | ldx [%l4+0x00],%g1 ! load unique values to each global level | |
141 | ldx [%l4+0x08],%g2 | |
142 | ldx [%l4+0x10],%g3 | |
143 | ldx [%l4+0x18],%g4 | |
144 | ldx [%l4+0x20],%g5 | |
145 | ldx [%l4+0x28],%g6 | |
146 | ldx [%l4+0x30],%g7 | |
147 | add %l4,0x38,%l4 | |
148 | sub %l2,1,%l2 | |
149 | brgz %l2,loop_transitions | |
150 | add %l1,1,%l1 | |
151 | ||
152 | !********************************************************** | |
153 | ! All globals have unique values left by last test, one more | |
154 | ! time just to read them and make sure they are still good. | |
155 | !********************************************************** | |
156 | add %g0,NUM_GLOBAL_LVLS,%l5 | |
157 | add %g0,0,%l3 | |
158 | setx lz,%l0,%l4 | |
159 | ta T_CHANGE_HPRIV | |
160 | loop_use_globals: | |
161 | wrpr %l3,0,%gl | |
162 | stx %g1,[%l4+0x00] ! someday we could make this self-checking | |
163 | stx %g2,[%l4+0x08] ! but for now, just force SAS to look at regs | |
164 | stx %g3,[%l4+0x10] | |
165 | stx %g4,[%l4+0x18] | |
166 | stx %g5,[%l4+0x20] | |
167 | stx %g6,[%l4+0x28] | |
168 | stx %g7,[%l4+0x30] | |
169 | add %l4,0x38,%l4 | |
170 | ||
171 | sub %l5,1,%l5 | |
172 | brgz %l5,loop_use_globals | |
173 | add %l3,1,%l3 | |
174 | ||
175 | wrpr %g0,0,%gl ! go back to GL=0 | |
176 | ta T_CHANGE_NONPRIV | |
177 | ||
178 | good_end: | |
179 | ta T_GOOD_TRAP | |
180 | nop | |
181 | nop | |
182 | ||
183 | bad_end: | |
184 | ta T_BAD_TRAP | |
185 | nop | |
186 | nop | |
187 | ||
188 | !========================== | |
189 | .data | |
190 | .align 0x1fff+1 | |
191 | ||
192 | pattern_start: | |
193 | .word 0xaaaaaaaa, 0xaaaaaaaa | |
194 | .word 0x00000000, 0x00000000 | |
195 | .word 0xffffffff, 0x00000001 | |
196 | .word 0x7fffffff, 0x00000002 | |
197 | .word 0xfffffffe, 0x00000004 | |
198 | .word 0xbfffffff, 0x00000008 | |
199 | .word 0xfffffffd, 0x00000010 | |
200 | .word 0xdfffffff, 0x00000020 | |
201 | .word 0xfffffffb, 0x00000040 | |
202 | .word 0xefffffff, 0x00000080 | |
203 | .word 0xfffffff7, 0x00000100 | |
204 | .word 0xf7ffffff, 0x00000200 | |
205 | .word 0xffffffef, 0x00000400 | |
206 | .word 0xfbffffff, 0x00000800 | |
207 | .word 0xffffffdf, 0x00001000 | |
208 | .word 0xfdffffff, 0x00002000 | |
209 | .word 0xffffffbf, 0x00004000 | |
210 | .word 0xfeffffff, 0x00008000 | |
211 | .word 0xffffff7f, 0x00010000 | |
212 | .word 0xff7fffff, 0x00020000 | |
213 | .word 0xfffffeff, 0x00040000 | |
214 | .word 0xffbfffff, 0x00080000 | |
215 | .word 0xfffffdff, 0x00100000 | |
216 | .word 0xffdfffff, 0x00200000 | |
217 | .word 0xfffffbff, 0x00400000 | |
218 | .word 0xffefffff, 0x00800000 | |
219 | .word 0xfffff7ff, 0x01000000 | |
220 | .word 0xfff7ffff, 0x02000000 | |
221 | .word 0xffffefff, 0x04000000 | |
222 | .word 0xfffbffff, 0x08000000 | |
223 | .word 0xffffdfff, 0x10000000 | |
224 | .word 0xfffdffff, 0x20000000 | |
225 | .word 0xffffbfff, 0x40000000 | |
226 | .word 0xfffeffff, 0x80000000 | |
227 | .word 0xffff7fff, 0x00000000 | |
228 | ||
229 | next_global: | |
230 | .byte 0x00, 0x02, 0x01, 0x03 | |
231 | .byte 0x02, 0x00, 0x03, 0x01 | |
232 | .byte 0x00 | |
233 | ||
234 | .align 8 | |
235 | unique_values: | |
236 | .word 0x01010101, 0x01010101 | |
237 | .word 0x02020202, 0x02020202 | |
238 | .word 0x03030303, 0x03030303 | |
239 | .word 0x04040404, 0x04040404 | |
240 | .word 0x05050505, 0x05050505 | |
241 | .word 0x06060606, 0x06060606 | |
242 | .word 0x07070707, 0x07070707 | |
243 | .word 0x11111111, 0x11111111 | |
244 | .word 0x12121212, 0x12121212 | |
245 | .word 0x13131313, 0x13131313 | |
246 | .word 0x14141414, 0x14141414 | |
247 | .word 0x15151515, 0x15151515 | |
248 | .word 0x16161616, 0x16161616 | |
249 | .word 0x17171717, 0x17171717 | |
250 | .word 0x21212121, 0x21212121 | |
251 | .word 0x22222222, 0x22222222 | |
252 | .word 0x23232323, 0x23232323 | |
253 | .word 0x24242424, 0x24242424 | |
254 | .word 0x25252525, 0x25252525 | |
255 | .word 0x26262626, 0x26262626 | |
256 | .word 0x27272727, 0x27272727 | |
257 | .word 0x31313131, 0x31313131 | |
258 | .word 0x32323232, 0x32323232 | |
259 | .word 0x33333333, 0x33333333 | |
260 | .word 0x34343434, 0x34343434 | |
261 | .word 0x35353535, 0x35353535 | |
262 | .word 0x36363636, 0x36363636 | |
263 | .word 0x37373737, 0x37373737 | |
264 | .word 0x41414141, 0x41414141 | |
265 | .word 0x42424242, 0x42424242 | |
266 | .word 0x43434343, 0x43434343 | |
267 | .word 0x44444444, 0x44444444 | |
268 | .word 0x45454545, 0x45454545 | |
269 | .word 0x46464646, 0x46464646 | |
270 | .word 0x47474747, 0x47474747 | |
271 | .word 0x51515151, 0x51515151 | |
272 | .word 0x52525252, 0x52525252 | |
273 | .word 0x53535353, 0x53535353 | |
274 | .word 0x54545454, 0x54545454 | |
275 | .word 0x55555555, 0x55555555 | |
276 | .word 0x56565656, 0x56565656 | |
277 | .word 0x57575757, 0x57575757 | |
278 | .word 0x61616161, 0x61616161 | |
279 | .word 0x62626262, 0x62626262 | |
280 | .word 0x63636363, 0x63636363 | |
281 | .word 0x64646464, 0x64646464 | |
282 | .word 0x65656565, 0x65656565 | |
283 | .word 0x66666666, 0x66666666 | |
284 | .word 0x67676767, 0x67676767 | |
285 | .word 0x71717171, 0x71717171 | |
286 | .word 0x72727272, 0x72727272 | |
287 | .word 0x73737373, 0x73737373 | |
288 | .word 0x74747474, 0x74747474 | |
289 | .word 0x75757575, 0x75757575 | |
290 | .word 0x76767676, 0x76767676 | |
291 | .word 0x77777777, 0x77777777 | |
292 | .word 0x81818181, 0x81818181 | |
293 | .word 0x82828282, 0x82828282 | |
294 | .word 0x83838383, 0x83838383 | |
295 | .word 0x84848484, 0x84848484 | |
296 | .word 0x85858585, 0x85858585 | |
297 | .word 0x86868686, 0x86868686 | |
298 | .word 0x87878787, 0x87878787 | |
299 | .word 0x91919191, 0x91919191 | |
300 | .word 0x92929292, 0x92929292 | |
301 | .word 0x93939393, 0x93939393 | |
302 | .word 0x94949494, 0x94949494 | |
303 | .word 0x95959595, 0x95959595 | |
304 | .word 0x96969696, 0x96969696 | |
305 | .word 0x97979797, 0x97979797 | |
306 | ||
307 | lz: .space 256,0 ! storage area | |
308 | ||
309 | ||
310 | ||
311 | .text | |
312 | ||
313 | .global trap_spill | |
314 | trap_spill: | |
315 | ||
316 | .end |