make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / include / asm-sparc64 / visasm.h
1 /* $Id: visasm.h,v 1.1.1.1 2005/04/11 02:50:57 jack Exp $ */
2 #ifndef _SPARC64_VISASM_H
3 #define _SPARC64_VISASM_H
4
5 /* visasm.h:  FPU saving macros for VIS routines
6  *
7  * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
8  */
9  
10 #include <asm/pstate.h>
11 #include <asm/ptrace.h>
12
13 #define AOFF_task_fpregs        (((ASIZ_task) + (64 - 1)) & ~(64 - 1))
14  
15 /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
16
17 #define VISEntry                                        \
18         rd              %fprs, %o5;                     \
19         andcc           %o5, (FPRS_FEF|FPRS_DU), %g0;   \
20         be,pt           %icc, 297f;                     \
21          sethi          %hi(297f), %g7;                 \
22         ba,pt           %xcc, VISenter;                 \
23          or             %g7, %lo(297f), %g7;            \
24 297:    wr              %g0, FPRS_FEF, %fprs;           \
25
26 #define VISExit                                         \
27         wr              %g0, 0, %fprs;
28
29 /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc.
30  * Must preserve %o5 between VISEntryHalf and VISExitHalf */
31
32 #define VISEntryHalf                                    \
33         rd              %fprs, %o5;                     \
34         andcc           %o5, FPRS_FEF, %g0;             \
35         be,pt           %icc, 297f;                     \
36          sethi          %hi(298f), %g7;                 \
37         ba,pt           %xcc, VISenterhalf;             \
38          or             %g7, %lo(298f), %g7;            \
39         clr             %o5;                            \
40 297:    wr              %o5, FPRS_FEF, %fprs;           \
41 298:
42
43 #define VISExitHalf                                     \
44         wr              %o5, 0, %fprs;
45
46 #ifndef __ASSEMBLY__    
47 extern __inline__ void save_and_clear_fpu(void) {
48         __asm__ __volatile__ (
49 "               rd %%fprs, %%o5\n"
50 "               andcc %%o5, %0, %%g0\n"
51 "               be,pt %%icc, 299f\n"
52 "                sethi %%hi(298f), %%g7\n"
53 "               ba VISenter     ! Note. This cannot be bp, as it may be too far from VISenter.\n"
54 "                or %%g7, %%lo(298f), %%g7\n"
55 "       298:    wr %%g0, 0, %%fprs\n"
56 "       299:\n"
57 "               " : : "i" (FPRS_FEF|FPRS_DU) :
58                 "o5", "g1", "g2", "g3", "g7", "cc");
59 }
60 #endif
61
62 #endif /* _SPARC64_ASI_H */