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 b,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,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
202 .size fp_other_bounce,.-fp_other_bounce
205 .globl do_fpother_check_fitos
206 .type do_fpother_check_fitos,#function
207 do_fpother_check_fitos:
208 TRAP_LOAD_THREAD_REG(%g6, %g1)
209 sethi %hi(fp_other_bounce - 4), %g7
210 or %g7, %lo(fp_other_bounce - 4), %g7
212 /* NOTE: Need to preserve %g7 until we fully commit
213 * to the fitos fixup.
215 stx %fsr, [%g6 + TI_XFSR]
217 andcc %g3, TSTATE_PRIV, %g0
218 bne,pn %xcc, do_fptrap_after_fsr
220 ldx [%g6 + TI_XFSR], %g3
223 cmp %g1, 2 ! Unfinished FP-OP
224 bne,pn %xcc, do_fptrap_after_fsr
225 sethi %hi(1 << 23), %g1 ! Inexact
227 bne,pn %xcc, do_fptrap_after_fsr
229 lduwa [%g1] ASI_AIUP, %g3 ! This cannot ever fail
230 #define FITOS_MASK 0xc1f83fe0
231 #define FITOS_COMPARE 0x81a01880
232 sethi %hi(FITOS_MASK), %g1
233 or %g1, %lo(FITOS_MASK), %g1
235 sethi %hi(FITOS_COMPARE), %g2
236 or %g2, %lo(FITOS_COMPARE), %g2
238 bne,pn %xcc, do_fptrap_after_fsr
240 std %f62, [%g6 + TI_FPREGS + (62 * 4)]
241 sethi %hi(fitos_table_1), %g1
243 or %g1, %lo(fitos_table_1), %g1
246 ba,pt %xcc, fitos_emul_continue
283 sethi %hi(fitos_table_2), %g1
285 or %g1, %lo(fitos_table_2), %g1
289 ba,pt %xcc, fitos_emul_fini
326 ldd [%g6 + TI_FPREGS + (62 * 4)], %f62
328 .size do_fpother_check_fitos,.-do_fpother_check_fitos
332 .type do_fptrap,#function
334 TRAP_LOAD_THREAD_REG(%g6, %g1)
335 stx %fsr, [%g6 + TI_XFSR]
337 ldub [%g6 + TI_FPSAVED], %g3
340 stb %g3, [%g6 + TI_FPSAVED]
342 stx %g3, [%g6 + TI_GSR]
343 mov SECONDARY_CONTEXT, %g3
345 661: ldxa [%g3] ASI_DMMU, %g5
346 .section .sun4v_1insn_patch, "ax"
348 ldxa [%g3] ASI_MMU, %g5
351 sethi %hi(sparc64_kern_sec_context), %g2
352 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
354 661: stxa %g2, [%g3] ASI_DMMU
355 .section .sun4v_1insn_patch, "ax"
357 stxa %g2, [%g3] ASI_MMU
361 add %g6, TI_FPREGS, %g2
362 andcc %g1, FPRS_DL, %g0
365 stda %f0, [%g2] ASI_BLK_S
366 stda %f16, [%g2 + %g3] ASI_BLK_S
367 andcc %g1, FPRS_DU, %g0
370 stda %f32, [%g2] ASI_BLK_S
371 stda %f48, [%g2 + %g3] ASI_BLK_S
372 5: mov SECONDARY_CONTEXT, %g1
375 661: stxa %g5, [%g1] ASI_DMMU
376 .section .sun4v_1insn_patch, "ax"
378 stxa %g5, [%g1] ASI_MMU
384 .size do_fptrap,.-do_fptrap