Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mom1U-0003sa-79 for qemu-devel@nongnu.org; Fri, 18 Sep 2009 18:33:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mom1P-0003lB-Ao for qemu-devel@nongnu.org; Fri, 18 Sep 2009 18:33:47 -0400 Received: from [199.232.76.173] (port=38475 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mom1P-0003kl-4G for qemu-devel@nongnu.org; Fri, 18 Sep 2009 18:33:43 -0400 Received: from va3ehsobe004.messaging.microsoft.com ([216.32.180.14]:52859 helo=VA3EHSOBE004.bigfish.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.60) (envelope-from ) id 1Mom1O-0003Aq-QI for qemu-devel@nongnu.org; Fri, 18 Sep 2009 18:33:42 -0400 Received: from mail132-va3 (localhost.localdomain [127.0.0.1]) by mail132-va3-R.bigfish.com (Postfix) with ESMTP id B80AC1B7810E for ; Fri, 18 Sep 2009 22:33:41 +0000 (UTC) Received: from ausb3extmailp02.amd.com (ausb3extmailp02.amd.com [163.181.251.22]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail132-va3.bigfish.com (Postfix) with ESMTP id 78CBC1058052 for ; Fri, 18 Sep 2009 22:33:40 +0000 (UTC) Received: from ausb3twp01.amd.com (ausb3twp01.amd.com [163.181.250.37]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with ESMTP id n8IMXa4K031018 for ; Fri, 18 Sep 2009 17:33:39 -0500 Received: from sausexbh2.amd.com (SAUSEXBH2.amd.com [163.181.22.102]) by ausb3twp01.amd.com (Tumbleweed MailGate 3.7.0) with ESMTP id 2B3B81028508 for ; Fri, 18 Sep 2009 17:33:35 -0500 (CDT) From: Andre Przywara Date: Sat, 19 Sep 2009 00:30:47 +0200 Message-ID: <1253313049-25874-3-git-send-email-andre.przywara@amd.com> In-Reply-To: <1253313049-25874-1-git-send-email-andre.przywara@amd.com> References: <1253313049-25874-1-git-send-email-andre.przywara@amd.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 2/4] TCG x86: add lock mov cr0 = cr8 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Andre Przywara AMD CPUs featuring a shortcut to access CR8 even from 32-bit mode. If you use the LOCK prefix with "mov CR0", it accesses CR8 instead. This behavior is guarded by the CR8_LEGACY CPUID bit (Fn8000_0001:ECX[1]). Signed-off-by: Andre Przywara --- target-i386/translate.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index aaa4492..134c870 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7362,6 +7362,10 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) ot = OT_QUAD; else ot = OT_LONG; + if ((prefixes & PREFIX_LOCK) && (reg == 0) && + (s->cpuid_ext3_features & CPUID_EXT3_CR8LEG)) { + reg = 8; + } switch(reg) { case 0: case 2: -- 1.6.1.3