summaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/access-regs.h
blob: 1a6412d9f5ade36591413361141a35ac7d1f85c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright IBM Corp. 1999, 2024
 */

#ifndef __ASM_S390_ACCESS_REGS_H
#define __ASM_S390_ACCESS_REGS_H

#include <linux/instrumented.h>
#include <asm/sigcontext.h>

struct access_regs {
	unsigned int regs[NUM_ACRS];
};

static inline void save_access_regs(unsigned int *acrs)
{
	struct access_regs *regs = (struct access_regs *)acrs;

	instrument_write(regs, sizeof(*regs));
	asm volatile("stamy	0,15,%[regs]"
		     : [regs] "=QS" (*regs)
		     :
		     : "memory");
}

static inline void restore_access_regs(unsigned int *acrs)
{
	struct access_regs *regs = (struct access_regs *)acrs;

	instrument_read(regs, sizeof(*regs));
	asm volatile("lamy	0,15,%[regs]"
		     :
		     : [regs] "QS" (*regs)
		     : "memory");
}

#endif /* __ASM_S390_ACCESS_REGS_H */