Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / arch / prm / tso / tso_directed / tso_n1_cross_mod103.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: tso_n1_cross_mod103.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),
53 part_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_EP=1, TTE_E=0, 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),
63 part_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 ! get the instruction in the D$
85 ld [%l1], %o6 !
86 ld [%l1+4], %o7 !
87 st %o6, [%l3 + 8] ! modify the code.
88 st %o7, [%l3 + 4] ! the new code is a jump instruction
89!--------------------------------------------------------------------
90 setx exit_code2,%l0, %l1 ! pointers...
91 setx wait_loop2, %l0, %l3 !
92 ld [%l3], %o6 !
93 ld [%l1], %o6 !
94 ld [%l1+4], %o7 !
95 st %o6, [%l3 + 8] ! modify the code.
96 st %o7, [%l3 + 4] ! store the jump
97!--------------------------------------------------------------------
98 setx exit_code3,%l0, %l1 ! pointers...
99 setx wait_loop3, %l0, %l3 !
100 ld [%l3], %o6 !
101 ld [%l1], %o6 !
102 ld [%l1+4], %o7 !
103 st %o6, [%l3 + 8] ! modify the code.
104 st %o7, [%l3 + 4] ! store the jump
105!--------------------------------------------------------------------
106 setx exit_code4,%l0, %l1 ! pointers...
107 setx wait_loop4, %l0, %l3 !
108 ld [%l3], %o6 !
109 ld [%l1], %o6 !
110 ld [%l1+4], %o7 !
111 st %o6, [%l3 + 8] ! modify the code.
112 st %o7, [%l3 + 4] ! store the jump
113!--------------------------------------------------------------------
114 setx exit_code5,%l0, %l1 ! pointers...
115 setx wait_loop5, %l0, %l3 !
116 ld [%l3], %o6 !
117 ld [%l1], %o6 !
118 ld [%l1+4], %o7 !
119 st %o6, [%l3 + 8] ! modify the code.
120 st %o7, [%l3 + 4] ! store the jump
121!--------------------------------------------------------------------
122 setx exit_code6,%l0, %l1 ! pointers...
123 setx wait_loop6, %l0, %l3 !
124 ld [%l3], %o6 !
125 ld [%l1], %o6 !
126 ld [%l1+4], %o7 !
127 st %o6, [%l3 + 8] ! modify the code.
128 st %o7, [%l3 + 4] ! store the jump
129!--------------------------------------------------------------------
130 setx exit_code7,%l0, %l1 ! pointers...
131 setx wait_loop7, %l0, %l3 !
132 ld [%l3], %o6 !
133 ld [%l1], %o6 !
134 ld [%l1+4], %o7 !
135 st %o6, [%l3 + 8] ! modify the code.
136 st %o7, [%l3 + 4] ! store the jump
137!--------------------------------------------------------------------
138 setx exit_code8,%l0, %l1 ! pointers...
139 setx wait_loop8, %l0, %l3 !
140 ld [%l3], %o6 !
141 ld [%l1], %o6 !
142 ld [%l1+4], %o7 !
143 st %o6, [%l3 + 8] ! modify the code.
144 st %o7, [%l3 + 4] ! store the jump
145!--------------------------------------------------------------------
146 setx exit_code9,%l0, %l1 ! pointers...
147 setx wait_loop9, %l0, %l3 !
148 ld [%l3], %o6 !
149 ld [%l1], %o6 !
150 ld [%l1+4], %o7 !
151 st %o6, [%l3 + 8] ! modify the code.
152 st %o7, [%l3 + 4] ! store the jump
153!--------------------------------------------------------------------
154 setx exit_codea,%l0, %l1 ! pointers...
155 setx wait_loopa, %l0, %l3 !
156 ld [%l3], %o6 !
157 ld [%l1], %o6 !
158 ld [%l1+4], %o7 !
159 st %o6, [%l3 + 8] ! modify the code.
160 st %o7, [%l3 + 4] ! store the jump
161!--------------------------------------------------------------------
162 setx exit_codeb,%l0, %l1 ! pointers...
163 setx wait_loopb, %l0, %l3 !
164 ld [%l3], %o6 !
165 ld [%l1], %o6 !
166 ld [%l1+4], %o7 !
167 st %o6, [%l3 + 8] ! modify the code.
168 st %o7, [%l3 + 4] ! store the jump
169 ba good_end
170 nop
171!--------------------------------------------------------------------
172
173! these are the receivers
174!------------------------
175.align 0x4
176th_main_1:
177th_main_4:
178
179!--------------------------------------------------------------
180 set goon1, %i0
181 set 0x0, %i1
182wait_loop1: ! wait
183 nop ! this will be replaced
184 nop ! this also (with a jump)
185 nop
186 ba wait_loop1
187 nop
188goon1:
189 subcc %i1, 1, %i1
190 bne bad_end
191 nop
192 set 0x0, %i1
193 set goon2, %i0
194 ba wait_loop2
195 nop
196!--------------------------------------------------------------
197wait_loop2: ! wait
198 nop ! this will be replaced
199 nop ! this (with a jump)
200 nop
201 ba wait_loop2
202 nop
203goon2:
204 subcc %i1, 1, %i1
205 bne bad_end
206 nop
207 set 0x0, %i1
208 set goon3, %i0
209 ba wait_loop3
210 nop
211!--------------------------------------------------------------
212wait_loop3: ! wait
213 nop ! this will be replaced
214 nop ! this too
215 nop
216 ba wait_loop3
217 nop
218goon3:
219 subcc %i1, 1, %i1
220 bne bad_end
221 nop
222 set 0x0, %i1
223 set goon4, %i0
224 ba wait_loop4
225 nop
226!--------------------------------------------------------------
227.align 0x4
228wait_loop4: ! wait
229 nop ! this will be replaced
230 nop ! this too
231 nop
232 ba wait_loop4
233 nop
234goon4:
235 subcc %i1, 1, %i1
236 bne bad_end
237 nop
238 set 0x0, %i1
239 set goon5, %i0
240 ba wait_loop5
241 nop
242!--------------------------------------------------------------
243.align 0x4
244wait_loop5: ! wait
245 nop ! this will be replaced
246 nop ! this too
247 nop
248 ba wait_loop5
249 nop
250goon5:
251 subcc %i1, 1, %i1
252 bne bad_end
253 nop
254 set 0x0, %i1
255 set goon6, %i0
256 ba wait_loop6
257 nop
258!--------------------------------------------------------------
259.align 0x4
260wait_loop6: ! wait
261 nop ! this will be replaced
262 nop ! this too
263 nop
264 ba wait_loop6
265 nop
266goon6:
267 subcc %i1, 1, %i1
268 bne bad_end
269 nop
270 set 0x0, %i1
271 set goon7, %i0
272 ba wait_loop7
273 nop
274!--------------------------------------------------------------
275.align 0x4
276wait_loop7: ! wait
277 nop ! this will be replaced
278 nop ! this too
279 nop
280 ba wait_loop7
281 nop
282goon7:
283 subcc %i1, 1, %i1
284 bne bad_end
285 nop
286 set goon8, %i0
287 ba wait_loop8
288 nop
289!--------------------------------------------------------------
290.align 0x4
291wait_loop8: ! wait
292 nop ! this will be replaced
293 nop ! this too
294 nop
295 ba wait_loop8
296 nop
297goon8:
298 subcc %i1, 1, %i1
299 bne bad_end
300 nop
301 set 0x0, %i1
302 set goon9, %i0
303 ba wait_loop9
304 nop
305!--------------------------------------------------------------
306.align 0x4
307wait_loop9: ! wait
308 nop ! this will be replaced
309 nop ! this too
310 nop
311 ba wait_loop9
312 nop
313goon9:
314 subcc %i1, 1, %i1
315 bne bad_end
316 nop
317 set 0x0, %i1
318 set goona, %i0
319 ba wait_loopa
320 nop
321!--------------------------------------------------------------
322.align 0x4
323wait_loopa: ! wait
324 nop ! this too
325 nop ! this too
326 nop
327 ba wait_loopa
328 nop
329goona:
330 subcc %i1, 1, %i1
331 bne bad_end
332 nop
333 set 0x0, %i1
334 set goonb, %i0
335 ba wait_loopb
336 nop
337!--------------------------------------------------------------
338wait_loopb: ! wait
339 nop ! this too
340 nop ! this too
341 nop
342 ba wait_loopb
343 nop
344goonb:
345 subcc %i1, 1, %i1
346 bne bad_end
347 nop
348!--------------------------------------------------------------
349
350good_end:
351 ta T_GOOD_TRAP
352bad_end:
353 ta T_BAD_TRAP
354
355!--------------------------------------------------------------
356.align 0x4
357exit_code1:
358 set 0x1, %i1
359 jmpl %i0,%o7
360 set 0x0, %i1
361!--------------------------------------------------------------
362.align 0x4
363exit_code2:
364 set 0x1, %i1
365 jmpl %i0,%o7
366 set 0x0, %i1
367!--------------------------------------------------------------
368.align 0x4
369exit_code3:
370 set 0x1, %i1
371 jmpl %i0,%o7
372 set 0x0, %i1
373!--------------------------------------------------------------
374.align 0x4
375exit_code4:
376 set 0x1, %i1
377 jmpl %i0,%o7
378 set 0x0, %i1
379!--------------------------------------------------------------
380.align 0x4
381exit_code5:
382 set 0x1, %i1
383 jmpl %i0,%o7
384 set 0x0, %i1
385!--------------------------------------------------------------
386.align 0x4
387exit_code6:
388 set 0x1, %i1
389 jmpl %i0,%o7
390 set 0x0, %i1
391!--------------------------------------------------------------
392.align 0x4
393exit_code7:
394 set 0x1, %i1
395 jmpl %i0,%o7
396 set 0x0, %i1
397!--------------------------------------------------------------
398.align 0x4
399exit_code8:
400 set 0x1, %i1
401 jmpl %i0,%o7
402 set 0x0, %i1
403!--------------------------------------------------------------
404.align 0x4
405exit_code9:
406 set 0x1, %i1
407 jmpl %i0,%o7
408 set 0x0, %i1
409!--------------------------------------------------------------
410.align 0x4
411exit_codea:
412 set 0x1, %i1
413 jmpl %i0,%o7
414 set 0x0, %i1
415!--------------------------------------------------------------
416.align 0x4
417exit_codeb:
418 set 0x1, %i1
419 jmpl %i0,%o7
420 set 0x0, %i1
421!--------------------------------------------------------------
422
423.data
424.global ready
425ready:
426 .word 0x0
427
428.end