This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17259] sysdeps/x86_64/cacheinfo.c:intel_check_word may corrupt rbx


https://sourceware.org/bugzilla/show_bug.cgi?id=17259

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com
            Summary|sysdeps/x86_64/cacheinfo.c: |sysdeps/x86_64/cacheinfo.c:
                   |intel_check_word corrupts   |intel_check_word may
                   |rbx and another register    |corrupt rbx

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
There are

          asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
                : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
                : "0" (4), "2" (round));

The only register compiler is aware of is RBX.  No other registers are
impacted.  We are lucky that it doesn't cause any problems since RBX
is also used by compiler for other purposes so that RBX is saved and
restored in intel_check_word.  We should just use __cpuid_count instead.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]