Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: tso_n1_cross_mod101.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 | set 0x40, %i7 ! loop counting | |
82 | ||
83 | setx ready, %l0, %l1 ! pointers... | |
84 | setx noop, %l0, %l2 | |
85 | ld [%l2], %o7 ! %o7 contains the nop command | |
86 | setx modified, %l0, %l3 ! | |
87 | ||
88 | deliver_loop: | |
89 | ld [%l3], %o0 ! bring the line | |
90 | ! THIS IS the added value of this test. | |
91 | ld [%l1], %o0 ! read ready. | |
92 | tst %o0 ! should be 0. | |
93 | bne deliver_loop | |
94 | nop | |
95 | ||
96 | st %o7, [%l3] ! modify the code. | |
97 | st %o7, [%l3 + 4] ! and then flush. | |
98 | #ifdef FLUSH | |
99 | flush %l3 ! the register does not matter. | |
100 | #endif | |
101 | ||
102 | deccc %i7 ! count | |
103 | bne goon | |
104 | nop | |
105 | ba final_stuff ! go to end if finished | |
106 | nop | |
107 | ||
108 | goon: | |
109 | set 1, %i0 ! set ready | |
110 | st %i0, [%l1] ! | |
111 | ba deliver_loop ! repeat | |
112 | nop | |
113 | ||
114 | final_stuff: | |
115 | set 0x55, %i0 ! 55 means we are done. | |
116 | st %i0, [%l1] | |
117 | ba good_end | |
118 | nop | |
119 | ||
120 | ! these are the receivers | |
121 | !------------------------ | |
122 | th_main_1: | |
123 | th_main_4: | |
124 | ||
125 | setx ready, %l0, %l1 ! pointers... | |
126 | setx bad_end, %l0, %l2 | |
127 | ld [%l2], %o7 ! o7 contains a ta 0x101 | |
128 | setx modified, %l0, %l3 | |
129 | ||
130 | wait_loop: ! wait for ready flag | |
131 | ld [%l3], %o0 ! bring the line | |
132 | ld [%l1], %o0 | |
133 | sub %o0, 0x55, %i1 ! check for end of test flag. | |
134 | tst %i1 | |
135 | be good_end ! end the test | |
136 | nop | |
137 | sub %o0, 0x1, %i1 ! code for available data | |
138 | tst %i1 | |
139 | be modified | |
140 | nop | |
141 | ba wait_loop | |
142 | nop | |
143 | ||
144 | .align 0x10 | |
145 | modified: | |
146 | ta T_BAD_TRAP ! this data is overwritten, | |
147 | ta T_BAD_TRAP ! so the test goes on... | |
148 | ||
149 | st %o7, [%l3] ! now overwrite back with ta T_BAD_TRAP | |
150 | st %o7, [%l3 + 4] | |
151 | ||
152 | set 0, %o0 ! reset the ready flag | |
153 | st %o0, [%l1] | |
154 | ||
155 | ba wait_loop ! do it again | |
156 | nop | |
157 | ||
158 | good_end: | |
159 | ta T_GOOD_TRAP | |
160 | bad_end: | |
161 | ta T_BAD_TRAP | |
162 | noop: | |
163 | nop | |
164 | ||
165 | .data | |
166 | .global ready | |
167 | ready: | |
168 | .word 0x0 | |
169 | ||
170 | .end | |
171 |