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)
9 #include <linux/linkage.h>
13 #include <asm/ptrace.h>
14 #include <asm/visasm.h>
15 #include <asm/thread_info.h>
17 /* On entry: %o5=current FPRS value, %g7 is callers address */
18 /* May clobber %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
20 /* Nothing special need be done here to handle pre-emption, this
21 * FPU save/restore mechanism is already preemption safe.
26 ldub [%g6 + TI_FPDEPTH], %g1
29 stb %g0, [%g6 + TI_FPSAVED]
30 stx %fsr, [%g6 + TI_XFSR]
31 9: jmpl %g7 + %g0, %g0
36 vis1: ldub [%g6 + TI_FPSAVED], %g3
37 stx %fsr, [%g6 + TI_XFSR]
39 stb %g3, [%g6 + TI_FPSAVED]
44 stx %g3, [%g6 + TI_GSR]
46 mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5
48 stb %o5, [%g3 + TI_FPSAVED]
51 stx %g2, [%g3 + TI_GSR]
54 stx %fsr, [%g2 + TI_XFSR]
56 3: andcc %o5, FPRS_DL|FPRS_DU, %g0
58 add %g6, TI_FPREGS, %g2
59 andcc %o5, FPRS_DL, %g0
62 add %g6, TI_FPREGS+0x40, %g3
64 stda %f0, [%g2 + %g1] ASI_BLK_P
65 stda %f16, [%g3 + %g1] ASI_BLK_P
67 andcc %o5, FPRS_DU, %g0
71 stda %f32, [%g2 + %g1] ASI_BLK_P
73 stda %f48, [%g3 + %g1] ASI_BLK_P
79 80: jmpl %g7 + %g0, %g0