diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2024-02-03 13:45:05 +0300 |
---|---|---|
committer | Heiko Carstens <hca@linux.ibm.com> | 2024-02-16 16:30:14 +0300 |
commit | 88d8136a0896e32fc39f90788eaa5c7bdccc9fb0 (patch) | |
tree | f924af0bc42c320ea1e6734e5c58a44a38af20b6 /arch/s390/include/asm/fpu-insn.h | |
parent | 13a8a519cacf04e970907687dcb1e85c03073ba8 (diff) | |
download | linux-88d8136a0896e32fc39f90788eaa5c7bdccc9fb0.tar.xz |
s390/fpu: provide and use ld and std inline assemblies
Deduplicate the 64 ld and std inline assemblies. Provide an fpu inline
assembly for both instructions, and use them in the new save_fp_regs()
and load_fp_regs() helper functions.
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/include/asm/fpu-insn.h')
-rw-r--r-- | arch/s390/include/asm/fpu-insn.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/s390/include/asm/fpu-insn.h b/arch/s390/include/asm/fpu-insn.h index 64ba3d9bcd14..1ce8e2f9786c 100644 --- a/arch/s390/include/asm/fpu-insn.h +++ b/arch/s390/include/asm/fpu-insn.h @@ -36,6 +36,15 @@ asm(".include \"asm/fpu-insn-asm.h\"\n"); * barrier. */ +static __always_inline void fpu_ld(unsigned short fpr, freg_t *reg) +{ + instrument_read(reg, sizeof(*reg)); + asm volatile("ld %[fpr],%[reg]\n" + : + : [fpr] "I" (fpr), [reg] "Q" (reg->ui) + : "memory"); +} + /** * fpu_lfpc_safe - Load floating point control register safely. * @fpc: new value for floating point control register @@ -64,5 +73,14 @@ static inline void fpu_lfpc_safe(unsigned int *fpc) : "memory"); } +static __always_inline void fpu_std(unsigned short fpr, freg_t *reg) +{ + instrument_write(reg, sizeof(*reg)); + asm volatile("std %[fpr],%[reg]\n" + : [reg] "=Q" (reg->ui) + : [fpr] "I" (fpr) + : "memory"); +} + #endif /* __ASSEMBLY__ */ #endif /* __ASM_S390_FPU_INSN_H */ |