]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a nasty temporary kludge to CPUID that allows 64-bit MacOSX 10.10
authorJulian Seward <jseward@acm.org>
Tue, 11 Nov 2014 12:49:21 +0000 (12:49 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 11 Nov 2014 12:49:21 +0000 (12:49 +0000)
(Yosemite) to run, until such time as XSAVE and XRSTOR are implemented.
Detailed in the comments.  All other targets should be unaffected.

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

VEX/priv/guest_amd64_toIR.c

index 04efa78fd565158bd8cfea8bad05fa0f315605f1..20298fc7f9b8a2b02f847a0fc9cabe376d0ea847 100644 (file)
@@ -21434,13 +21434,33 @@ Long dis_ESC_0F (
             void amd64g_dirtyhelper_CPUID ( VexGuestAMD64State* )
          declared to mod rax, wr rbx, rcx, rdx
       */
-      IRDirty* d     = NULL;
-      const HChar*   fName = NULL;
-      void*    fAddr = NULL;
+      IRDirty*     d     = NULL;
+      const HChar* fName = NULL;
+      void*        fAddr = NULL;
+
+      /* JRS 2014-11-11: this a really horrible temp kludge to work
+         around the fact that the Yosemite (OSX 10.10)
+         /usr/lib/system/libdyld.dylib expects XSAVE/XRSTOR to be
+         implemented, because amd64g_dirtyhelper_CPUID_avx_and_cx16
+         claims they are supported, but so far they aren't.  So cause
+         it to fall back to a simpler CPU.  The cleaner approach of
+         setting CPUID(eax=1).OSXSAVE=0 and .XSAVE=0 isn't desirable
+         since it will (per the official Intel guidelines) lead to
+         software concluding that AVX isn't supported.
+
+         This is also a kludge in that putting these ifdefs here checks
+         the build (host) architecture, when really we're checking the
+         guest architecture. */
+      Bool this_is_yosemite = False;
+#     if defined(VGP_amd64_darwin) && DARWIN_VERS == DARWIN_10_10
+      this_is_yosemite = True;
+#     endif
+
       if (haveF2orF3(pfx)) goto decode_failure;
       /* This isn't entirely correct, CPUID should depend on the VEX
          capabilities, not on the underlying CPU. See bug #324882. */
-      if ((archinfo->hwcaps & VEX_HWCAPS_AMD64_SSE3) &&
+      if (!this_is_yosemite &&
+          (archinfo->hwcaps & VEX_HWCAPS_AMD64_SSE3) &&
           (archinfo->hwcaps & VEX_HWCAPS_AMD64_CX16) &&
           (archinfo->hwcaps & VEX_HWCAPS_AMD64_AVX)) {
          fName = "amd64g_dirtyhelper_CPUID_avx_and_cx16";