Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: traps_34_35_36.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 | !#include "nmacros.h" | |
41 | ||
42 | #define MY_GENERIC_TRAP \ | |
43 | rdpr %tl, %l6; \ | |
44 | rdpr %tt, %l5; \ | |
45 | rd %pc, %l4; \ | |
46 | inc %l3; \ | |
47 | done; \ | |
48 | nop; \ | |
49 | nop; \ | |
50 | nop; | |
51 | ||
52 | ||
53 | ! these should go to Hpriv table ??? | |
54 | #define H_HT0_Mem_Address_Not_Aligned_0x34 | |
55 | #define My_HT0_Mem_Address_Not_Aligned_0x34 MY_GENERIC_TRAP | |
56 | ||
57 | #define H_HT0_Lddf_Mem_Address_Not_Aligned_0x35 | |
58 | #define My_HT0_Lddf_Mem_Address_Not_Aligned_0x35 MY_GENERIC_TRAP | |
59 | ||
60 | #define H_HT0_Stdf_Mem_Address_Not_Aligned_0x36 | |
61 | #define My_HT0_Stdf_Mem_Address_Not_Aligned_0x36 MY_GENERIC_TRAP | |
62 | ||
63 | #include "hboot.s" | |
64 | ||
65 | /************************************************************************ | |
66 | Test case code start | |
67 | ************************************************************************/ | |
68 | ||
69 | .text | |
70 | .global main | |
71 | ||
72 | main: | |
73 | ||
74 | ! ta T_CHANGE_PRIV ! run in priv mode | |
75 | ! nop | |
76 | ||
77 | ! rdth_id ! get thread ID in %o1 | |
78 | ! umul %o1, 256, %l7 | |
79 | ! setx user_data_start, %g1, %g3 | |
80 | ! add %l7, %g3, %l7 | |
81 | ||
82 | single_thread: | |
83 | ba thread_0 | |
84 | ||
85 | ! thread_dispatch: | |
86 | ! cmp %o1, 0x0 | |
87 | ! be thread_0 | |
88 | ! nop | |
89 | ! cmp %o1, 0x1 | |
90 | ! be thread_1 | |
91 | ! nop | |
92 | ! cmp %o1, 0x2 | |
93 | ! be thread_2 | |
94 | ! nop | |
95 | ! cmp %o1, 0x3 | |
96 | ! be thread_3 | |
97 | ! nop | |
98 | ! cmp %o1, 0x4 | |
99 | ! be thread_4 | |
100 | ! nop | |
101 | ! cmp %o1, 0x5 | |
102 | ! be thread_5 | |
103 | ! nop | |
104 | ! cmp %o1, 0x6 | |
105 | ! be thread_6 | |
106 | ! nop | |
107 | ! cmp %o1, 0x7 | |
108 | ! be thread_7 | |
109 | ||
110 | ! ! ! nop | |
111 | ! ! ! EXIT_GOOD | |
112 | ||
113 | ||
114 | ||
115 | ! | |
116 | ! Thread 0 Start | |
117 | ! | |
118 | thread_0: | |
119 | ||
120 | ||
121 | theRealStuff: | |
122 | !# Execute Main Diag .. | |
123 | ||
124 | ||
125 | ! table address | |
126 | setx HV_TRAP_BASE_PA, %i1, %i7 | |
127 | srlx %i7, 13, %i4 ! HV_TRAP_BASE | |
128 | setx TRAP_BASE_VA, %i1, %i7 | |
129 | srlx %i7, 13, %i5 ! TRAP_BASE | |
130 | ||
131 | ! trap counter | |
132 | mov 0, %o6 | |
133 | ||
134 | ! data addr | |
135 | setx user_data_start, %g1, %i2 | |
136 | srlx %i2, 0x3, %i2 ! insure DW alignment | |
137 | sllx %i2, 0x3, %i2 ! insure DW alignment | |
138 | ||
139 | Mem_Address: | |
140 | ! %l5 = Mem_Address_Not_Aligned_0x34 | |
141 | ldx [%i2 + 3], %o0 | |
142 | cmp %l6, 0x1 !level | |
143 | bne test_failed | |
144 | mov 0, %l6 | |
145 | cmp %l5, 0x34 !type | |
146 | bne test_failed | |
147 | mov 0, %l5 | |
148 | srlx %l4, 13, %g3 ! table address | |
149 | cmp %g3, %i4 ! correct table? | |
150 | bne test_failed | |
151 | mov 0, %l4 | |
152 | inc %o6 | |
153 | ||
154 | ||
155 | Lddf_Mem_Address: | |
156 | ! %l5 = Lddf_Mem_Address_Not_Aligned_0x35 | |
157 | ldd [%i2 + 4], %f0 | |
158 | cmp %l6, 0x1 !level | |
159 | bne test_failed | |
160 | mov 0, %l6 | |
161 | cmp %l5, 0x35 !type | |
162 | bne test_failed | |
163 | mov 0, %l5 | |
164 | srlx %l4, 13, %g3 ! table address | |
165 | cmp %g3, %i4 ! correct table? | |
166 | bne test_failed | |
167 | mov 0, %l4 | |
168 | inc %o6 | |
169 | ||
170 | ||
171 | Stdf_Mem_Address: | |
172 | ! %l5 = Stdf_Mem_Address_Not_Aligned_0x36 | |
173 | std %f0, [%i2 + 4] | |
174 | cmp %l6, 0x1 !level | |
175 | bne test_failed | |
176 | mov 0, %l6 | |
177 | cmp %l5, 0x36 !type | |
178 | bne test_failed | |
179 | mov 0, %l5 | |
180 | srlx %l4, 13, %g3 ! table address | |
181 | cmp %g3, %i4 ! correct table? | |
182 | bne test_failed | |
183 | mov 0, %l4 | |
184 | inc %o6 | |
185 | ||
186 | ||
187 | ||
188 | ! check final trap count, overkill... | |
189 | cmp %o6, %l3 | |
190 | bne test_failed | |
191 | nop | |
192 | ||
193 | test_passed: | |
194 | EXIT_GOOD | |
195 | ||
196 | test_failed: | |
197 | EXIT_BAD | |
198 | ||
199 | ||
200 | ||
201 | /************************************************************************ | |
202 | Test case data start | |
203 | ************************************************************************/ | |
204 | .data | |
205 | user_data_start: | |
206 | .xword 0xDEADBEEFDEADBEEF | |
207 | .xword 0x1111111122222222 | |
208 | .xword 0x3333333344444444 | |
209 | .xword 0x55555555 | |
210 | .end | |
211 | ||
212 | ||
213 |