This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Common cpuid wrappers, use SYS_cpuid when available
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Piotr Henryk Dabrowski <ultr at ultr dot pl>
- Cc: <libc-alpha at sourceware dot org>, Florian Weimer <fw at deneb dot enyo dot de>, "Mike Frysinger" <vapier at gentoo dot org>, Andreas Schwab <schwab at suse dot de>
- Date: Thu, 10 Mar 2016 21:37:46 +0000
- Subject: Re: [PATCH v2] Common cpuid wrappers, use SYS_cpuid when available
- Authentication-results: sourceware.org; auth=none
- References: <20160309022443 dot 3e3530f6 at ultra dot tux-net> <20160310211238 dot 590c6afa at ultra dot tux-net>
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