1 /* $Id: visasm.h,v 1.4 1999/04/19 01:25:55 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 #define AOFF_task_fpregs (((ASIZ_task) + (64 - 1)) & ~(64 - 1))
15 /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
19 andcc %o5, (FPRS_FEF|FPRS_DU), %g0; \
21 sethi %hi(297f), %g7; \
22 ba,pt %xcc, VISenter; \
23 or %g7, %lo(297f), %g7; \
24 297: wr %g0, FPRS_FEF, %fprs; \
29 /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc.
30 * Must preserve %o5 between VISEntryHalf and VISExitHalf */
32 #define VISEntryHalf \
34 andcc %o5, FPRS_FEF, %g0; \
36 sethi %hi(298f), %g7; \
37 ba,pt %xcc, VISenterhalf; \
38 or %g7, %lo(298f), %g7; \
40 297: wr %o5, FPRS_FEF, %fprs; \
47 extern __inline__
void save_and_clear_fpu(void) {
48 __asm__
__volatile__ ("
52 sethi %%hi(298f), %%g7
53 ba VISenter ! Note. This cannot be bp, as it may be too far from VISenter.
54 or %%g7, %%lo(298f), %%g7
55 298: wr %%g0, 0, %%fprs
57 " : : "i" (FPRS_FEF
|FPRS_DU
) :
58 "o5", "g1", "g2", "g3", "g7", "cc");
62 #endif /* _SPARC64_ASI_H */