1 /* $Id: visasm.h,v 1.5 2001/04/24 01:09:12 davem Exp $ */
2 #ifndef _SPARC64_VISASM_H
3 #define _SPARC64_VISASM_H
5 /* visasm.h: FPU saving macros for VIS routines
7 * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
10 #include <asm/pstate.h>
11 #include <asm/ptrace.h>
13 /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
17 andcc %o5, (FPRS_FEF|FPRS_DU), %g0; \
19 sethi %hi(297f), %g7; \
20 sethi %hi(VISenter), %g1; \
21 jmpl %g1 + %lo(VISenter), %g0; \
22 or %g7, %lo(297f), %g7; \
23 297: wr %g0, FPRS_FEF, %fprs; \
28 /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc.
29 * Must preserve %o5 between VISEntryHalf and VISExitHalf */
31 #define VISEntryHalf \
33 andcc %o5, FPRS_FEF, %g0; \
35 sethi %hi(298f), %g7; \
36 sethi %hi(VISenterhalf), %g1; \
37 jmpl %g1 + %lo(VISenterhalf), %g0; \
38 or %g7, %lo(298f), %g7; \
40 297: wr %o5, FPRS_FEF, %fprs; \
47 static __inline__
void save_and_clear_fpu(void) {
48 __asm__
__volatile__ (
50 " andcc %%o5, %0, %%g0\n"
51 " be,pt %%icc, 299f\n"
52 " sethi %%hi(298f), %%g7\n"
53 " sethi %%hi(VISenter), %%g1\n"
54 " jmpl %%g1 + %%lo(VISenter), %%g0\n"
55 " or %%g7, %%lo(298f), %%g7\n"
56 " 298: wr %%g0, 0, %%fprs\n"
58 " " : : "i" (FPRS_FEF
|FPRS_DU
) :
59 "o5", "g1", "g2", "g3", "g7", "cc");
63 #endif /* _SPARC64_ASI_H */