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