Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JjU06-0007Nj-Ae for qemu-devel@nongnu.org; Wed, 09 Apr 2008 02:41:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JjU04-0007Lk-LB for qemu-devel@nongnu.org; Wed, 09 Apr 2008 02:41:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JjU04-0007LU-GV for qemu-devel@nongnu.org; Wed, 09 Apr 2008 02:41:40 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JjU03-0003kn-VV for qemu-devel@nongnu.org; Wed, 09 Apr 2008 02:41:40 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1JjU02-0002Dn-CO for qemu-devel@nongnu.org; Wed, 09 Apr 2008 06:41:38 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1JjU01-0002Dg-V5 for qemu-devel@nongnu.org; Wed, 09 Apr 2008 06:41:38 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Wed, 09 Apr 2008 06:41:38 +0000 Subject: [Qemu-devel] [4184] Check for 3DNow! CPUID at translation time Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4184 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4184 Author: aurel32 Date: 2008-04-09 06:41:37 +0000 (Wed, 09 Apr 2008) Log Message: ----------- Check for 3DNow! CPUID at translation time Modified Paths: -------------- trunk/target-i386/translate.c Modified: trunk/target-i386/translate.c =================================================================== --- trunk/target-i386/translate.c 2008-04-08 20:01:34 UTC (rev 4183) +++ trunk/target-i386/translate.c 2008-04-09 06:41:37 UTC (rev 4184) @@ -100,6 +100,7 @@ int rip_offset; /* only used in x86_64, but left for simplicity */ int cpuid_features; int cpuid_ext_features; + int cpuid_ext2_features; } DisasContext; static void gen_eob(DisasContext *s); @@ -2649,11 +2650,18 @@ } if (is_xmm && !(s->flags & HF_OSFXSR_MASK)) goto illegal_op; - if (b == 0x77 || b == 0x0e) { - /* emms or femms */ + if (b == 0x0e) { + if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) + goto illegal_op; + /* femms */ gen_op_emms(); return; } + if (b == 0x77) { + /* emms */ + gen_op_emms(); + return; + } /* prepare MMX state (XXX: optimize by storing fptt and fptags in the static cpu state) */ if (!is_xmm) { @@ -3183,6 +3191,8 @@ } switch(b) { case 0x0f: /* 3DNow! data insns */ + if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) + goto illegal_op; val = ldub_code(s->pc++); sse_op2 = sse_op_table5[val]; if (!sse_op2) @@ -6757,6 +6767,7 @@ } dc->cpuid_features = env->cpuid_features; dc->cpuid_ext_features = env->cpuid_ext_features; + dc->cpuid_ext2_features = env->cpuid_ext2_features; #ifdef TARGET_X86_64 dc->lma = (flags >> HF_LMA_SHIFT) & 1; dc->code64 = (flags >> HF_CS64_SHIFT) & 1;