aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/s390x/lcbb.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-06-06 07:07:37 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-06-06 07:07:37 -0700
commit7ce5a15fa633c7683d4397a1213c13185ba64eba (patch)
tree084742c9ed36e97d40e1f372463a6b100dd46e6e /tests/tcg/s390x/lcbb.c
parent369081c4558e7e940fa36ce59bf17b2e390f55d3 (diff)
parent1fb9bdaf59719c0d0c28043e58c8e3452fd6d7de (diff)
downloadqemu-7ce5a15fa633c7683d4397a1213c13185ba64eba.zip
qemu-7ce5a15fa633c7683d4397a1213c13185ba64eba.tar.gz
qemu-7ce5a15fa633c7683d4397a1213c13185ba64eba.tar.bz2
Merge tag 'pull-request-2023-06-06' of https://gitlab.com/thuth/qemu into staging
* Fix emulated LCCB, LOCFHR, MXDB and MXDBR s390x instructions * Fix the malta machine on s390x (big endian) hosts * Emulate /proc/cpuinfo on s390x * Remove pointless QOM casts * Improve the inclusion logic for libkeyutils and ipmi-bt-test in meson.build # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmR+ycgRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbWXXw//WPz3ng50KLS+M1t3/ULEjO6XkGfP2LQZ # RsZq3hf9THFPZgcREk+6SQvttOSTuvHNfakfujS6U1Ou5thReWqLe4itFW6+hB5j # kQ+Sm6YJ+fpezkBnSefcUoL5nA9VVKZ6KE6kxq5CUBZNoIk1sSsfrU8y8wjzW0yg # 2nraOcG10aLpO2BfvKHVEAhJtwl9pHJsFANmHC2/h2wC9BZIAzdxiytzdcJ909gN # AAa0hIrLK/oFgJjkSSxu+QTaVGPARXqkx5WV546F/zmDMFUWd9nrXaegwqxjgPBN # m9Ua0SXll5hX2Z57vjJWlbTYkD+JUB22L0N7p5/xzhYRpLVSq1pdveo9psrzIC3E # Bt7chZB58acQepJHxxa3UHDOHcnfdfaN+Dd9wD29wHr7nK8lOcsen7/7V+5YXomc # qenkCtkpjKTl07OBxe6MDGZtPZYA8fK1CjEyYwHCe8QvxEzsyg96Bm3j4N2VPxQU # +f/sFPX7SgogZI4mB4wdoxOF1RmQ+DXQ2tnB970txZRkmFq2jJHpW86jkkbq2Jl1 # KIjgdIXjVgy+MPtuQzO5cT+jfhGQL7FQynGXHjv/UidBid5XD3TDVNa9AthN3Mng # +rPT90VJ7j9soMqvmNT1COSIRD+M49dQKBIQuq/gWplaTOHaAcJrCwYScwqe0u0P # zmjCNeuPVw8= # =dfJr # -----END PGP SIGNATURE----- # gpg: Signature made Mon 05 Jun 2023 10:53:12 PM PDT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [unknown] # gpg: aka "Thomas Huth <thuth@redhat.com>" [unknown] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2023-06-06' of https://gitlab.com/thuth/qemu: linux-user: Emulate /proc/cpuinfo on s390x linux-user/elfload: Introduce elf_hwcap_str() on s390x linux-user/elfload: Expose get_elf_hwcap() on s390x s390x/tcg: Fix CPU address returned by STIDP bulk: Remove pointless QOM casts scripts: Add qom-cast-macro-clean-cocci-gen.py hw/mips/malta: Fix the malta machine on big endian hosts gitlab-ci: Remove unused Python package tests/qtest: Run ipmi-bt-test only if CONFIG_IPMI_EXTERN is set tests/tcg/s390x: Test MXDB and MXDBR target/s390x: Fix MXDB and MXDBR Add conditional dependency for libkeyutils tests/tcg/s390x: Test single-stepping SVC linux-user/s390x: Fix single-stepping SVC tests/tcg/s390x: Test LOCFHR target/s390x: Fix LOCFHR taking the wrong half of R2 tests/tcg/s390x: Test LCBB target/s390x: Fix LCBB overwriting the top 32 bits Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/tcg/s390x/lcbb.c')
-rw-r--r--tests/tcg/s390x/lcbb.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/tcg/s390x/lcbb.c b/tests/tcg/s390x/lcbb.c
new file mode 100644
index 0000000..8d368e0
--- /dev/null
+++ b/tests/tcg/s390x/lcbb.c
@@ -0,0 +1,51 @@
+/*
+ * Test the LCBB instruction.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <stdlib.h>
+
+static inline __attribute__((__always_inline__)) void
+lcbb(long *r1, void *dxb2, int m3, int *cc)
+{
+ asm("lcbb %[r1],%[dxb2],%[m3]\n"
+ "ipm %[cc]"
+ : [r1] "+r" (*r1), [cc] "=r" (*cc)
+ : [dxb2] "R" (*(char *)dxb2), [m3] "i" (m3)
+ : "cc");
+ *cc = (*cc >> 28) & 3;
+}
+
+static char buf[0x1000] __attribute__((aligned(0x1000)));
+
+static inline __attribute__((__always_inline__)) void
+test_lcbb(void *p, int m3, int exp_r1, int exp_cc)
+{
+ long r1 = 0xfedcba9876543210;
+ int cc;
+
+ lcbb(&r1, p, m3, &cc);
+ assert(r1 == (0xfedcba9800000000 | exp_r1));
+ assert(cc == exp_cc);
+}
+
+int main(void)
+{
+ test_lcbb(&buf[0], 0, 16, 0);
+ test_lcbb(&buf[63], 0, 1, 3);
+ test_lcbb(&buf[0], 1, 16, 0);
+ test_lcbb(&buf[127], 1, 1, 3);
+ test_lcbb(&buf[0], 2, 16, 0);
+ test_lcbb(&buf[255], 2, 1, 3);
+ test_lcbb(&buf[0], 3, 16, 0);
+ test_lcbb(&buf[511], 3, 1, 3);
+ test_lcbb(&buf[0], 4, 16, 0);
+ test_lcbb(&buf[1023], 4, 1, 3);
+ test_lcbb(&buf[0], 5, 16, 0);
+ test_lcbb(&buf[2047], 5, 1, 3);
+ test_lcbb(&buf[0], 6, 16, 0);
+ test_lcbb(&buf[4095], 6, 1, 3);
+
+ return EXIT_SUCCESS;
+}