Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: fp_sticky_bits_n2.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 H_T0_Fp_exception_ieee_754_0x21 T0_Fp_exception_ieee_754 | |
39 | #define H_T0_Fp_exception_other_0x22 T0_Fp_exception_other | |
40 | ||
41 | #define ENABLE_T0_Fp_disabled_0x20 | |
42 | #include "hboot.s" | |
43 | ||
44 | ||
45 | .text | |
46 | .global main | |
47 | ||
48 | main: | |
49 | ||
50 | wr %g0, 0x4, %fprs /* make sure fef is 1 */ | |
51 | ||
52 | setx fsr_tem_en, %l0, %l3 ! fsr tem enable value | |
53 | ||
54 | /******************************************************* | |
55 | * Simple data | |
56 | *******************************************************/ | |
57 | ||
58 | ! By default, mask is disabled | |
59 | ||
60 | ld [%l3+0x0], %fsr ! Read it from memory - trap disabled | |
61 | ||
62 | ||
63 | setx walking_one, %l0, %l6 ! Double precision data | |
64 | ||
65 | ldd [%l6+%g0], %f0 ! double precision | |
66 | add %g0, 0x8, %g4 | |
67 | ldd [%l6+%g4], %f2 ! double precision | |
68 | add %g4, 0x8, %g4 | |
69 | ||
70 | ||
71 | set 0x30, %g6 ! Max loop count rd | |
72 | set 0x0, %g7 ! loop iterator | |
73 | ||
74 | walking_one_loop0: ! Rounding mode loop | |
75 | ||
76 | ||
77 | faddd %f0, %f2, %f10 | |
78 | fdivd %f0, %f2, %f20 | |
79 | fmuld %f0, %f2, %f30 | |
80 | ||
81 | ldd [%l6+%g4], %f2 ! double precision | |
82 | add %g4, 0x8, %g4 | |
83 | ||
84 | ||
85 | add %g7, 0x1, %g7 | |
86 | subcc %g7, %g6, %g0 | |
87 | ||
88 | bne,a walking_one_loop0 ! If not 0, go to test more | |
89 | nop | |
90 | ||
91 | ||
92 | /******************************************************* | |
93 | * Exit code | |
94 | *******************************************************/ | |
95 | ||
96 | test_pass: | |
97 | ta T_GOOD_TRAP | |
98 | ||
99 | test_fail: | |
100 | ta T_BAD_TRAP | |
101 | ||
102 | /******************************************************* | |
103 | * Data section | |
104 | *******************************************************/ | |
105 | ||
106 | .data | |
107 | ||
108 | .align 256 | |
109 | ||
110 | ||
111 | walking_one: | |
112 | ||
113 | .xword 0x0000000000000001 ! Walking one | |
114 | .xword 0x0000000000000002 ! Walking one | |
115 | .xword 0x0000000000000004 ! Walking one | |
116 | .xword 0x0000000000000008 ! Walking one | |
117 | .xword 0x0000000000000010 ! Walking one | |
118 | .xword 0x0000000000000020 ! Walking one | |
119 | .xword 0x0000000000000040 ! Walking one | |
120 | .xword 0x0000000000000080 ! Walking one | |
121 | .xword 0x0000000000000100 ! Walking one | |
122 | .xword 0x0000000000000200 ! Walking one | |
123 | .xword 0x0000000000000400 ! Walking one | |
124 | .xword 0x0000000000000800 ! Walking one | |
125 | .xword 0x0000000000001000 ! Walking one | |
126 | .xword 0x0000000000002000 ! Walking one | |
127 | .xword 0x0000000000004000 ! Walking one | |
128 | .xword 0x0000000000008000 ! Walking one | |
129 | .xword 0x0000000000010000 ! Walking one | |
130 | .xword 0x0000000000020000 ! Walking one | |
131 | .xword 0x0000000000040000 ! Walking one | |
132 | .xword 0x0000000000080000 ! Walking one | |
133 | .xword 0x0000000000100000 ! Walking one | |
134 | .xword 0x0000000000200000 ! Walking one | |
135 | .xword 0x0000000000400000 ! Walking one | |
136 | .xword 0x0000000000800000 ! Walking one | |
137 | .xword 0x0000000001000000 ! Walking one | |
138 | .xword 0x0000000002000000 ! Walking one | |
139 | .xword 0x0000000004000000 ! Walking one | |
140 | .xword 0x0000000008000000 ! Walking one | |
141 | .xword 0x0000000010000000 ! Walking one | |
142 | .xword 0x0000000020000000 ! Walking one | |
143 | .xword 0x0000000040000000 ! Walking one | |
144 | .xword 0x0000000080000000 ! Walking one | |
145 | .xword 0x0000000100000000 ! Walking one | |
146 | .xword 0x0000000200000000 ! Walking one | |
147 | .xword 0x0000000400000000 ! Walking one | |
148 | .xword 0x0000000800000000 ! Walking one | |
149 | .xword 0x0000001000000000 ! Walking one | |
150 | .xword 0x0000002000000000 ! Walking one | |
151 | .xword 0x0000004000000000 ! Walking one | |
152 | .xword 0x0000008000000000 ! Walking one | |
153 | .xword 0x0000010000000000 ! Walking one | |
154 | .xword 0x0000020000000000 ! Walking one | |
155 | .xword 0x0000040000000000 ! Walking one | |
156 | .xword 0x0000080000000000 ! Walking one | |
157 | .xword 0x0000100000000000 ! Walking one | |
158 | .xword 0x0000200000000000 ! Walking one | |
159 | .xword 0x0000400000000000 ! Walking one | |
160 | .xword 0x0000800000000000 ! Walking one | |
161 | .xword 0x0001000000000000 ! Walking one | |
162 | .xword 0x0002000000000000 ! Walking one | |
163 | .xword 0x0004000000000000 ! Walking one | |
164 | .xword 0x0008000000000000 ! Walking one | |
165 | .xword 0x0010000000000000 ! Walking one | |
166 | .xword 0x0020000000000000 ! Walking one | |
167 | .xword 0x0040000000000000 ! Walking one | |
168 | .xword 0x0080000000000000 ! Walking one | |
169 | .xword 0x0100000000000000 ! Walking one | |
170 | .xword 0x0200000000000000 ! Walking one | |
171 | .xword 0x0400000000000000 ! Walking one | |
172 | .xword 0x0800000000000000 ! Walking one | |
173 | .xword 0x1000000000000000 ! Walking one | |
174 | .xword 0x2000000000000000 ! Walking one | |
175 | .xword 0x4000000000000000 ! Walking one | |
176 | .xword 0x8000000000000000 ! Walking one | |
177 | ||
178 | ||
179 | ||
180 | .align 256 | |
181 | ||
182 | fsr_tem_en: | |
183 | .word 0x0f800000 ! TEM - all enabled - rd 0 | |
184 | .word 0x4f800000 ! TEM - all enabled - rd 1 | |
185 | .word 0x8f800000 ! TEM - all enabled - rd 2 | |
186 | .word 0xcf800000 ! TEM - all enabled - rd 3 | |
187 | .word 0x00000000 ! TEM - walk through all values | |
188 | .word 0x0f800000 | |
189 | .word 0x01000000 | |
190 | .word 0x01800000 | |
191 | .word 0x02000000 | |
192 | .word 0x02800000 | |
193 | .word 0x03000000 | |
194 | .word 0x03800000 | |
195 | .word 0x04000000 | |
196 | .word 0x04800000 | |
197 | .word 0x05000000 | |
198 | .word 0x05800000 | |
199 | .word 0x06000000 | |
200 | .word 0x06800000 | |
201 | .word 0x07000000 | |
202 | .word 0x07800000 | |
203 | .word 0x08000000 | |
204 | .word 0x08800000 | |
205 | .word 0x09000000 | |
206 | .word 0x09800000 | |
207 | .word 0x0a000000 | |
208 | .word 0x0a800000 | |
209 | .word 0x0b000000 | |
210 | .word 0x0b800000 | |
211 | .word 0x0c000000 | |
212 | .word 0x0c800000 | |
213 | .word 0x0d000000 | |
214 | .word 0x0d800000 | |
215 | .word 0x0e000000 | |
216 | .word 0x0e800000 | |
217 | .word 0x0f000000 | |
218 | .word 0x0f800000 | |
219 | .word 0x01800000 | |
220 | .word 0x02800000 | |
221 | .word 0x03800000 | |
222 | .word 0x04800000 | |
223 | ||
224 | ||
225 | ||
226 | ||
227 | fsr_tem_dis: | |
228 | .word 0x00000000 ! TEM - all disabled | |
229 | .word 0x40000000 ! TEM - all disabled | |
230 | .word 0x80000000 ! TEM - all disabled | |
231 | .word 0xc0000000 ! TEM - all disabled | |
232 | ||
233 | /******************************************************* | |
234 | * My own trap handlers | |
235 | *******************************************************/ | |
236 | ||
237 | SECTION .TRAPS | |
238 | .text | |
239 | ||
240 | ||
241 | .global T0_Fp_exception_ieee_754 | |
242 | .global T0_Fp_exception_other | |
243 | ||
244 | T0_Fp_exception_ieee_754: | |
245 | rdpr %tpc, %i0 | |
246 | rdpr %tnpc, %i1 | |
247 | rdpr %tstate, %i1 | |
248 | rdpr %tt, %i1 | |
249 | setx scratch, %l0, %l5 ! scratch | |
250 | stx %fsr, [%l5+0x0] | |
251 | ldx [%l5+0x0], %fsr ! Need to test the sync operation | |
252 | done | |
253 | nop | |
254 | ||
255 | T0_Fp_exception_other: | |
256 | rdpr %tpc, %i0 | |
257 | rdpr %tnpc, %i1 | |
258 | rdpr %tstate, %i1 | |
259 | rdpr %tt, %i1 | |
260 | setx scratch, %l0, %l5 ! scratch | |
261 | stx %fsr, [%l5+0x0] | |
262 | ldx [%l5+0x0], %fsr ! Need to test the sync operation | |
263 | done | |
264 | nop | |
265 | ||
266 | .data | |
267 | .align 128 | |
268 | ||
269 | scratch: | |
270 | .word 0x00000000 | |
271 | .word 0x00000000 | |
272 | .word 0x00000000 | |
273 | .word 0x00000000 | |
274 | .word 0x00000000 | |
275 | .word 0x00000000 | |
276 | .word 0x00000000 | |
277 | .word 0x00000000 |