Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: memop_mt_fpu_ld_st.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 MAIN_PAGE_NUCLEUS_ALSO | |
39 | #define MAIN_PAGE_HV_ALSO | |
40 | ||
41 | #include "hboot.s" | |
42 | #include "asi_s.h" | |
43 | #include "nmacros.h" | |
44 | ||
45 | ||
46 | ||
47 | /************************************************************************ | |
48 | Test case code start | |
49 | ************************************************************************/ | |
50 | ||
51 | .text | |
52 | .global main | |
53 | ||
54 | main: | |
55 | ta T_CHANGE_HPRIV | |
56 | ||
57 | ! Initialize the global registers. | |
58 | mov %g0, %g1 | |
59 | mov %g0, %g2 | |
60 | mov %g0, %g3 | |
61 | mov %g0, %g4 | |
62 | mov %g0, %g5 | |
63 | mov %g0, %g6 | |
64 | mov %g0, %g7 | |
65 | ||
66 | ! Set up seperate result data area for each core. | |
67 | ta T_RD_THID | |
68 | mov %o1, %l6 | |
69 | umul %l6, 64, %l7 | |
70 | setx result_area, %g1, %g3 | |
71 | add %l7, %g3, %l7 | |
72 | ||
73 | ! All threads use the same code. | |
74 | ||
75 | ! Load Store single | |
76 | single: | |
77 | setx single_data, %g1, %g2 | |
78 | ld [%g2], %f0 | |
79 | fadds %f0, %f0, %f1 | |
80 | st %f1, [%l7] | |
81 | mov %l7, %o0 | |
82 | call flush_l2_line | |
83 | nop | |
84 | ld [%l7], %g7 | |
85 | setx 0x40000000, %g1, %g6 | |
86 | cmp %g6, %g7 | |
87 | bne test_failed | |
88 | nop | |
89 | ||
90 | ! Load Store double | |
91 | double: | |
92 | setx double_data, %g1, %g2 | |
93 | ldd [%g2], %f2 | |
94 | faddd %f2, %f2, %f4 | |
95 | std %f4, [%l7+0x8] | |
96 | mov %l7, %o0 | |
97 | add %o0, 8, %o0 | |
98 | call flush_l2_line | |
99 | nop | |
100 | ldx [%l7+0x8], %g7 | |
101 | setx 0x4010000000000000, %g1, %g6 | |
102 | cmp %g7, %g6 | |
103 | bne test_failed | |
104 | nop | |
105 | ||
106 | ! Load Store FSR | |
107 | ||
108 | fsr: | |
109 | setx zero_data, %g1, %g2 | |
110 | ld [%g2], %fsr | |
111 | st %fsr, [%l7+0x10] | |
112 | add %l7, 0x10, %o0 | |
113 | call flush_l2_line | |
114 | nop | |
115 | ld [%l7+0x10], %g7 | |
116 | cmp %g7, 0 | |
117 | bne test_failed | |
118 | nop | |
119 | ||
120 | ! Load Store xFSR | |
121 | xfsr: | |
122 | ldx [%g2], %fsr | |
123 | stx %fsr, [%l7+0x18] | |
124 | add %l7, 0x18, %o0 | |
125 | call flush_l2_line | |
126 | nop | |
127 | ldx [%l7+0x18], %g7 | |
128 | cmp %g7, 0 | |
129 | bne test_failed | |
130 | nop | |
131 | ||
132 | ! Block Load Store | |
133 | block: | |
134 | setx block_data, %g1, %g2 | |
135 | ldda [%g2]ASI_BLOCK_PRIMARY, %f0 | |
136 | membar #Sync | |
137 | add %l7, 0x40, %l7 | |
138 | stda %f0, [%l7]ASI_BLOCK_PRIMARY | |
139 | membar #Sync | |
140 | ||
141 | ldx [%l7], %i0 | |
142 | ldx [%g2], %o0 | |
143 | cmp %i0, %o0 | |
144 | bne test_failed | |
145 | nop | |
146 | ldx [%l7+0x8], %i1 | |
147 | ldx [%g2+0x8], %o1 | |
148 | cmp %i1, %o1 | |
149 | bne test_failed | |
150 | nop | |
151 | ldx [%l7+0x10], %i2 | |
152 | ldx [%g2+0x10], %o2 | |
153 | cmp %i2, %o2 | |
154 | bne test_failed | |
155 | nop | |
156 | ldx [%l7+0x18], %i3 | |
157 | ldx [%g2+0x18], %o3 | |
158 | cmp %i3, %o3 | |
159 | bne test_failed | |
160 | nop | |
161 | ldx [%l7+0x20], %i4 | |
162 | ldx [%g2+0x20], %o4 | |
163 | cmp %i4, %o4 | |
164 | bne test_failed | |
165 | nop | |
166 | ldx [%l7+0x28], %i5 | |
167 | ldx [%g2+0x28], %o5 | |
168 | cmp %i5, %o5 | |
169 | bne test_failed | |
170 | nop | |
171 | ldx [%l7+0x30], %i6 | |
172 | ldx [%g2+0x30], %o6 | |
173 | cmp %i6, %o6 | |
174 | bne test_failed | |
175 | nop | |
176 | ldx [%l7+0x38], %i7 | |
177 | ldx [%g2+0x38], %o7 | |
178 | cmp %i7, %o7 | |
179 | bne test_failed | |
180 | nop | |
181 | ||
182 | ! Block Store commit | |
183 | commit: | |
184 | add %g2, 0x40, %g2 | |
185 | add %l7, 0x40, %l7 | |
186 | ldda [%g2]ASI_BLOCK_PRIMARY, %f0 | |
187 | membar #Sync | |
188 | stda %f0, [%l7]ASI_BLK_COMMIT_PRIMARY | |
189 | membar #Sync | |
190 | ||
191 | ldx [%l7], %i0 | |
192 | ldx [%g2], %o0 | |
193 | cmp %i0, %o0 | |
194 | bne test_failed | |
195 | nop | |
196 | ldx [%l7+0x8], %i1 | |
197 | ldx [%g2+0x8], %o1 | |
198 | cmp %i1, %o1 | |
199 | bne test_failed | |
200 | nop | |
201 | ldx [%l7+0x10], %i2 | |
202 | ldx [%g2+0x10], %o2 | |
203 | cmp %i2, %o2 | |
204 | bne test_failed | |
205 | nop | |
206 | ldx [%l7+0x18], %i3 | |
207 | ldx [%g2+0x18], %o3 | |
208 | cmp %i3, %o3 | |
209 | bne test_failed | |
210 | nop | |
211 | ldx [%l7+0x20], %i4 | |
212 | ldx [%g2+0x20], %o4 | |
213 | cmp %i4, %o4 | |
214 | bne test_failed | |
215 | nop | |
216 | ldx [%l7+0x28], %i5 | |
217 | ldx [%g2+0x28], %o5 | |
218 | cmp %i5, %o5 | |
219 | bne test_failed | |
220 | nop | |
221 | ldx [%l7+0x30], %i6 | |
222 | ldx [%g2+0x30], %o6 | |
223 | cmp %i6, %o6 | |
224 | bne test_failed | |
225 | nop | |
226 | ldx [%l7+0x38], %i7 | |
227 | ldx [%g2+0x38], %o7 | |
228 | cmp %i7, %o7 | |
229 | bne test_failed | |
230 | nop | |
231 | ||
232 | ! Done | |
233 | ||
234 | membar #Sync | |
235 | ba test_passed | |
236 | nop | |
237 | ||
238 | ||
239 | /********************************************************************** | |
240 | * Common code. | |
241 | *********************************************************************/ | |
242 | ||
243 | ! Assumes that %o0 contains VA that maps to L2$ line to be flushed. | |
244 | ! This is done by doing 16 loads from different addresses that alias | |
245 | ! to that line. Note that this will cause a writeback if the L2$ | |
246 | ! line is dirty. | |
247 | ||
248 | flush_l2_line: | |
249 | setx 0x3ffff, %o1, %o2 | |
250 | and %o0, %g2, %o3 | |
251 | setx alias1, %o1, %o4 | |
252 | ld [%o3+%o4], %o5 | |
253 | setx alias2, %o1, %o4 | |
254 | ld [%o3+%o4], %o5 | |
255 | setx alias3, %o1, %o4 | |
256 | ld [%o3+%o4], %o5 | |
257 | setx alias4, %o1, %o4 | |
258 | ld [%o3+%o4], %o5 | |
259 | setx alias5, %o1, %o4 | |
260 | ld [%o3+%o4], %o5 | |
261 | setx alias6, %o1, %o4 | |
262 | ld [%o3+%o4], %o5 | |
263 | setx alias7, %o1, %o4 | |
264 | ld [%o3+%o4], %o5 | |
265 | setx alias8, %o1, %o4 | |
266 | ld [%o3+%o4], %o5 | |
267 | setx alias9, %o1, %o4 | |
268 | ld [%o3+%o4], %o5 | |
269 | setx alias10, %o1, %o4 | |
270 | ld [%o3+%o4], %o5 | |
271 | setx alias11, %o1, %o4 | |
272 | ld [%o3+%o4], %o5 | |
273 | setx alias12, %o1, %o4 | |
274 | ld [%o3+%o4], %o5 | |
275 | setx alias13, %o1, %o4 | |
276 | ld [%o3+%o4], %o5 | |
277 | setx alias14, %o1, %o4 | |
278 | ld [%o3+%o4], %o5 | |
279 | setx alias15, %o1, %o4 | |
280 | ld [%o3+%o4], %o5 | |
281 | setx alias16, %o1, %o4 | |
282 | ld [%o3+%o4], %o5 | |
283 | jmpl %o7+0x8, %g0 | |
284 | nop | |
285 | ||
286 | test_passed: | |
287 | EXIT_GOOD | |
288 | nop | |
289 | ||
290 | test_failed: | |
291 | EXIT_BAD | |
292 | nop | |
293 | user_text_end: | |
294 | ||
295 | /************************************************************************ | |
296 | * Test case data start | |
297 | ************************************************************************/ | |
298 | ||
299 | SECTION .DATA DATA_VA=0x70000000 | |
300 | attr_data { | |
301 | Name = .DATA, | |
302 | hypervisor, | |
303 | compressimage | |
304 | } | |
305 | ||
306 | .data | |
307 | .global single_data | |
308 | .global double_data | |
309 | .global zero_data | |
310 | .global block_data | |
311 | .global result_area | |
312 | .global alias1 | |
313 | .global alias2 | |
314 | .global alias3 | |
315 | .global alias4 | |
316 | .global alias5 | |
317 | .global alias6 | |
318 | .global alias7 | |
319 | .global alias8 | |
320 | .global alias9 | |
321 | .global alias10 | |
322 | .global alias11 | |
323 | .global alias12 | |
324 | .global alias13 | |
325 | .global alias14 | |
326 | .global alias15 | |
327 | .global alias16 | |
328 | ||
329 | user_data_start: | |
330 | single_data: | |
331 | .xword 0x3f8000003f800000 ! 1.0, 1.0 single precision | |
332 | double_data: | |
333 | .xword 0x4000000000000000 ! 2.0 double precision | |
334 | zero_data: | |
335 | .xword 0x0000000000000000 | |
336 | .align 64 | |
337 | block_data: | |
338 | .xword 0x1111111111111111 | |
339 | .xword 0x2222222222222222 | |
340 | .xword 0x3333333333333333 | |
341 | .xword 0x4444444444444444 | |
342 | .xword 0x5555555555555555 | |
343 | .xword 0x6666666666666666 | |
344 | .xword 0x7777777777777777 | |
345 | .xword 0x8888888888888888 | |
346 | .xword 0x9999999999999999 | |
347 | .xword 0xaaaaaaaaaaaaaaaa | |
348 | .xword 0xbbbbbbbbbbbbbbbb | |
349 | .xword 0xcccccccccccccccc | |
350 | .xword 0xdddddddddddddddd | |
351 | .xword 0xeeeeeeeeeeeeeeee | |
352 | .xword 0xffffffffffffffff | |
353 | .xword 0x1111111111111111 | |
354 | .xword 0x2222222222222222 | |
355 | .xword 0x3333333333333333 | |
356 | .xword 0x4444444444444444 | |
357 | .xword 0x5555555555555555 | |
358 | .xword 0x6666666666666666 | |
359 | .xword 0x7777777777777777 | |
360 | .xword 0x8888888888888888 | |
361 | .xword 0x9999999999999999 | |
362 | .xword 0xaaaaaaaaaaaaaaaa | |
363 | .xword 0xbbbbbbbbbbbbbbbb | |
364 | .xword 0xcccccccccccccccc | |
365 | .xword 0xdddddddddddddddd | |
366 | .xword 0xeeeeeeeeeeeeeeee | |
367 | .xword 0xffffffffffffffff | |
368 | .xword 0x0000000000000000 | |
369 | .xword 0x0000000000000000 | |
370 | .align 256 | |
371 | result_area: | |
372 | .skip 512 ! 64 bytes per core | |
373 | ||
374 | .align 0x40000 ! each 246kb, 0x40000, aliases to same L2$ line | |
375 | alias1: | |
376 | .skip 1024 | |
377 | .align 0x40000 | |
378 | alias2: | |
379 | .skip 1024 | |
380 | .align 0x40000 | |
381 | alias3: | |
382 | .skip 1024 | |
383 | .align 0x40000 | |
384 | alias4: | |
385 | .skip 1024 | |
386 | .align 0x40000 | |
387 | alias5: | |
388 | .skip 1024 | |
389 | .align 0x40000 | |
390 | alias6: | |
391 | .skip 1024 | |
392 | .align 0x40000 | |
393 | alias7: | |
394 | .skip 1024 | |
395 | .align 0x40000 | |
396 | alias8: | |
397 | .skip 1024 | |
398 | .align 0x40000 | |
399 | alias9: | |
400 | .skip 1024 | |
401 | .align 0x40000 | |
402 | alias10: | |
403 | .skip 1024 | |
404 | .align 0x40000 | |
405 | alias11: | |
406 | .skip 1024 | |
407 | .align 0x40000 | |
408 | alias12: | |
409 | .skip 1024 | |
410 | .align 0x40000 | |
411 | alias13: | |
412 | .skip 1024 | |
413 | .align 0x40000 | |
414 | alias14: | |
415 | .skip 1024 | |
416 | .align 0x40000 | |
417 | alias15: | |
418 | .skip 1024 | |
419 | .align 0x40000 | |
420 | alias16: | |
421 | .skip 1024 | |
422 | ||
423 | user_data_end: | |
424 | .end |