Re: [PATCH] x86: Check if CPUID_INDEX_7_ECX_1 is supported first

Florian Weimer <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
* H. J. Lu:

> diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
> index a453136827..0db33e0f35 100644
> --- a/sysdeps/x86/cpu-features.c
> +++ b/sysdeps/x86/cpu-features.c
> @@ -458,11 +458,13 @@ get_common_indices (struct cpu_features *cpu_features,
>  		     cpu_features->features[CPUID_INDEX_7].cpuid.ebx,
>  		     cpu_features->features[CPUID_INDEX_7].cpuid.ecx,
>  		     cpu_features->features[CPUID_INDEX_7].cpuid.edx);
> -      __cpuid_count (7, 1,
> -		     cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.eax,
> -		     cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.ebx,
> -		     cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.ecx,
> -		     cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.edx);
> +      if (cpu_features->features[CPUID_INDEX_7].cpuid.eax != 0)
> +	__cpuid_count
> +	  (7, 1,
> +	   cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.eax,
> +	   cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.ebx,
> +	   cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.ecx,
> +	   cpu_features->features[CPUID_INDEX_7_ECX_1].cpuid.edx);
>      }
>  
>    if (cpu_features->basic.max_cpuid >= 0xd)

If subleaf 1 is not support, should we zero the fields?

Thanks,
Florian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.