From patchwork Sat Nov 7 14:54:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 541331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 06D0D140B0F for ; Sun, 8 Nov 2015 01:55:31 +1100 (AEDT) Received: from localhost ([::1]:44157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv4tt-0007Jn-3R for incoming@patchwork.ozlabs.org; Sat, 07 Nov 2015 09:55:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv4tS-0006TR-8S for qemu-devel@nongnu.org; Sat, 07 Nov 2015 09:55:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zv4tR-0007zV-8z for qemu-devel@nongnu.org; Sat, 07 Nov 2015 09:55:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv4tR-0007zR-3h for qemu-devel@nongnu.org; Sat, 07 Nov 2015 09:55:01 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id B9D70A4502; Sat, 7 Nov 2015 14:55:00 +0000 (UTC) Received: from localhost ([10.3.113.2]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA7Esxvv031199; Sat, 7 Nov 2015 09:54:59 -0500 From: Eduardo Habkost To: Peter Maydell Date: Sat, 7 Nov 2015 12:54:50 -0200 Message-Id: <1446908092-13042-2-git-send-email-ehabkost@redhat.com> In-Reply-To: <1446908092-13042-1-git-send-email-ehabkost@redhat.com> References: <1446908092-13042-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , Richard Henderson , =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 1/3] target-i386: tcg: Accept clwb instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Accept the clwb instruction (66 0F AE /6) if its corresponding feature flag is enabled on CPUID[7]. Reviewed-by: Richard Henderson Signed-off-by: Eduardo Habkost --- target-i386/translate.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index b400d24..c6d9be6 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7716,10 +7716,21 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, } break; case 5: /* lfence */ - case 6: /* mfence */ if ((modrm & 0xc7) != 0xc0 || !(s->cpuid_features & CPUID_SSE2)) goto illegal_op; break; + case 6: /* mfence/clwb */ + if (s->prefix & PREFIX_DATA) { + /* clwb */ + if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_CLWB)) + goto illegal_op; + gen_nop_modrm(env, s, modrm); + } else { + /* mfence */ + if ((modrm & 0xc7) != 0xc0 || !(s->cpuid_features & CPUID_SSE2)) + goto illegal_op; + } + break; case 7: /* sfence / clflush */ if ((modrm & 0xc7) == 0xc0) { /* sfence */