aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2014-04-17 09:58:51 +0200
committerDavid 'Digit' Turner <digit@google.com>2014-05-20 14:48:54 +0200
commit882ac8f3392858991a0e1af33b4b7387ec856bd2 (patch)
tree8c11f0ba9d7b655a0b4c5c3a94d71a7a815d93b7 /docs
parent0aeff661b8c3c949865dbfe811b7ba9fef2f256a (diff)
downloadndk-882ac8f3392858991a0e1af33b4b7387ec856bd2.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: Icad8a9d0a7cf651f42a717219c597205586a0a72
Diffstat (limited to 'docs')
-rw-r--r--docs/text/CPU-FEATURES.text20
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: