xref: /linux/arch/s390/include/asm/access-regs.h (revision f5c31bcf604db54470868f3118a60dc4a9ba8813)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright IBM Corp. 1999, 2024
4  */
5 
6 #ifndef __ASM_S390_ACCESS_REGS_H
7 #define __ASM_S390_ACCESS_REGS_H
8 
9 #include <linux/instrumented.h>
10 #include <asm/sigcontext.h>
11 
12 struct access_regs {
13 	unsigned int regs[NUM_ACRS];
14 };
15 
16 static inline void save_access_regs(unsigned int *acrs)
17 {
18 	struct access_regs *regs = (struct access_regs *)acrs;
19 
20 	instrument_write(regs, sizeof(*regs));
21 	asm volatile("stamy	0,15,%[regs]"
22 		     : [regs] "=QS" (*regs)
23 		     :
24 		     : "memory");
25 }
26 
27 static inline void restore_access_regs(unsigned int *acrs)
28 {
29 	struct access_regs *regs = (struct access_regs *)acrs;
30 
31 	instrument_read(regs, sizeof(*regs));
32 	asm volatile("lamy	0,15,%[regs]"
33 		     :
34 		     : [regs] "QS" (*regs)
35 		     : "memory");
36 }
37 
38 #endif /* __ASM_S390_ACCESS_REGS_H */
39