[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-7.2.3 41/45] target/i386: fix operand size for VCOMI/VUCOMI inst
From: |
Michael Tokarev |
Subject: |
[Stable-7.2.3 41/45] target/i386: fix operand size for VCOMI/VUCOMI instructions |
Date: |
Tue, 23 May 2023 13:17:18 +0300 |
From: Paolo Bonzini <pbonzini@redhat.com>
Compared to other SSE instructions, VUCOMISx and VCOMISx are different:
the single and double precision versions are distinguished through a
prefix, however they use no-prefix and 0x66 for SS and SD respectively.
Scalar values usually are associated with 0xF2 and 0xF3.
Because of these, they incorrectly perform a 128-bit memory load instead
of a 32- or 64-bit load. Fix this by writing a custom decoding function.
I tested that the reproducer is fixed and the test-avx output does not
change.
Reported-by: Gabriele Svelto <gsvelto@mozilla.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1637
Fixes: f8d19eec0d53 ("target/i386: reimplement 0x0f 0x28-0x2f, add AVX",
2022-10-18)
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 2b55e479e6fcbb466585fd25077a50c32e10dc3a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc
index 80c579164f..c2ee712561 100644
--- a/target/i386/tcg/decode-new.c.inc
+++ b/target/i386/tcg/decode-new.c.inc
@@ -782,6 +782,17 @@ static void decode_0F2D(DisasContext *s, CPUX86State *env,
X86OpEntry *entry, ui
*entry = *decode_by_prefix(s, opcodes_0F2D);
}
+static void decode_VxCOMISx(DisasContext *s, CPUX86State *env, X86OpEntry
*entry, uint8_t *b)
+{
+ /*
+ * VUCOMISx and VCOMISx are different and use no-prefix and 0x66 for SS
and SD
+ * respectively. Scalar values usually are associated with 0xF2 and 0xF3,
for
+ * which X86_VEX_REPScalar exists, but here it has to be decoded by hand.
+ */
+ entry->s1 = entry->s2 = (s->prefix & PREFIX_DATA ? X86_SIZE_sd :
X86_SIZE_ss);
+ entry->gen = (*b == 0x2E ? gen_VUCOMI : gen_VCOMI);
+}
+
static void decode_sse_unary(DisasContext *s, CPUX86State *env, X86OpEntry
*entry, uint8_t *b)
{
if (!(s->prefix & (PREFIX_REPZ | PREFIX_REPNZ))) {
@@ -870,8 +881,8 @@ static const X86OpEntry opcodes_0F[256] = {
[0x2B] = X86_OP_GROUP0(0F2B),
[0x2C] = X86_OP_GROUP0(0F2C),
[0x2D] = X86_OP_GROUP0(0F2D),
- [0x2E] = X86_OP_ENTRY3(VUCOMI, None,None, V,x, W,x, vex4 p_00_66),
- [0x2F] = X86_OP_ENTRY3(VCOMI, None,None, V,x, W,x, vex4 p_00_66),
+ [0x2E] = X86_OP_GROUP3(VxCOMISx, None,None, V,x, W,x, vex3 p_00_66), /*
VUCOMISS/SD */
+ [0x2F] = X86_OP_GROUP3(VxCOMISx, None,None, V,x, W,x, vex3 p_00_66), /*
VCOMISS/SD */
[0x38] = X86_OP_GROUP0(0F38),
[0x3a] = X86_OP_GROUP0(0F3A),
--
2.39.2
- [Stable-7.2.3 v2 00/42] Patch Round-up for stable 7.2.3, freeze on 2023-05-27, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 27/45] s390x/tcg: Fix LDER instruction format, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 34/45] linux-user: Fix mips fp64 executables loading, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 35/45] linux-user: fix getgroups/setgroups allocations, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 36/45] migration: Handle block device inactivation failures better, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 33/45] tests/docker: bump the xtensa base to debian:11-slim, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 39/45] target/arm: Fix vd == vm overlap in sve_ldff1_z, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 38/45] migration: Attempt disk reactivation in more failure scenarios, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 37/45] migration: Minor control flow simplification, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 40/45] scsi-generic: fix buffer overflow on block limits inquiry, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 41/45] target/i386: fix operand size for VCOMI/VUCOMI instructions,
Michael Tokarev <=
- [Stable-7.2.3 42/45] target/i386: fix avx2 instructions vzeroall and vpermdq, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 44/45] virtio-net: not enable vq reset feature unconditionally, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 43/45] vhost: fix possible wrap in SVQ descriptor ring, Michael Tokarev, 2023/05/23
- [Stable-7.2.3 45/45] virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_request, Michael Tokarev, 2023/05/23