diff options
| author | Heiko Carstens <[email protected]> | 2024-02-03 11:45:06 +0100 |
|---|---|---|
| committer | Heiko Carstens <[email protected]> | 2024-02-16 14:30:15 +0100 |
| commit | f4e3de75d0c4ebe9bbbfef19d7845ee70cb017bd (patch) | |
| tree | 0a2fde7fc7d1943631784242226ce9ba5019705f /arch/s390/include | |
| parent | 88d8136a0896e32fc39f90788eaa5c7bdccc9fb0 (diff) | |
s390/fpu: provide and use lfpc, sfpc, and stfpc inline assemblies
Instead of open-coding lfpc, sfpc, and stfpc inline assemblies at
several locations, provide an fpu_* function for each instruction and
use the function instead.
Reviewed-by: Claudio Imbrenda <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
Diffstat (limited to 'arch/s390/include')
| -rw-r--r-- | arch/s390/include/asm/fpu-insn.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/s390/include/asm/fpu-insn.h b/arch/s390/include/asm/fpu-insn.h index 1ce8e2f9786c..df2cad95b598 100644 --- a/arch/s390/include/asm/fpu-insn.h +++ b/arch/s390/include/asm/fpu-insn.h @@ -45,6 +45,15 @@ static __always_inline void fpu_ld(unsigned short fpr, freg_t *reg) : "memory"); } +static __always_inline void fpu_lfpc(unsigned int *fpc) +{ + instrument_read(fpc, sizeof(*fpc)); + asm volatile("lfpc %[fpc]" + : + : [fpc] "Q" (*fpc) + : "memory"); +} + /** * fpu_lfpc_safe - Load floating point control register safely. * @fpc: new value for floating point control register @@ -82,5 +91,22 @@ static __always_inline void fpu_std(unsigned short fpr, freg_t *reg) : "memory"); } +static __always_inline void fpu_sfpc(unsigned int fpc) +{ + asm volatile("sfpc %[fpc]" + : + : [fpc] "d" (fpc) + : "memory"); +} + +static __always_inline void fpu_stfpc(unsigned int *fpc) +{ + instrument_write(fpc, sizeof(*fpc)); + asm volatile("stfpc %[fpc]" + : [fpc] "=Q" (*fpc) + : + : "memory"); +} + #endif /* __ASSEMBLY__ */ #endif /* __ASM_S390_FPU_INSN_H */ |