[kvm-unit-tests PATCH v5 3/4] s390x: lib: add SPX and STPX instruction wrapper

Claudio Imbrenda
2020-01-08T16:13:27Z

Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and
use it instead of using inline assembly everywhere.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
lib/s390x/asm/arch_def.h | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 1a5e3c6..38c9dfa 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -284,4 +284,17 @@ static inline int servc(uint32_t command, unsigned long sccb)
return cc;
}

+static inline void spx(uint32_t new_prefix)
+{
+ asm volatile("spx %0" : : "Q" (new_prefix) : "memory");
+}
+
+static inline uint32_t stpx(void)
+{
+ uint32_t prefix;
+
+ asm volatile("stpx %0" : "=Q" (prefix));
+ return prefix;
+}
+
#endif
--
2.24.1