From: Mark Wielaard Date: Fri, 4 Sep 2015 21:52:52 +0000 (+0000) Subject: Fix bug #339636 Use fxsave64 and fxrstor64 mnemonics again. X-Git-Tag: svn/VALGRIND_3_11_0~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=758fab675c41c8bbcaace19f05cf865511dd2bd9;p=thirdparty%2Fvalgrind.git Fix bug #339636 Use fxsave64 and fxrstor64 mnemonics again. Just add a configure check to see if the assembler understands fxsave64/fxrstor64 and fall back to the old-school rex64 prefix otherwise. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15625 --- diff --git a/NEWS b/NEWS index fd35e212a5..d40bf317cd 100644 --- a/NEWS +++ b/NEWS @@ -210,11 +210,10 @@ where XXXXXX is the bug number as listed below. 339156 gdbsrv not called for fatal signal 339215 Valgrind 3.10.0 contain 2013 in copyrights notice 339288 support Cavium Octeon MIPS specific BBIT*32 instructions -339636 Use fxsave64 and fxrstor64 mnemonics instead of rex64 prefix +339636 Use fxsave64 and fxrstor64 mnemonics instead of old-school rex64 prefix 339442 Fix testsuite build failure on OS X 10.9 339542 Enable compilation with Intel's ICC compiler 339563 The DVB demux DMX_STOP ioctl doesn't have a wrapper -339636 Use fxsave64 and fxrstor64 mnemonics instead of old-school rex64 prefix 339688 Mac-specific ASM does not support .version directive (cpuid, tronical and pushfpopf tests) 339745 Valgrind crash when check Marmalade app (partial fix) diff --git a/configure.ac b/configure.ac index 95bc904e87..f257d93c11 100644 --- a/configure.ac +++ b/configure.ac @@ -2231,6 +2231,24 @@ if test x$ac_have_as_ppc_fpPO = xyes ; then fi +# does the amd64 assembler understand "fxsave64" and "fxrstor64"? +AC_MSG_CHECKING([if amd64 assembler supports fxsave64/fxrstor64]) + +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ +void* p; +asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" ); +asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" ); +]])], [ +ac_have_as_amd64_fxsave64=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_as_amd64_fxsave64=no +AC_MSG_RESULT([no]) +]) +if test x$ac_have_as_amd64_fxsave64 = xyes ; then + AC_DEFINE(HAVE_AS_AMD64_FXSAVE64, 1, [Define to 1 if as supports fxsave64/fxrstor64.]) +fi + # does the x86/amd64 assembler understand SSE3 instructions? # Note, this doesn't generate a C-level symbol. It generates a # automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's diff --git a/memcheck/tests/amd64/fxsave-amd64.c b/memcheck/tests/amd64/fxsave-amd64.c index b1451b739e..bd214c1876 100644 --- a/memcheck/tests/amd64/fxsave-amd64.c +++ b/memcheck/tests/amd64/fxsave-amd64.c @@ -1,4 +1,4 @@ - +#include #include #include #include "tests/asm.h" @@ -17,7 +17,7 @@ const unsigned int vecZ[4] __attribute__((noinline)) void do_fxsave ( void* p, int rexw ) { if (rexw) { -#if (defined(VGO_linux) || defined(VGO_solaris)) && ! defined(__clang__) +#ifdef HAVE_AS_AMD64_FXSAVE64 asm __volatile__("fxsave64 (%0)" : : "r" (p) : "memory" ); #else asm __volatile__("rex64/fxsave (%0)" : : "r" (p) : "memory" ); @@ -30,7 +30,7 @@ void do_fxsave ( void* p, int rexw ) { __attribute__((noinline)) void do_fxrstor ( void* p, int rexw ) { if (rexw) { -#if (defined(VGO_linuxx) || defined(VGO_solaris)) && ! defined(__clang__) +#ifdef HAVE_AS_AMD64_FXSAVE64 asm __volatile__("fxrstor64 (%0)" : : "r" (p) : "memory" ); #else asm __volatile__("rex64/fxrstor (%0)" : : "r" (p) : "memory" );