0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _ASM_S390_FPU_INTERNAL_H
0010 #define _ASM_S390_FPU_INTERNAL_H
0011
0012 #include <linux/string.h>
0013 #include <asm/ctl_reg.h>
0014 #include <asm/fpu/types.h>
0015
0016 static inline void save_vx_regs(__vector128 *vxrs)
0017 {
0018 asm volatile(
0019 " la 1,%0\n"
0020 " .word 0xe70f,0x1000,0x003e\n"
0021 " .word 0xe70f,0x1100,0x0c3e\n"
0022 : "=Q" (*(struct vx_array *) vxrs) : : "1");
0023 }
0024
0025 static inline void convert_vx_to_fp(freg_t *fprs, __vector128 *vxrs)
0026 {
0027 int i;
0028
0029 for (i = 0; i < __NUM_FPRS; i++)
0030 fprs[i] = *(freg_t *)(vxrs + i);
0031 }
0032
0033 static inline void convert_fp_to_vx(__vector128 *vxrs, freg_t *fprs)
0034 {
0035 int i;
0036
0037 for (i = 0; i < __NUM_FPRS; i++)
0038 *(freg_t *)(vxrs + i) = fprs[i];
0039 }
0040
0041 static inline void fpregs_store(_s390_fp_regs *fpregs, struct fpu *fpu)
0042 {
0043 fpregs->pad = 0;
0044 fpregs->fpc = fpu->fpc;
0045 if (MACHINE_HAS_VX)
0046 convert_vx_to_fp((freg_t *)&fpregs->fprs, fpu->vxrs);
0047 else
0048 memcpy((freg_t *)&fpregs->fprs, fpu->fprs,
0049 sizeof(fpregs->fprs));
0050 }
0051
0052 static inline void fpregs_load(_s390_fp_regs *fpregs, struct fpu *fpu)
0053 {
0054 fpu->fpc = fpregs->fpc;
0055 if (MACHINE_HAS_VX)
0056 convert_fp_to_vx(fpu->vxrs, (freg_t *)&fpregs->fprs);
0057 else
0058 memcpy(fpu->fprs, (freg_t *)&fpregs->fprs,
0059 sizeof(fpregs->fprs));
0060 }
0061
0062 #endif