1 /* This is trivial with the new code... */
3 .type do_fpdis,#function
5 sethi %hi(TSTATE_PEF), %g4
11 andcc %g5, FPRS_FEF, %g0
15 /* Legal state when DCR_IFPOE is set in Cheetah %dcr. */
18 109: or %g7, %lo(109b), %g7
22 1: TRAP_LOAD_THREAD_REG(%g6, %g1)
23 ldub [%g6 + TI_FPSAVED], %g5
24 wr %g0, FPRS_FEF, %fprs
25 andcc %g5, FPRS_FEF, %g0
28 ldx [%g6 + TI_GSR], %g7
29 1: andcc %g5, FPRS_DL, %g0
32 andcc %g5, FPRS_DU, %g0
63 b,pt %xcc, fpdis_exit2
65 1: mov SECONDARY_CONTEXT, %g3
66 add %g6, TI_FPREGS + 0x80, %g1
70 661: ldxa [%g3] ASI_DMMU, %g5
71 .section .sun4v_1insn_patch, "ax"
73 ldxa [%g3] ASI_MMU, %g5
76 sethi %hi(sparc64_kern_sec_context), %g2
77 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
79 661: stxa %g2, [%g3] ASI_DMMU
80 .section .sun4v_1insn_patch, "ax"
82 stxa %g2, [%g3] ASI_MMU
86 add %g6, TI_FPREGS + 0xc0, %g2
90 ldda [%g1] ASI_BLK_S, %f32
91 ldda [%g2] ASI_BLK_S, %f48
103 ba,a,pt %xcc, fpdis_exit
105 2: andcc %g5, FPRS_DU, %g0
108 mov SECONDARY_CONTEXT, %g3
111 661: ldxa [%g3] ASI_DMMU, %g5
112 .section .sun4v_1insn_patch, "ax"
114 ldxa [%g3] ASI_MMU, %g5
117 add %g6, TI_FPREGS, %g1
118 sethi %hi(sparc64_kern_sec_context), %g2
119 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
121 661: stxa %g2, [%g3] ASI_DMMU
122 .section .sun4v_1insn_patch, "ax"
124 stxa %g2, [%g3] ASI_MMU
128 add %g6, TI_FPREGS + 0x40, %g2
129 faddd %f32, %f34, %f36
130 fmuld %f32, %f34, %f38
132 ldda [%g1] ASI_BLK_S, %f0
133 ldda [%g2] ASI_BLK_S, %f16
135 faddd %f32, %f34, %f40
136 fmuld %f32, %f34, %f42
137 faddd %f32, %f34, %f44
138 fmuld %f32, %f34, %f46
139 faddd %f32, %f34, %f48
140 fmuld %f32, %f34, %f50
141 faddd %f32, %f34, %f52
142 fmuld %f32, %f34, %f54
143 faddd %f32, %f34, %f56
144 fmuld %f32, %f34, %f58
145 faddd %f32, %f34, %f60
146 fmuld %f32, %f34, %f62
147 ba,a,pt %xcc, fpdis_exit
149 3: mov SECONDARY_CONTEXT, %g3
150 add %g6, TI_FPREGS, %g1
152 661: ldxa [%g3] ASI_DMMU, %g5
153 .section .sun4v_1insn_patch, "ax"
155 ldxa [%g3] ASI_MMU, %g5
158 sethi %hi(sparc64_kern_sec_context), %g2
159 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
161 661: stxa %g2, [%g3] ASI_DMMU
162 .section .sun4v_1insn_patch, "ax"
164 stxa %g2, [%g3] ASI_MMU
170 ldda [%g1] ASI_BLK_S, %f0
171 ldda [%g1 + %g2] ASI_BLK_S, %f16
173 ldda [%g1] ASI_BLK_S, %f32
174 ldda [%g1 + %g2] ASI_BLK_S, %f48
178 661: stxa %g5, [%g3] ASI_DMMU
179 .section .sun4v_1insn_patch, "ax"
181 stxa %g5, [%g3] ASI_MMU
187 ldx [%g6 + TI_XFSR], %fsr
189 or %g3, %g4, %g3 ! anal...
191 wr %g0, FPRS_FEF, %fprs ! clean DU/DL bits
193 .size do_fpdis,.-do_fpdis
196 .type fp_other_bounce,#function
199 add %sp, PTREGS_OFF, %o0
201 .size fp_other_bounce,.-fp_other_bounce
204 .globl do_fpother_check_fitos
205 .type do_fpother_check_fitos,#function
206 do_fpother_check_fitos:
207 TRAP_LOAD_THREAD_REG(%g6, %g1)
208 sethi %hi(fp_other_bounce - 4), %g7
209 or %g7, %lo(fp_other_bounce - 4), %g7
211 /* NOTE: Need to preserve %g7 until we fully commit
212 * to the fitos fixup.
214 stx %fsr, [%g6 + TI_XFSR]
216 andcc %g3, TSTATE_PRIV, %g0
217 bne,pn %xcc, do_fptrap_after_fsr
219 ldx [%g6 + TI_XFSR], %g3
222 cmp %g1, 2 ! Unfinished FP-OP
223 bne,pn %xcc, do_fptrap_after_fsr
224 sethi %hi(1 << 23), %g1 ! Inexact
226 bne,pn %xcc, do_fptrap_after_fsr
228 lduwa [%g1] ASI_AIUP, %g3 ! This cannot ever fail
229 #define FITOS_MASK 0xc1f83fe0
230 #define FITOS_COMPARE 0x81a01880
231 sethi %hi(FITOS_MASK), %g1
232 or %g1, %lo(FITOS_MASK), %g1
234 sethi %hi(FITOS_COMPARE), %g2
235 or %g2, %lo(FITOS_COMPARE), %g2
237 bne,pn %xcc, do_fptrap_after_fsr
239 std %f62, [%g6 + TI_FPREGS + (62 * 4)]
240 sethi %hi(fitos_table_1), %g1
242 or %g1, %lo(fitos_table_1), %g1
245 ba,pt %xcc, fitos_emul_continue
282 sethi %hi(fitos_table_2), %g1
284 or %g1, %lo(fitos_table_2), %g1
288 ba,pt %xcc, fitos_emul_fini
325 ldd [%g6 + TI_FPREGS + (62 * 4)], %f62
327 .size do_fpother_check_fitos,.-do_fpother_check_fitos
331 .type do_fptrap,#function
333 TRAP_LOAD_THREAD_REG(%g6, %g1)
334 stx %fsr, [%g6 + TI_XFSR]
336 ldub [%g6 + TI_FPSAVED], %g3
339 stb %g3, [%g6 + TI_FPSAVED]
341 stx %g3, [%g6 + TI_GSR]
342 mov SECONDARY_CONTEXT, %g3
344 661: ldxa [%g3] ASI_DMMU, %g5
345 .section .sun4v_1insn_patch, "ax"
347 ldxa [%g3] ASI_MMU, %g5
350 sethi %hi(sparc64_kern_sec_context), %g2
351 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
353 661: stxa %g2, [%g3] ASI_DMMU
354 .section .sun4v_1insn_patch, "ax"
356 stxa %g2, [%g3] ASI_MMU
360 add %g6, TI_FPREGS, %g2
361 andcc %g1, FPRS_DL, %g0
364 stda %f0, [%g2] ASI_BLK_S
365 stda %f16, [%g2 + %g3] ASI_BLK_S
366 andcc %g1, FPRS_DU, %g0
369 stda %f32, [%g2] ASI_BLK_S
370 stda %f48, [%g2 + %g3] ASI_BLK_S
371 5: mov SECONDARY_CONTEXT, %g1
374 661: stxa %g5, [%g1] ASI_DMMU
375 .section .sun4v_1insn_patch, "ax"
377 stxa %g5, [%g1] ASI_MMU
383 .size do_fptrap,.-do_fptrap