1 /* SPDX-License-Identifier: GPL-2.0 */
3 * VISsave.S: Code for saving FPU register state for
4 * VIS routines. One should not call this directly,
5 * but use macros provided in <asm/visasm.h>.
7 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
10 #include <linux/linkage.h>
14 #include <asm/ptrace.h>
15 #include <asm/visasm.h>
16 #include <asm/thread_info.h>
17 #include <asm/export.h>
19 /* On entry: %o5=current FPRS value, %g7 is callers address */
20 /* May clobber %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
22 /* Nothing special need be done here to handle pre-emption, this
23 * FPU save/restore mechanism is already preemption safe.
28 ldub [%g6 + TI_FPDEPTH], %g1
31 stb %g0, [%g6 + TI_FPSAVED]
32 stx %fsr, [%g6 + TI_XFSR]
33 9: jmpl %g7 + %g0, %g0
38 vis1: ldub [%g6 + TI_FPSAVED], %g3
39 stx %fsr, [%g6 + TI_XFSR]
41 stb %g3, [%g6 + TI_FPSAVED]
46 stx %g3, [%g6 + TI_GSR]
48 mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5
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 EXPORT_SYMBOL(VISenter)