1 /* $Id: VISsave.S,v 1.4 1999/07/30 09:35:37 davem Exp $
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>
15 .globl VISenter, VISenterhalf
17 /* On entry: %o5=current FPRS value, %g7 is callers address */
18 /* May clobber %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
22 ldub [%g6 + AOFF_task_thread + AOFF_thread_fpdepth], %g1
25 stb %g0, [%g6 + AOFF_task_thread + AOFF_thread_fpsaved]
26 stx %fsr, [%g6 + AOFF_task_thread + AOFF_thread_xfsr]
27 9: jmpl %g7 + %g0, %g0
32 vis1: ldub [%g6 + AOFF_task_thread + AOFF_thread_fpsaved], %g3
33 stx %fsr, [%g6 + AOFF_task_thread + AOFF_thread_xfsr]
35 stb %g3, [%g6 + AOFF_task_thread + AOFF_thread_fpsaved]
40 stb %g3, [%g6 + AOFF_task_thread + AOFF_thread_gsr]
45 stb %o5, [%g3 + AOFF_task_thread + AOFF_thread_fpsaved]
47 stb %g2, [%g3 + AOFF_task_thread + AOFF_thread_gsr]
50 stx %fsr, [%g2 + AOFF_task_thread + AOFF_thread_xfsr]
52 3: andcc %o5, FPRS_DL|FPRS_DU, %g0
54 add %g6, AOFF_task_fpregs, %g2
55 andcc %o5, FPRS_DL, %g0
56 membar #StoreStore | #LoadStore
59 add %g6, AOFF_task_fpregs+0x40, %g3
60 stda %f0, [%g2 + %g1] ASI_BLK_P
61 stda %f16, [%g3 + %g1] ASI_BLK_P
62 andcc %o5, FPRS_DU, %g0
65 stda %f32, [%g2 + %g1] ASI_BLK_P
67 stda %f48, [%g3 + %g1] ASI_BLK_P
72 6: ldub [%g3 + AOFF_task_thread + AOFF_thread_fpsaved], %o5
74 add %g6, AOFF_task_fpregs+0x80, %g2
75 stb %o5, [%g3 + AOFF_task_thread + AOFF_thread_fpsaved]
78 add %g6, AOFF_task_fpregs+0xc0, %g3
79 wr %g0, FPRS_FEF, %fprs
80 membar #StoreStore | #LoadStore
81 stda %f32, [%g2 + %g1] ASI_BLK_P
82 stda %f48, [%g3 + %g1] ASI_BLK_P
90 ldub [%g6 + AOFF_task_thread + AOFF_thread_fpdepth], %g1
93 stb %g0, [%g6 + AOFF_task_thread + AOFF_thread_fpsaved]
94 stx %fsr, [%g6 + AOFF_task_thread + AOFF_thread_xfsr]
97 wr %g0, FPRS_FEF, %fprs
103 2: addcc %g6, %g1, %g3
105 andn %o5, FPRS_DU, %g2
106 stb %g2, [%g3 + AOFF_task_thread + AOFF_thread_fpsaved]
109 stb %g2, [%g3 + AOFF_task_thread + AOFF_thread_gsr]
111 stx %fsr, [%g2 + AOFF_task_thread + AOFF_thread_xfsr]
113 3: andcc %o5, FPRS_DL, %g0
115 add %g6, AOFF_task_fpregs, %g2
117 membar #StoreStore | #LoadStore
118 add %g6, AOFF_task_fpregs+0x40, %g3
119 stda %f0, [%g2 + %g1] ASI_BLK_P
120 stda %f16, [%g3 + %g1] ASI_BLK_P
122 4: and %o5, FPRS_DU, %o5
124 wr %o5, FPRS_FEF, %fprs