diff options
author | Ulrich Drepper <drepper@gmail.com> | 2012-01-26 07:45:14 -0500 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2012-01-26 07:45:14 -0500 |
commit | afc5ed09cbce5d6fd48b3a8c5ec427b31f996880 (patch) | |
tree | eb37cecd40d16a579528f698c7d4274697bb8fac /sysdeps/x86_64/multiarch/init-arch.c | |
parent | bdb6de1d6d5d2a538e34fd453331acd0f664f6ed (diff) | |
download | glibc-afc5ed09cbce5d6fd48b3a8c5ec427b31f996880.tar.gz glibc-afc5ed09cbce5d6fd48b3a8c5ec427b31f996880.tar.xz glibc-afc5ed09cbce5d6fd48b3a8c5ec427b31f996880.zip |
Reset bit_AVX in __cpu_features is OS support is missing
Diffstat (limited to 'sysdeps/x86_64/multiarch/init-arch.c')
-rw-r--r-- | sysdeps/x86_64/multiarch/init-arch.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c index 65b0ee93e5..4fabbee06d 100644 --- a/sysdeps/x86_64/multiarch/init-arch.c +++ b/sysdeps/x86_64/multiarch/init-arch.c @@ -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 (); |