]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
A SSE2 only CPU was reported to the guest as a SSE3 CPU.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 17 Jun 2015 21:33:19 +0000 (21:33 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 17 Jun 2015 21:33:19 +0000 (21:33 +0000)
The guest code might then select functions calling invalid
instructions.
E.G. giving:
  vex x86->IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xF
  ==13094== valgrind: Unrecognised instruction at address 0x496d4d3.
  ==13094==    at 0x496D4D3: __mempcpy_ssse3 (memcpy-ssse3.S:771)
  ==13094==    by 0x125E0B: ??? (in /bin/dash)
as the host hw cap is not SSE3 enabled, while the guest believes
SSE3 can be used.

So, change CPUID so as to report an SSE3 if the hw is SSE3,
and otherwise SSE1 or lower.

(an SSE2 cpu might be added later on)

git-svn-id: svn://svn.valgrind.org/vex/trunk@3153

VEX/priv/guest_x86_defs.h
VEX/priv/guest_x86_helpers.c
VEX/priv/guest_x86_toIR.c

index 412ee94007921f22eb95acbd5eb6c368b52cfc03..0b5a1a641241244f68920622fed4c98709a34632 100644 (file)
@@ -147,7 +147,7 @@ extern void  x86g_dirtyhelper_storeF80le ( Addr, ULong );
 extern void  x86g_dirtyhelper_CPUID_sse0 ( VexGuestX86State* );
 extern void  x86g_dirtyhelper_CPUID_mmxext ( VexGuestX86State* );
 extern void  x86g_dirtyhelper_CPUID_sse1 ( VexGuestX86State* );
-extern void  x86g_dirtyhelper_CPUID_sse2 ( VexGuestX86State* );
+extern void  x86g_dirtyhelper_CPUID_sse3 ( VexGuestX86State* );
 
 extern void  x86g_dirtyhelper_FINIT ( VexGuestX86State* );
 
index b4875ee9f9a43fa5e0ad3092fb7c29b911d71d7b..035d229778dc5455add0ce84fed9a0a3ad892059 100644 (file)
@@ -2324,7 +2324,7 @@ void x86g_dirtyhelper_CPUID_sse1 ( VexGuestX86State* st )
    address sizes   : 36 bits physical, 48 bits virtual
    power management:
 */
-void x86g_dirtyhelper_CPUID_sse2 ( VexGuestX86State* st )
+void x86g_dirtyhelper_CPUID_sse3 ( VexGuestX86State* st )
 {
 #  define SET_ABCD(_a,_b,_c,_d)               \
       do { st->guest_EAX = (UInt)(_a);        \
index fc402cea940800ce6ac43795f7f4c7d91c3fc982..bcddea5b5999d3e867a0feca5de545f5f1ca5d0c 100644 (file)
@@ -14842,9 +14842,9 @@ DisResult disInstr_X86_WRK (
          IRDirty* d     = NULL;
          void*    fAddr = NULL;
          const HChar* fName = NULL;
-         if (archinfo->hwcaps & VEX_HWCAPS_X86_SSE2) {
-            fName = "x86g_dirtyhelper_CPUID_sse2";
-            fAddr = &x86g_dirtyhelper_CPUID_sse2
+         if (archinfo->hwcaps & VEX_HWCAPS_X86_SSE3) {
+            fName = "x86g_dirtyhelper_CPUID_sse3";
+            fAddr = &x86g_dirtyhelper_CPUID_sse3
          } 
          else
          if (archinfo->hwcaps & VEX_HWCAPS_X86_SSE1) {