aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tcg/s390x/csst.c
diff options
context:
space:
mode:
authorTimos Ampelikiotis <t.ampelikiotis@virtualopensystems.com>2023-10-10 11:40:56 +0000
committerTimos Ampelikiotis <t.ampelikiotis@virtualopensystems.com>2023-10-10 11:40:56 +0000
commite02cda008591317b1625707ff8e115a4841aa889 (patch)
treeaee302e3cf8b59ec2d32ec481be3d1afddfc8968 /tests/tcg/s390x/csst.c
parentcc668e6b7e0ffd8c9d130513d12053cf5eda1d3b (diff)
Introduce Virtio-loopback epsilon release:
Epsilon release introduces a new compatibility layer which make virtio-loopback design to work with QEMU and rust-vmm vhost-user backend without require any changes. Signed-off-by: Timos Ampelikiotis <t.ampelikiotis@virtualopensystems.com> Change-Id: I52e57563e08a7d0bdc002f8e928ee61ba0c53dd9
Diffstat (limited to 'tests/tcg/s390x/csst.c')
-rw-r--r--tests/tcg/s390x/csst.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/tcg/s390x/csst.c b/tests/tcg/s390x/csst.c
new file mode 100644
index 000000000..084d80af4
--- /dev/null
+++ b/tests/tcg/s390x/csst.c
@@ -0,0 +1,43 @@
+#include <stdint.h>
+#include <unistd.h>
+
+int main(void)
+{
+ uint64_t parmlist[] __attribute__((aligned(16))) = {
+ 0xfedcba9876543210ull,
+ 0,
+ 0x7777777777777777ull,
+ 0,
+ };
+ uint64_t op1 = 0x0123456789abcdefull;
+ uint64_t op2 = 0;
+ uint64_t op3 = op1;
+ uint64_t cc;
+
+ asm volatile(
+ " lghi %%r0,%[flags]\n"
+ " la %%r1,%[parmlist]\n"
+ " csst %[op1],%[op2],%[op3]\n"
+ " ipm %[cc]\n"
+ : [op1] "+m" (op1),
+ [op2] "+m" (op2),
+ [op3] "+r" (op3),
+ [cc] "=r" (cc)
+ : [flags] "K" (0x0301),
+ [parmlist] "m" (parmlist)
+ : "r0", "r1", "cc", "memory");
+ cc = (cc >> 28) & 3;
+ if (cc) {
+ write(1, "bad cc\n", 7);
+ return 1;
+ }
+ if (op1 != parmlist[0]) {
+ write(1, "bad op1\n", 8);
+ return 1;
+ }
+ if (op2 != parmlist[2]) {
+ write(1, "bad op2\n", 8);
+ return 1;
+ }
+ return 0;
+}