mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-17 12:30:29 -05:00
While the GCC and Clang compilers already define __ASSEMBLER__ automatically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel. This can be very confusing when switching between userspace and kernelspace coding, or when dealing with uapi headers that rather should use __ASSEMBLER__ instead. So let's standardize on the __ASSEMBLER__ macro that is provided by the compilers now. This is a completely mechanical patch (done with a simple "sed -i" statement). Cc: David S. Miller <davem@davemloft.net> Cc: Andreas Larsson <andreas@gaisler.com> Cc: sparclinux@vger.kernel.org Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Andreas Larsson <andreas@gaisler.com>
68 lines
1.5 KiB
C
68 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#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 \
|
|
VISEntry
|
|
|
|
#define VISExitHalf \
|
|
VISExit
|
|
|
|
#define VISEntryHalfFast(fail_label) \
|
|
rd %fprs, %o5; \
|
|
andcc %o5, FPRS_FEF, %g0; \
|
|
be,pt %icc, 297f; \
|
|
nop; \
|
|
ba,a,pt %xcc, fail_label; \
|
|
297: wr %o5, FPRS_FEF, %fprs;
|
|
|
|
#define VISExitHalfFast \
|
|
wr %o5, 0, %fprs;
|
|
|
|
#ifndef __ASSEMBLER__
|
|
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");
|
|
}
|
|
|
|
int vis_emul(struct pt_regs *, unsigned int);
|
|
#endif
|
|
|
|
#endif /* _SPARC64_ASI_H */
|