From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu5YP-0000IQ-Uc for qemu-devel@nongnu.org; Wed, 04 Nov 2015 16:25:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zu5YP-0006jb-3W for qemu-devel@nongnu.org; Wed, 04 Nov 2015 16:25:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu5YO-0006jW-Vi for qemu-devel@nongnu.org; Wed, 04 Nov 2015 16:25:13 -0500 From: Eduardo Habkost Date: Wed, 4 Nov 2015 19:24:46 -0200 Message-Id: <1446672286-9136-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1446672286-9136-1-git-send-email-ehabkost@redhat.com> References: <1446672286-9136-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] target-i386: tcg: Check right CPUID bits for clflushopt/pcommit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Xiao Guangrong , kvm@vger.kernel.org, Richard Henderson Detect the clflushopt and pcommit instructions and check their corresponding feature flags, instead of checking CPUID_SSE and CPUID_CLFLUSH. Signed-off-by: Eduardo Habkost --- target-i386/translate.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index bac1685..a938967 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7731,16 +7731,28 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, goto illegal_op; } break; - case 7: /* sfence / clflush */ + case 7: /* sfence / clflush / clflushopt / pcommit */ if ((modrm & 0xc7) == 0xc0) { - /* sfence */ - /* XXX: also check for cpuid_ext2_features & CPUID_EXT2_EMMX */ - if (!(s->cpuid_features & CPUID_SSE)) - goto illegal_op; + if (s->prefix & PREFIX_DATA) { + /* pcommit */ + if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_PCOMMIT)) + goto illegal_op; + } else { + /* sfence */ + /* XXX: also check for cpuid_ext2_features & CPUID_EXT2_EMMX */ + if (!(s->cpuid_features & CPUID_SSE)) + goto illegal_op; + } } else { - /* clflush */ - if (!(s->cpuid_features & CPUID_CLFLUSH)) - goto illegal_op; + if (s->prefix & PREFIX_DATA) { + /* clflushopt */ + if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_CLFLUSHOPT)) + goto illegal_op; + } else { + /* clflush */ + if (!(s->cpuid_features & CPUID_CLFLUSH)) + goto illegal_op; + } gen_lea_modrm(env, s, modrm); } break; -- 2.1.0