]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Reset bit_AVX in __cpu_features is OS support is missing
authorUlrich Drepper <drepper@gmail.com>
Thu, 26 Jan 2012 12:45:14 +0000 (07:45 -0500)
committerCarlos O'Donell <carlos_odonell@mentor.com>
Wed, 2 May 2012 02:15:39 +0000 (22:15 -0400)
(cherry picked from commit afc5ed09cbce5d6fd48b3a8c5ec427b31f996880)

ChangeLog
NEWS
sysdeps/x86_64/multiarch/init-arch.c
sysdeps/x86_64/multiarch/init-arch.h

index 3b5e69bb41783889e4a69a7ebd524856f3b52969..44ace9a3fe783987cb5dcf159de29167ea40394d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * sysdeps/i386/fpu/feupdateenv.c (__feupdateenv) Invoke __feraiseexcept
        instead of feraiseexcept.
 
+2012-01-26  Ulrich Drepper  <drepper@gmail.com>
+
+       [BZ #13583]
+       * sysdeps/x86_64/multiarch/init-arch.h: Define bit_OSXSAVE.
+       * sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): If
+       bit_AVX is set also check OSXAVE/XCR0 and reset bit_AVX if necessary.
+
 2012-01-01  Ulrich Drepper  <drepper@gmail.com>
 
        * posix/getconf.c: Update copyright year.
diff --git a/NEWS b/NEWS
index bbf14c0f9ee6e1ed20d386598fd6c630482638b1..58571074b6891a510835c9bdf31aad67e92336e3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
 GNU C Library NEWS -- history of user-visible changes.  2011-12-23
-Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
+Copyright (C) 1992-2012 Free Software Foundation, Inc.
 See the end for copying conditions.
 
 Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
@@ -9,7 +9,8 @@ Version 2.15.1
 
 * The following bugs are resolved with this release:
 
-  411, 2547, 2548, 11365, 11494, 13731, 13732, 13733, 13747, 13748, 13749
+  411, 2547, 2548, 11365, 11494, 13583, 13731, 13732, 13733, 13747, 13748,
+  13749
 
 Version 2.15
 
index 65b0ee93e54abdf77c6c590fb2e07f8467e5067f..4fabbee06d51130049eb89379d21a20990fa6939 100644 (file)
@@ -1,6 +1,6 @@
 /* Initialize CPU feature data.
    This file is part of the GNU C Library.
-   Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@redhat.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -144,6 +144,18 @@ __init_cpu_features (void)
   else
     kind = arch_kind_other;
 
+  if (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_AVX)
+    {
+      /* Reset the AVX bit in case OSXSAVE is disabled.  */
+      if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_OSXSAVE) == 0
+         || ({ unsigned int xcrlow;
+             unsigned int xcrhigh;
+             asm ("xgetbv"
+                  : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0));
+             (xcrlow & 6) != 6; }))
+       __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx &= ~bit_AVX;
+    }
+
   __cpu_features.family = family;
   __cpu_features.model = model;
   atomic_write_barrier ();
index 2a1df393c4a7b71b92504e6fc421c1a1ccb621dd..408e5aeb897210affe9def63814ea01b9713c833 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the GNU C Library.
-   Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -27,6 +27,7 @@
 #define bit_SSSE3      (1 << 9)
 #define bit_SSE4_1     (1 << 19)
 #define bit_SSE4_2     (1 << 20)
+#define bit_OSXSAVE    (1 << 27)
 #define bit_AVX                (1 << 28)
 #define bit_POPCOUNT   (1 << 23)
 #define bit_FMA                (1 << 12)