2 * VISsave.S: Code for saving FPU register state for
3 * VIS routines. One should not call this directly,
4 * but use macros provided in <asm/visasm.h>.
6 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
11 #include <asm/ptrace.h>
12 #include <asm/visasm.h>
13 #include <asm/thread_info.h>
16 .globl VISenter, VISenterhalf
18 /* On entry: %o5=current FPRS value, %g7 is callers address */
19 /* May clobber %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
21 /* Nothing special need be done here to handle pre-emption, this
22 * FPU save/restore mechanism is already preemption safe.
27 ldub [%g6 + TI_FPDEPTH], %g1
30 stb %g0, [%g6 + TI_FPSAVED]
31 stx %fsr, [%g6 + TI_XFSR]
32 9: jmpl %g7 + %g0, %g0
37 vis1: ldub [%g6 + TI_FPSAVED], %g3
38 stx %fsr, [%g6 + TI_XFSR]
40 stb %g3, [%g6 + TI_FPSAVED]
45 stx %g3, [%g6 + TI_GSR]
50 stb %o5, [%g3 + TI_FPSAVED]
53 stx %g2, [%g3 + TI_GSR]
56 stx %fsr, [%g2 + TI_XFSR]
58 3: andcc %o5, FPRS_DL|FPRS_DU, %g0
60 add %g6, TI_FPREGS, %g2
61 andcc %o5, FPRS_DL, %g0
64 add %g6, TI_FPREGS+0x40, %g3
66 stda %f0, [%g2 + %g1] ASI_BLK_P
67 stda %f16, [%g3 + %g1] ASI_BLK_P
69 andcc %o5, FPRS_DU, %g0
73 stda %f32, [%g2 + %g1] ASI_BLK_P
75 stda %f48, [%g3 + %g1] ASI_BLK_P
81 80: jmpl %g7 + %g0, %g0
84 6: ldub [%g3 + TI_FPSAVED], %o5
86 add %g6, TI_FPREGS+0x80, %g2
87 stb %o5, [%g3 + TI_FPSAVED]
90 add %g6, TI_FPREGS+0xc0, %g3
91 wr %g0, FPRS_FEF, %fprs
93 stda %f32, [%g2 + %g1] ASI_BLK_P
94 stda %f48, [%g3 + %g1] ASI_BLK_P
100 80: jmpl %g7 + %g0, %g0
105 ldub [%g6 + TI_FPDEPTH], %g1
108 stb %g0, [%g6 + TI_FPSAVED]
109 stx %fsr, [%g6 + TI_XFSR]
112 wr %g0, FPRS_FEF, %fprs
118 2: addcc %g6, %g1, %g3
120 andn %o5, FPRS_DU, %g2
121 stb %g2, [%g3 + TI_FPSAVED]
125 stx %g2, [%g3 + TI_GSR]
127 stx %fsr, [%g2 + TI_XFSR]
129 3: andcc %o5, FPRS_DL, %g0
131 add %g6, TI_FPREGS, %g2
133 add %g6, TI_FPREGS+0x40, %g3
135 stda %f0, [%g2 + %g1] ASI_BLK_P
136 stda %f16, [%g3 + %g1] ASI_BLK_P
142 4: and %o5, FPRS_DU, %o5
144 wr %o5, FPRS_FEF, %fprs