qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [4184] Check for 3DNow! CPUID at translation time


From: Aurelien Jarno
Subject: [Qemu-devel] [4184] Check for 3DNow! CPUID at translation time
Date: Wed, 09 Apr 2008 06:41:38 +0000

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;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]