From: Julian Seward Date: Tue, 11 Nov 2014 12:49:21 +0000 (+0000) Subject: Add a nasty temporary kludge to CPUID that allows 64-bit MacOSX 10.10 X-Git-Tag: svn/VALGRIND_3_11_0^2~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0c2d531b44a092feae824a5d745ed2a8b2c75ab;p=thirdparty%2Fvalgrind.git Add a nasty temporary kludge to CPUID that allows 64-bit MacOSX 10.10 (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 --- diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c index 04efa78fd5..20298fc7f9 100644 --- a/VEX/priv/guest_amd64_toIR.c +++ b/VEX/priv/guest_amd64_toIR.c @@ -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";