2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 11:44:01 +08:00
linux-next/include/asm-sparc64/visasm.h
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00

64 lines
1.5 KiB
C

/* $Id: visasm.h,v 1.5 2001/04/24 01:09:12 davem Exp $ */
#ifndef _SPARC64_VISASM_H
#define _SPARC64_VISASM_H
/* visasm.h: FPU saving macros for VIS routines
*
* Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
*/
#include <asm/pstate.h>
#include <asm/ptrace.h>
/* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
#define VISEntry \
rd %fprs, %o5; \
andcc %o5, (FPRS_FEF|FPRS_DU), %g0; \
be,pt %icc, 297f; \
sethi %hi(297f), %g7; \
sethi %hi(VISenter), %g1; \
jmpl %g1 + %lo(VISenter), %g0; \
or %g7, %lo(297f), %g7; \
297: wr %g0, FPRS_FEF, %fprs; \
#define VISExit \
wr %g0, 0, %fprs;
/* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc.
* Must preserve %o5 between VISEntryHalf and VISExitHalf */
#define VISEntryHalf \
rd %fprs, %o5; \
andcc %o5, FPRS_FEF, %g0; \
be,pt %icc, 297f; \
sethi %hi(298f), %g7; \
sethi %hi(VISenterhalf), %g1; \
jmpl %g1 + %lo(VISenterhalf), %g0; \
or %g7, %lo(298f), %g7; \
clr %o5; \
297: wr %o5, FPRS_FEF, %fprs; \
298:
#define VISExitHalf \
wr %o5, 0, %fprs;
#ifndef __ASSEMBLY__
static __inline__ void save_and_clear_fpu(void) {
__asm__ __volatile__ (
" rd %%fprs, %%o5\n"
" andcc %%o5, %0, %%g0\n"
" be,pt %%icc, 299f\n"
" sethi %%hi(298f), %%g7\n"
" sethi %%hi(VISenter), %%g1\n"
" jmpl %%g1 + %%lo(VISenter), %%g0\n"
" or %%g7, %%lo(298f), %%g7\n"
" 298: wr %%g0, 0, %%fprs\n"
" 299:\n"
" " : : "i" (FPRS_FEF|FPRS_DU) :
"o5", "g1", "g2", "g3", "g7", "cc");
}
#endif
#endif /* _SPARC64_ASI_H */