1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* This is trivial with the new code... */
4 .type do_fpdis,#function
6 sethi %hi(TSTATE_PEF), %g4
12 andcc %g5, FPRS_FEF, %g0
16 /* Legal state when DCR_IFPOE is set in Cheetah %dcr. */
19 109: or %g7, %lo(109b), %g7
23 1: TRAP_LOAD_THREAD_REG(%g6, %g1)
24 ldub [%g6 + TI_FPSAVED], %g5
25 wr %g0, FPRS_FEF, %fprs
26 andcc %g5, FPRS_FEF, %g0
29 ldx [%g6 + TI_GSR], %g7
30 1: andcc %g5, FPRS_DL, %g0
33 andcc %g5, FPRS_DU, %g0
64 b,pt %xcc, fpdis_exit2
66 1: mov SECONDARY_CONTEXT, %g3
67 add %g6, TI_FPREGS + 0x80, %g1
71 661: ldxa [%g3] ASI_DMMU, %g5
72 .section .sun4v_1insn_patch, "ax"
74 ldxa [%g3] ASI_MMU, %g5
77 sethi %hi(sparc64_kern_sec_context), %g2
78 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
80 661: stxa %g2, [%g3] ASI_DMMU
81 .section .sun4v_1insn_patch, "ax"
83 stxa %g2, [%g3] ASI_MMU
87 add %g6, TI_FPREGS + 0xc0, %g2
91 ldda [%g1] ASI_BLK_S, %f32
92 ldda [%g2] ASI_BLK_S, %f48
104 ba,a,pt %xcc, fpdis_exit
106 2: andcc %g5, FPRS_DU, %g0
109 mov SECONDARY_CONTEXT, %g3
112 661: ldxa [%g3] ASI_DMMU, %g5
113 .section .sun4v_1insn_patch, "ax"
115 ldxa [%g3] ASI_MMU, %g5
118 add %g6, TI_FPREGS, %g1
119 sethi %hi(sparc64_kern_sec_context), %g2
120 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
122 661: stxa %g2, [%g3] ASI_DMMU
123 .section .sun4v_1insn_patch, "ax"
125 stxa %g2, [%g3] ASI_MMU
129 add %g6, TI_FPREGS + 0x40, %g2
130 faddd %f32, %f34, %f36
131 fmuld %f32, %f34, %f38
133 ldda [%g1] ASI_BLK_S, %f0
134 ldda [%g2] ASI_BLK_S, %f16
136 faddd %f32, %f34, %f40
137 fmuld %f32, %f34, %f42
138 faddd %f32, %f34, %f44
139 fmuld %f32, %f34, %f46
140 faddd %f32, %f34, %f48
141 fmuld %f32, %f34, %f50
142 faddd %f32, %f34, %f52
143 fmuld %f32, %f34, %f54
144 faddd %f32, %f34, %f56
145 fmuld %f32, %f34, %f58
146 faddd %f32, %f34, %f60
147 fmuld %f32, %f34, %f62
148 ba,a,pt %xcc, fpdis_exit
150 3: mov SECONDARY_CONTEXT, %g3
151 add %g6, TI_FPREGS, %g1
153 661: ldxa [%g3] ASI_DMMU, %g5
154 .section .sun4v_1insn_patch, "ax"
156 ldxa [%g3] ASI_MMU, %g5
159 sethi %hi(sparc64_kern_sec_context), %g2
160 ldx [%g2 + %lo(sparc64_kern_sec_context)], %g2
162 661: stxa %g2, [%g3] ASI_DMMU
163 .section .sun4v_1insn_patch, "ax"
165 stxa %g2, [%g3] ASI_MMU
171 ldda [%g1] ASI_BLK_S, %f0
172 ldda [%g1 + %g2] ASI_BLK_S, %f16
174 ldda [%g1] ASI_BLK_S, %f32
175 ldda [%g1 + %g2] ASI_BLK_S, %f48
179 661: stxa %g5, [%g3] ASI_DMMU
180 .section .sun4v_1insn_patch, "ax"
182 stxa %g5, [%g3] ASI_MMU
188 ldx [%g6 + TI_XFSR], %fsr
190 or %g3, %g4, %g3 ! anal...
192 wr %g0, FPRS_FEF, %fprs ! clean DU/DL bits
194 .size do_fpdis,.-do_fpdis
197 .type fp_other_bounce,#function
200 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