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] Common cpuid wrappers, use SYS_cpuid when available


On 09 Mar 2016 02:24, Piotr Henryk Dabrowski wrote:
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1704,6 +1704,24 @@ AC_SUBST(libc_cv_cxx_thread_local)
>  AC_LANG_POP([C++])
>  dnl End of C++ feature tests.
>  
> +# SYS_cpuid syscall
> +libc_cv_sys_cpuid=no
> +AC_MSG_CHECKING(for x86 kernel with SYS_cpuid support)
> +AC_TRY_COMPILE([
> +  #if (defined(__i386__) || defined(__x86_64__)) && defined(__linux__)
> +  #include <sys/syscall.h>
> +  #if !defined(SYS_cpuid) || !defined(__NR_cpuid)
> +  #error SYS_cpuid not defined
> +  #endif
> +  #else
> +  #error Not a x86 Linux
> +  #endif
> +], [], [libc_cv_sys_cpuid=yes], [libc_cv_sys_cpuid=no])
> +if test "$libc_cv_sys_cpuid" = yes; then
> +  AC_DEFINE(HAVE_SYS_CPUID)
> +fi
> +AC_MSG_RESULT($libc_cv_sys_cpuid)

don't think you need this here.  you can define __ASSUME_CPUID in
kernel-features.h and use that everywhere.  look at that file and
symbols it defins as an example.

> +   Copyright (C) 2016 Piotr Henryk Dabrowski <ultr@ultr.pl>

nope -- you'll need to sign copyright papers w/the FSF

> +/* NOTE: for new Linux kernels these functions try to use kernel-adjusted
> +   values for cpuid returned by the SYS_cpuid sys call.
> +   Otherwise they fallback to native cpuid implementation. */

GNU style: two spaces after periods

> +	if (INLINE_SYSCALL(cpuid, 6, level, count, eax, ebx, ecx, edx) == 0)

GNU style: put spaces before the ( w/func calls
-mike

Attachment: signature.asc
Description: Digital signature


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