]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix bug #339636 Use fxsave64 and fxrstor64 mnemonics again.
authorMark Wielaard <mark@klomp.org>
Fri, 4 Sep 2015 21:52:52 +0000 (21:52 +0000)
committerMark Wielaard <mark@klomp.org>
Fri, 4 Sep 2015 21:52:52 +0000 (21:52 +0000)
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

NEWS
configure.ac
memcheck/tests/amd64/fxsave-amd64.c

diff --git a/NEWS b/NEWS
index fd35e212a5675b0e4c3a1a1fa3919feb7db67606..d40bf317cd77fde05adeb03e8d333f4aabd047df 100644 (file)
--- 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)
index 95bc904e8745928285cd1d85299aea96c6c60a8f..f257d93c11b05eeb246d9dcda5e26cb88ad98368 100644 (file)
@@ -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
index b1451b739efe767de58f93edf6fdd676fb18b946..bd214c1876f7ab20df671a5e8bfcfe2e39aead6e 100644 (file)
@@ -1,4 +1,4 @@
-
+#include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #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" );