diff options
author | David 'Digit' Turner <digit@google.com> | 2014-04-17 09:58:51 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2014-05-12 09:36:53 +0200 |
commit | 2016d8782c69b0ac6729b47884d874a606ebba52 (patch) | |
tree | 9315b6ab91a9a66d9bb877e0c936cbc027661926 /docs | |
parent | c28d50a4f26bee762ea899ab4b98d38fcc18131c (diff) | |
download | ndk-2016d8782c69b0ac6729b47884d874a606ebba52.tar.gz |
cpu-features: Support 32-bit ARM binaries running on an ARM64 kernel.
This addresses several issues related to 32-bit ARM binaries running
on an ARMv8 CPU.
The first one is that API level 20 exposes getauxval() in <sys/auxv.h>
which provides a reliably way to extract the ARM ELF HwCaps, so try
to use it when possible. Note that this adds -ldl as a LDLIBS
export for the library.
The second one is that /proc/self/auxv should always be the preferred
to /proc/cpuinfo for a process to access the 32-bit ARM ELF HWCaps.
Unfortunately, this file is not always accessible on some recent
Android platform versions, even though this may be fixed in the future.
When the file is not accessible, parse /proc/cpuinfo as a fallback,
but deal with the fact that the 'Features' field only list features
that are optional for the device's CPU reference architecture revision.
I.e. when running on an ARMv8 CPU, it will not list the typical
ARMv7 extensions that became mandatory in ARMv8.
+ Refresh and clarify documentation to explain that the output of
android_getCpuFamily() depends on the process' bitness, not the
target device's CPU.
+ Check that android_getCpuFeatures() returns 0 as expected on
anything except 32-bit ARM and 32-bit Intel.
+ Fix the reporting of ARM IDIV instruction by Goldfish kernels
/ Android emulators.
BUG=13679666
Change-Id: I003808b0a44c0645a180232ab688f9ce76d10f25
Diffstat (limited to 'docs')
-rw-r--r-- | docs/text/CPU-FEATURES.text | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/docs/text/CPU-FEATURES.text b/docs/text/CPU-FEATURES.text index 3d6b2adca..4ec6d20f7 100644 --- a/docs/text/CPU-FEATURES.text +++ b/docs/text/CPU-FEATURES.text @@ -43,8 +43,8 @@ Two functions are provided for now: AndroidCpuFamily android_getCpuFamily(); -Returns the target device's CPU Family as an enum. -Currently, the following families are defined: +Returns a value matching the CPU family/architecture supported by the +current process as an enum. Currently, the following families are defined: * `ANDROID_CPU_FAMILY_ARM` @@ -52,6 +52,15 @@ Currently, the following families are defined: * `ANDROID_CPU_FAMILY_MIPS` + * `ANDROID_CPU_FAMILY_ARM64` + + * `ANDROID_CPU_FAMILY_X86_64` + + * `ANDROID_CPU_FAMILY_MIPS64` + +Note that when running a 32-bit executable on a 64-bit system, this function +will return the 32-bit family value only. + Secondly: uint64_t android_getCpuFeatures(); @@ -60,7 +69,8 @@ Returns the set of optional features supported by the device's CPU. The result is a set of bit-flags, each corresponding to one CPU Family-specific optional feature. -Currently, only the following flags are defined, for the ARM CPU Family: +Currently, only the following flags are defined, for the 32-bit ARM CPU +Family: * `ANDROID_CPU_ARM_FEATURE_VFPv2` > Indicates that the device's CPU supports VFPv2 instruction set. @@ -122,7 +132,7 @@ Currently, only the following flags are defined, for the ARM CPU Family: available since ARMv6. Together they provide atomic update on memory with the help of exclusive monitor. -And the following flags for the x86 CPU Family: +And the following flags for the 32-bit x86 CPU Family: * `ANDROID_CPU_X86_FEATURE_SSSE3` > Indicates that the device's CPU supports the SSSE3 instruction @@ -136,6 +146,8 @@ And the following flags for the x86 CPU Family: > Indicates that the device's CPU supports the MOVBE instruction. This one is specific to some Intel IA-32 CPUs, like the Atom. +Other CPU families do not have extensions listed at the moment, which +means that android_getCpuFeatures() will return 0 for them. The following function is also defined to return the max number of CPU cores on the target device: |