Martin Storsjö <[email protected]> writes:

> On Tue, 13 Jan 2015, Niels Möller wrote:
>
>> Sure, that's the next step, once I have a structure I think is workable.
>> Does anyone have a pointer to how to check cpu capabilities on ARM?
>
> Yes - and it's a bit hairy. (I've got a TL;DR version halfway down.)

Thanks a lot. Sounds like easiest to just parse /proc/cpuinfo.

I should also say that I'd like to add some environment variable to
override the cpu detection, mainly for testing and benchmarking. I'm
thinking that maybe I should use glibc's getenv_secure (which always
returns NULL in setuid processes and the like).

> The gotcha about /proc/cpuinfo is that it is different for ARMv8
> kernels - 
> features like neon, which were optional on ARMv7, aren't optional any
> longer and thus are omitted. To handle this, you can either parse the
> "CPU architecture" field, and if this is >= 8, assume neon, or you can
> look for the "asimd" feature which is printed, which means the same.

I was going to say that there's no support for arm64 yet, but I take it
this applies to arm64-systems running 32-bit binaries.

> From a Nexus 9:
> Processor       : NVIDIA Denver 1.0 rev 0 (aarch64)
> Features        : fp asimd aes pmull sha1 sha2 crc32
> CPU implementer : 0x4e
> CPU architecture: AArch64

> From a Nexus 9, read from a 32 bit process:
> Processor       : NVIDIA Denver 1.0 rev 0 (aarch64)
> Features : fp asimd aes pmull sha1 sha2 crc32 wp half thumb fastmult
> vfp edsp neon vfpv3 tlsi vfpv4 idiva idivt
> CPU architecture: 8

Are you saying that the CPU Architecture: line in /proc/cpuinfo will
look different depending on whether the process that opened (or read???)
/proc/cpuinfo was 32-bit or 64-bit? I had no idea...

Regards,
/Niels


-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to