1 2011-07-23 Ulrich Drepper <drepper@gmail.com>
3 * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix one more
5 (_dl_x86_64_save_sse): Likewise.
7 2011-07-22 Ulrich Drepper <drepper@gmail.com>
9 * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix test for
11 (_dl_x86_64_save_sse): Likewise.
13 2011-07-21 Andreas Schwab <schwab@redhat.com>
15 * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix last
17 (_dl_x86_64_save_sse): Use correct AVX check.
19 2011-07-20 Ulrich Drepper <drepper@gmail.com>
22 * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): More complete
23 check for AVX enablement so that we don't crash with old kernels and
25 * elf/tst-audit4.c: Add same checks here.
26 * elf/tst-audit6.c: Likewise.
29 elf/tst-audit4.c | 22 ++++++++++++++++++----
30 elf/tst-audit6.c | 22 ++++++++++++++++++----
31 sysdeps/x86_64/dl-trampoline.S | 36 +++++++++++++++++++++++++++---------
32 3 files changed, 63 insertions(+), 17 deletions(-)
34 --- a/elf/tst-audit4.c
35 +++ b/elf/tst-audit4.c
38 #include <immintrin.h>
44 + unsigned int eax, ebx, ecx, edx;
46 + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0
47 + || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE))
50 + /* Check the OS has AVX and SSE saving enabled. */
51 + asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
53 + return (eax & 6) == 6;
57 extern __m256i audit_test (__m256i, __m256i, __m256i, __m256i,
58 __m256i, __m256i, __m256i, __m256i);
62 - unsigned int eax, ebx, ecx, edx;
64 /* Run AVX test only if AVX is supported. */
65 - if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)
69 __m256i ymm = _mm256_setzero_si256 ();
70 __m256i ret = audit_test (ymm, ymm, ymm, ymm, ymm, ymm, ymm, ymm);
71 --- a/elf/tst-audit6.c
72 +++ b/elf/tst-audit6.c
74 extern __m128i audit_test (__m128i, __m128i, __m128i, __m128i,
75 __m128i, __m128i, __m128i, __m128i);
83 unsigned int eax, ebx, ecx, edx;
85 + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx) == 0
86 + || (ecx & (bit_AVX | bit_OSXSAVE)) != (bit_AVX | bit_OSXSAVE))
89 + /* Check the OS has AVX and SSE saving enabled. */
90 + asm ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (0));
92 + return (eax & 6) == 6;
99 /* Run AVX test only if AVX is supported. */
100 - if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)
101 - && (ecx & bit_AVX))
102 + if (avx_enabled ())
104 __m128i xmm = _mm_setzero_si128 ();
105 __m128i ret = audit_test (xmm, xmm, xmm, xmm, xmm, xmm, xmm, xmm);
106 --- a/sysdeps/x86_64/dl-trampoline.S
107 +++ b/sysdeps/x86_64/dl-trampoline.S
109 /* PLT trampolines. x86-64 version.
110 - Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
111 + Copyright (C) 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
112 This file is part of the GNU C Library.
114 The GNU C Library is free software; you can redistribute it and/or
115 @@ -139,11 +139,20 @@
118 movq %r11,%rbx # Restore rbx
120 - testl $(1 << 28), %ecx
122 + // AVX and XSAVE supported?
123 + andl $((1 << 28) | (1 << 27)), %ecx
124 + cmpl $((1 << 28) | (1 << 27)), %ecx
127 -2: movl %eax, L(have_avx)(%rip)
129 + // Get XFEATURE_ENABLED_MASK
133 + // Nonzero if SSE and AVX state saving is enabled.
135 +2: leal -1(%eax,%eax), %eax
136 + movl %eax, L(have_avx)(%rip)
140 @@ -176,11 +185,20 @@
143 movq %r11,%rbx # Restore rbx
145 - testl $(1 << 28), %ecx
147 + // AVX and XSAVE supported?
148 + andl $((1 << 28) | (1 << 27)), %ecx
149 + cmpl $((1 << 28) | (1 << 27)), %ecx
152 -2: movl %eax, L(have_avx)(%rip)
154 + // Get XFEATURE_ENABLED_MASK
158 + // Nonzero if SSE and AVX state saving is enabled.
160 +2: leal -1(%eax,%eax), %eax
161 + movl %eax, L(have_avx)(%rip)