target/i386: Fix decoding of certain BMI instructions
commit51909241d26fe6fe18a08def93ccc8273f61a8b3
authorDavid Greenaway <dgreenaway@google.com>
Thu, 14 Jan 2021 06:39:58 +0000 (14 17:39 +1100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 8 Feb 2021 13:43:55 +0000 (8 14:43 +0100)
treee200405d48819fda129209f21d2755a0a9adde8f
parente34e47eb28c0b8119be2e958450763701b38ac3a
target/i386: Fix decoding of certain BMI instructions

This patch fixes a translation bug for a subset of x86 BMI instructions
such as the following:

   c4 e2 f9 f7 c0                shlxq   %rax, %rax, %rax

Currently, these incorrectly generate an undefined instruction exception
when SSE is disabled via CR4, while instructions like "shrxq" work fine.

The problem appears to be related to BMI instructions encoded using VEX
and with a mandatory prefix of "0x66" (data). Instructions with this
data prefix (such as shlxq) are currently rejected. Instructions with
other mandatory prefixes (such as shrxq) translate as expected.

This patch removes the incorrect check in "gen_sse" that causes the
exception to be generated. For the non-BMI cases, the check is
redundant: prefixes are already checked at line 3696.

Buglink: https://bugs.launchpad.net/qemu/+bug/1748296
Signed-off-by: David Greenaway <dgreenaway@google.com>
Message-Id: <20210114063958.1508050-1-dgreenaway@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/tcg/translate.c