This is the mail archive of the libc-alpha@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]

Re: [PATCH v2] Common cpuid wrappers, use SYS_cpuid when available


On Thu, 10 Mar 2016, Piotr Henryk Dabrowski wrote:

> 	* misc/common_cpuid.h: Common cpuid wrappers
> 	* sysdeps/generic/local_cpuid.h: Common cpuid wrappers

The cpuid concept is x86-specific.  Thus, nothing should go in misc/ or 
sysdeps/generic/.  Use sysdeps/x86/.

> +{
> +	cpuid_count (level, 0, eax, ebx, ecx, edx);

Formatting of course needs to be in GNU style (so two-column indents).

> +#ifdef __NR_cpuid
> +	if (INLINE_SYSCALL (cpuid, 6, level, count, eax, ebx, ecx, edx) == 0)
> +		return;
> +#endif
> +	__cpuid_count (level, count, *eax, *ebx, *ecx, *edx);

If the kernel used at runtime supports the syscall, is it ever possible 
for it to fail?  If not, you should have __ASSUME_CPUID to disable the 
fallback.

-- 
Joseph S. Myers
joseph@codesourcery.com


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