"Yuriy M. Kaminskiy" <[email protected]> writes:
> When compiled for armv6+ and getauxval() is present (glibc 2.16+),
> avoid slow and unreliable /proc/cpuinfo parsing.
>
> E.g. /proc/cpuinfo contains junk with qemu-user and can be unavailable
> in some chroot environment.
Do you know what's the preferred way to do this on android? Do we still
need /proc/cpuinfo, or are there any library facilities?
> +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16)
> +#include <sys/auxv.h>
This part could be an AC_CHECK_HEADERS([sys/auxv.h]) in configure.ac.
> +#if defined(AT_HWCAP) && defined(HWCAP_ARM_NEON)
> +#define HAVE_GETAUXVAL 1
> +#endif
> +#endif
> +
> #include "nettle-types.h"
>
> #include "aes-internal.h"
> @@ -87,6 +94,18 @@ get_arm_features (struct arm_features *features)
> }
> else
> {
> +#if defined(HAVE_GETAUXVAL) && __ARM_ARCH >= 6
Why the condition __ARM_ARCH >= 6? Is it because getauxval doesn't let us
make the distinction between arch_version 5 and 6?
> + unsigned long hwcap = getauxval(AT_HWCAP);
> + features->arch_version = __ARM_ARCH;
Is it important to take the compile-time arch into account? The effect
(when it makes a difference at all) will be to force use of certain
features, even if runtime checks say we're running on an older arch.
Is the getauxval method missing a way to get cpu arch at runtime? In the
docs
(https://github.com/torvalds/linux/blob/master/arch/arm/include/uapi/asm/hwcap.h)
I don't see anything corresponding to the "CPU arcitecture" line in
/proc/cpuinfo.
I'd be happier about getauxval if we could find a way to also get the
arch version without reading /proc/cpuinfo. But I don't think it's a
blocker for this change.
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs