https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
For level >= 7, ECX may have other input values.  It is incorrect to
assume that ECX only takes 0 or 1.  We should get another macro for
level >= 7 with input for ECX:

static __inline int
__get_cpuid (unsigned int __level,
             unsigned int *__eax, unsigned int *__ebx,
             unsigned int *__ecx, unsigned int *__edx)
{
  unsigned int __ext = __level & 0x80000000;

  if (__get_cpuid_max (__ext, 0) < __level)
    return 0;

  if (__level >= 7)
    return 0;

  __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
  return 1;
}

static __inline int
__get_cpuid_count (unsigned int __level, unsigned int count,
             unsigned int *__eax, unsigned int *__ebx,
             unsigned int *__ecx, unsigned int *__edx)
{
  unsigned int __ext = __level & 0x80000000;

  if (__get_cpuid_max (__ext, 0) < __level)
    return 0;

  __cpuid_count (__level, count, *__eax, *__ebx, *__ecx, *__edx);
  return 1;
}

Reply via email to