Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / tso / tso_directed / tso_n1_cross_mod203.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: tso_n1_cross_mod203.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_BASE_DATA_ADDR 0x160000
39#define MAIN_BASE_TEXT_ADDR 0x150000
40#define MAIN_BASE_DATA_ADDR_RA 0x100160000
41#define MAIN_BASE_TEXT_ADDR_RA 0x100150000
42
43#define USER_PAGE_CUSTOM_MAP
44#include "hboot.s"
45
46SECTION .MAIN TEXT_VA=0x150000, DATA_VA=0x160000
47
48attr_text {
49 Name = .MAIN,
50 VA=MAIN_BASE_TEXT_ADDR,
51 RA=MAIN_BASE_TEXT_ADDR_RA,
52 PA=ra2pa(MAIN_BASE_TEXT_ADDR_RA,0),
53part_0_ctx_nonzero_tsb_config_0,
54 TTE_G=0, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0,
55 TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0,
56 TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_EP=1, TTE_P=0, TTE_W=1
57 }
58attr_data {
59 Name = .MAIN,
60 VA=MAIN_BASE_DATA_ADDR,
61 RA=MAIN_BASE_DATA_ADDR_RA,
62 PA=ra2pa(MAIN_BASE_DATA_ADDR_RA,0),
63part_0_ctx_nonzero_tsb_config_0,
64 TTE_G=0, TTE_Context=PCONTEXT, TTE_V=1, TTE_Size=0, TTE_NFO=0,
65 TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0,
66 TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1
67 }
68
69.text
70.global main
71main:
72 clr %l0
73
74 th_fork(th_main,%l0)
75
76
77! this thread modfifies the code
78!===============================
79th_main_0:
80
81!--------------------------------------------------------------------
82 setx exit_code1,%l0, %l1 ! pointers...
83 setx wait_loop1, %l0, %l3 !
84 ld [%l3], %o6 ! load the old instruction in D$
85 ld [%l1], %o6 ! load the new instructions
86 ld [%l1+4], %o7 ! in o6 and o7
87 mov %o6, %i2
88 add %l3, 8, %l4
89 ld [%l3 + 8],%i4 ! use a cas and a store to modify
90 cas [%l4], %i4, %i2 ! two instructions
91 st %o7, [%l3 + 4] ! the new instruction is a jump
92!--------------------------------------------------------------------
93 setx exit_code2,%l0, %l1 ! pointers...
94 setx wait_loop2, %l0, %l3 !
95 ld [%l1], %o6 !
96 ld [%l1+4], %o7 !
97 mov %o6, %i2
98 add %l3, 8, %l4
99 ld [%l3 + 8],%i4
100 cas [%l4], %i4, %i2
101 st %o7, [%l3 + 4] ! store the jump
102!--------------------------------------------------------------------
103 setx exit_code3,%l0, %l1 ! pointers...
104 setx wait_loop3, %l0, %l3 !
105 ld [%l3], %o6 !
106 ld [%l1], %o6 !
107 ld [%l1+4], %o7 !
108 mov %o6, %i2
109 add %l3, 8, %l4
110 ld [%l3 + 8],%i4
111 cas [%l4], %i4, %i2
112 st %o7, [%l3 + 4] ! store the jump
113!--------------------------------------------------------------------
114 setx exit_code4,%l0, %l1 ! pointers...
115 setx wait_loop4, %l0, %l3 !
116 ld [%l1], %o6 !
117 ld [%l1+4], %o7 !
118 mov %o6, %i2
119 add %l3, 8, %l4
120 ld [%l3 + 8],%i4
121 cas [%l4], %i4, %i2
122 st %o7, [%l3 + 4] ! store the jump
123!--------------------------------------------------------------------
124 setx exit_code5,%l0, %l1 ! pointers...
125 setx wait_loop5, %l0, %l3 !
126 ld [%l3], %o6 !
127 ld [%l1], %o6 !
128 ld [%l1+4], %o7 !
129 mov %o6, %i2
130 add %l3, 8, %l4
131 ld [%l3 + 8],%i4
132 cas [%l4], %i4, %i2
133 st %o7, [%l3 + 4] ! store the jump
134!--------------------------------------------------------------------
135 setx exit_code6,%l0, %l1 ! pointers...
136 setx wait_loop6, %l0, %l3 !
137 ld [%l1], %o6 !
138 ld [%l1+4], %o7 !
139 mov %o6, %i2
140 add %l3, 8, %l4
141 ld [%l3 + 8],%i4
142 cas [%l4], %i4, %i2
143 st %o7, [%l3 + 4] ! store the jump
144!--------------------------------------------------------------------
145 setx exit_code7,%l0, %l1 ! pointers...
146 setx wait_loop7, %l0, %l3 !
147 ld [%l3], %o6 !
148 ld [%l1], %o6 !
149 ld [%l1+4], %o7 !
150 mov %o6, %i2
151 add %l3, 8, %l4
152 ld [%l3 + 8],%i4
153 cas [%l4], %i4, %i2
154 st %o7, [%l3 + 4] ! store the jump
155!--------------------------------------------------------------------
156 setx exit_code8,%l0, %l1 ! pointers...
157 setx wait_loop8, %l0, %l3 !
158 ld [%l1], %o6 !
159 ld [%l1+4], %o7 !
160 mov %o6, %i2
161 add %l3, 8, %l4
162 ld [%l3 + 8],%i4
163 cas [%l4], %i4, %i2
164 st %o7, [%l3 + 4] ! store the jump
165!--------------------------------------------------------------------
166 setx exit_code9,%l0, %l1 ! pointers...
167 setx wait_loop9, %l0, %l3 !
168 ld [%l3], %o6 !
169 ld [%l1], %o6 !
170 ld [%l1+4], %o7 !
171 mov %o6, %i2
172 add %l3, 8, %l4
173 ld [%l3 + 8],%i4
174 cas [%l4], %i4, %i2
175 st %o7, [%l3 + 4] ! store the jump
176!--------------------------------------------------------------------
177 setx exit_codea,%l0, %l1 ! pointers...
178 setx wait_loopa, %l0, %l3 !
179 ld [%l1], %o6 !
180 ld [%l1+4], %o7 !
181 mov %o6, %i2
182 add %l3, 8, %l4
183 ld [%l3 + 8],%i4
184 cas [%l4], %i4, %i2
185 st %o7, [%l3 + 4] ! store the jump
186!--------------------------------------------------------------------
187 setx exit_codeb,%l0, %l1 ! pointers...
188 setx wait_loopb, %l0, %l3 !
189 ld [%l3], %o6 !
190 ld [%l1], %o6 !
191 ld [%l1+4], %o7 !
192 mov %o6, %i2
193 add %l3, 8, %l4
194 ld [%l3 + 8],%i4
195 cas [%l4], %i4, %i2
196 st %o7, [%l3 + 4] ! store the jump
197 ba good_end
198 nop
199!--------------------------------------------------------------------
200
201! these are the receivers
202!------------------------
203.align 0x4
204th_main_1:
205th_main_4:
206
207!--------------------------------------------------------------
208 set goon1, %i0
209 set 0x0, %i1
210wait_loop1: ! wait
211 nop ! this will be replaced
212 nop ! this too
213 nop
214 ba wait_loop1
215 nop
216goon1:
217 subcc %i1, 1, %i1 ! was the new instruction the right one?
218 bne bad_end
219 nop
220 set 0x0, %i1
221 set goon2, %i0
222 ba wait_loop2
223 nop
224!--------------------------------------------------------------
225wait_loop2: ! wait
226 nop ! this will be replaced
227 nop ! this too
228 nop
229 ba wait_loop2
230 nop
231goon2:
232 subcc %i1, 1, %i1
233 bne bad_end
234 nop
235 set 0x0, %i1
236 set goon3, %i0
237 ba wait_loop3
238 nop
239!--------------------------------------------------------------
240wait_loop3: ! wait
241 nop ! this will be replaced
242 nop ! this too
243 nop
244 ba wait_loop3
245 nop
246goon3:
247 subcc %i1, 1, %i1
248 bne bad_end
249 nop
250 set 0x0, %i1
251 set goon4, %i0
252 ba wait_loop4
253 nop
254!--------------------------------------------------------------
255.align 0x4
256wait_loop4: ! wait
257 nop ! this will be replaced
258 nop ! this too
259 nop
260 ba wait_loop4
261 nop
262goon4:
263 subcc %i1, 1, %i1
264 bne bad_end
265 nop
266 set 0x0, %i1
267 set goon5, %i0
268 ba wait_loop5
269 nop
270!--------------------------------------------------------------
271.align 0x4
272wait_loop5: ! wait
273 nop ! this will be replaced
274 nop ! this too
275 nop
276 ba wait_loop5
277 nop
278goon5:
279 subcc %i1, 1, %i1
280 bne bad_end
281 nop
282 set 0x0, %i1
283 set goon6, %i0
284 ba wait_loop6
285 nop
286!--------------------------------------------------------------
287.align 0x4
288wait_loop6: ! wait
289 nop ! this will be replaced
290 nop ! this too
291 nop
292 ba wait_loop6
293 nop
294goon6:
295 subcc %i1, 1, %i1
296 bne bad_end
297 nop
298 set 0x0, %i1
299 set goon7, %i0
300 ba wait_loop7
301 nop
302!--------------------------------------------------------------
303.align 0x4
304wait_loop7: ! wait
305 nop ! this will be replaced
306 nop ! this too
307 nop
308 ba wait_loop7
309 nop
310goon7:
311 subcc %i1, 1, %i1
312 bne bad_end
313 nop
314 set goon8, %i0
315 ba wait_loop8
316 nop
317!--------------------------------------------------------------
318.align 0x4
319wait_loop8: ! wait
320 nop ! this will be replaced
321 nop ! this too
322 nop
323 ba wait_loop8
324 nop
325goon8:
326 subcc %i1, 1, %i1
327 bne bad_end
328 nop
329 set 0x0, %i1
330 set goon9, %i0
331 ba wait_loop9
332 nop
333!--------------------------------------------------------------
334.align 0x4
335wait_loop9: ! wait
336 nop ! this will be replaced
337 nop ! this too
338 nop
339 ba wait_loop9
340 nop
341goon9:
342 subcc %i1, 1, %i1
343 bne bad_end
344 nop
345 set 0x0, %i1
346 set goona, %i0
347 ba wait_loopa
348 nop
349!--------------------------------------------------------------
350.align 0x4
351wait_loopa: ! wait
352 nop ! this too
353 nop ! this too
354 nop
355 ba wait_loopa
356 nop
357goona:
358 subcc %i1, 1, %i1
359 bne bad_end
360 nop
361 set 0x0, %i1
362 set goonb, %i0
363 ba wait_loopb
364 nop
365!--------------------------------------------------------------
366wait_loopb: ! wait
367 nop ! this too
368 nop ! this too
369 nop
370 ba wait_loopb
371 nop
372goonb:
373 subcc %i1, 1, %i1
374 bne bad_end
375 nop
376!--------------------------------------------------------------
377
378good_end:
379 ta T_GOOD_TRAP
380bad_end:
381 ta T_BAD_TRAP
382
383!--------------------------------------------------------------
384.align 0x4
385exit_code1:
386 set 0x1, %i1
387 jmpl %i0,%o7
388 set 0x0, %i1
389!--------------------------------------------------------------
390.align 0x4
391exit_code2:
392 set 0x1, %i1
393 jmpl %i0,%o7
394 set 0x0, %i1
395!--------------------------------------------------------------
396.align 0x4
397exit_code3:
398 set 0x1, %i1
399 jmpl %i0,%o7
400 set 0x0, %i1
401!--------------------------------------------------------------
402.align 0x4
403exit_code4:
404 set 0x1, %i1
405 jmpl %i0,%o7
406 set 0x0, %i1
407!--------------------------------------------------------------
408.align 0x4
409exit_code5:
410 set 0x1, %i1
411 jmpl %i0,%o7
412 set 0x0, %i1
413!--------------------------------------------------------------
414.align 0x4
415exit_code6:
416 set 0x1, %i1
417 jmpl %i0,%o7
418 set 0x0, %i1
419!--------------------------------------------------------------
420.align 0x4
421exit_code7:
422 set 0x1, %i1
423 jmpl %i0,%o7
424 set 0x0, %i1
425!--------------------------------------------------------------
426.align 0x4
427exit_code8:
428 set 0x1, %i1
429 jmpl %i0,%o7
430 set 0x0, %i1
431!--------------------------------------------------------------
432.align 0x4
433exit_code9:
434 set 0x1, %i1
435 jmpl %i0,%o7
436 set 0x0, %i1
437!--------------------------------------------------------------
438.align 0x4
439exit_codea:
440 set 0x1, %i1
441 jmpl %i0,%o7
442 set 0x0, %i1
443!--------------------------------------------------------------
444.align 0x4
445exit_codeb:
446 set 0x1, %i1
447 jmpl %i0,%o7
448 set 0x0, %i1
449!--------------------------------------------------------------
450
451.data
452.global ready
453ready:
454 .word 0x0
455
456.end
457