diff options
author | Pavel Zbitskiy <pavel.zbitskiy@gmail.com> | 2018-08-20 22:51:01 -0400 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2018-08-28 17:37:01 +0200 |
commit | 478d360cd937afe01a1234044ab04a26b73020be (patch) | |
tree | 972511fbff6d9bcc71d13811e7412ed6c9944cf7 /tests/tcg | |
parent | dc95b31dac65adb92256e67a5f0fc88ab37404c2 (diff) | |
download | qemu-478d360cd937afe01a1234044ab04a26b73020be.zip qemu-478d360cd937afe01a1234044ab04a26b73020be.tar.gz qemu-478d360cd937afe01a1234044ab04a26b73020be.tar.bz2 |
target/s390x: fix IPM polluting irrelevant bits
Suppose psw.mask=0x0000000080000000, cc=2, r1=0 and we do "ipm 1".
This command must touch only bits 32-39, so the expected output
is r1=0x20000000. However, currently qemu yields r1=0x20008000,
because irrelevant parts of PSW leak into r1 during program mask
transfer.
Signed-off-by: Pavel Zbitskiy <pavel.zbitskiy@gmail.com>
Message-Id: <20180821025104.19604-5-pavel.zbitskiy@gmail.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'tests/tcg')
-rw-r--r-- | tests/tcg/s390x/Makefile.target | 1 | ||||
-rw-r--r-- | tests/tcg/s390x/ipm.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target index f62f950..c800a58 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -2,3 +2,4 @@ VPATH+=$(SRC_PATH)/tests/tcg/s390x CFLAGS+=-march=zEC12 -m64 TESTS+=hello-s390x TESTS+=csst +TESTS+=ipm diff --git a/tests/tcg/s390x/ipm.c b/tests/tcg/s390x/ipm.c new file mode 100644 index 0000000..742f3a1 --- /dev/null +++ b/tests/tcg/s390x/ipm.c @@ -0,0 +1,22 @@ +#include <stdint.h> +#include <unistd.h> + +int main(void) +{ + uint32_t op1 = 0x55555555; + uint32_t op2 = 0x44444444; + uint64_t cc = 0xffffffffffffffffull; + + asm volatile( + " clc 0(4,%[op1]),0(%[op2])\n" + " ipm %[cc]\n" + : [cc] "+r" (cc) + : [op1] "r" (&op1), + [op2] "r" (&op2) + : "cc"); + if (cc != 0xffffffff20ffffffull) { + write(1, "bad cc\n", 7); + return 1; + } + return 0; +} |