1*eca53ba6SRoland Levillain /* 2*eca53ba6SRoland Levillain * Copyright (C) 2010 The Android Open Source Project 3*eca53ba6SRoland Levillain * All rights reserved. 4*eca53ba6SRoland Levillain * 5*eca53ba6SRoland Levillain * Redistribution and use in source and binary forms, with or without 6*eca53ba6SRoland Levillain * modification, are permitted provided that the following conditions 7*eca53ba6SRoland Levillain * are met: 8*eca53ba6SRoland Levillain * * Redistributions of source code must retain the above copyright 9*eca53ba6SRoland Levillain * notice, this list of conditions and the following disclaimer. 10*eca53ba6SRoland Levillain * * Redistributions in binary form must reproduce the above copyright 11*eca53ba6SRoland Levillain * notice, this list of conditions and the following disclaimer in 12*eca53ba6SRoland Levillain * the documentation and/or other materials provided with the 13*eca53ba6SRoland Levillain * distribution. 14*eca53ba6SRoland Levillain * 15*eca53ba6SRoland Levillain * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16*eca53ba6SRoland Levillain * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17*eca53ba6SRoland Levillain * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18*eca53ba6SRoland Levillain * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19*eca53ba6SRoland Levillain * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20*eca53ba6SRoland Levillain * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21*eca53ba6SRoland Levillain * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22*eca53ba6SRoland Levillain * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23*eca53ba6SRoland Levillain * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24*eca53ba6SRoland Levillain * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25*eca53ba6SRoland Levillain * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*eca53ba6SRoland Levillain * SUCH DAMAGE. 27*eca53ba6SRoland Levillain */ 28*eca53ba6SRoland Levillain #ifndef GOOGLE_CPU_FEATURES_H 29*eca53ba6SRoland Levillain #define GOOGLE_CPU_FEATURES_H 30*eca53ba6SRoland Levillain #include <stdint.h> 31*eca53ba6SRoland Levillain #include <sys/cdefs.h> 32*eca53ba6SRoland Levillain 33*eca53ba6SRoland Levillain __BEGIN_DECLS 34*eca53ba6SRoland Levillain 35*eca53ba6SRoland Levillain /* A list of valid values returned by android_getCpuFamily(). 36*eca53ba6SRoland Levillain * They describe the CPU Architecture of the current process. 37*eca53ba6SRoland Levillain */ 38*eca53ba6SRoland Levillain typedef enum { 39*eca53ba6SRoland Levillain ANDROID_CPU_FAMILY_UNKNOWN = 0, 40*eca53ba6SRoland Levillain ANDROID_CPU_FAMILY_ARM, 41*eca53ba6SRoland Levillain ANDROID_CPU_FAMILY_X86, 42*eca53ba6SRoland Levillain ANDROID_CPU_FAMILY_MIPS, 43*eca53ba6SRoland Levillain ANDROID_CPU_FAMILY_ARM64, 44*eca53ba6SRoland Levillain ANDROID_CPU_FAMILY_X86_64, 45*eca53ba6SRoland Levillain ANDROID_CPU_FAMILY_MIPS64, 46*eca53ba6SRoland Levillain ANDROID_CPU_FAMILY_MAX /* do not remove */ 47*eca53ba6SRoland Levillain } AndroidCpuFamily; 48*eca53ba6SRoland Levillain 49*eca53ba6SRoland Levillain /* Return the CPU family of the current process. 50*eca53ba6SRoland Levillain * 51*eca53ba6SRoland Levillain * Note that this matches the bitness of the current process. I.e. when 52*eca53ba6SRoland Levillain * running a 32-bit binary on a 64-bit capable CPU, this will return the 53*eca53ba6SRoland Levillain * 32-bit CPU family value. 54*eca53ba6SRoland Levillain */ 55*eca53ba6SRoland Levillain extern AndroidCpuFamily android_getCpuFamily(void); 56*eca53ba6SRoland Levillain 57*eca53ba6SRoland Levillain /* Return a bitmap describing a set of optional CPU features that are 58*eca53ba6SRoland Levillain * supported by the current device's CPU. The exact bit-flags returned 59*eca53ba6SRoland Levillain * depend on the value returned by android_getCpuFamily(). See the 60*eca53ba6SRoland Levillain * documentation for the ANDROID_CPU_*_FEATURE_* flags below for details. 61*eca53ba6SRoland Levillain */ 62*eca53ba6SRoland Levillain extern uint64_t android_getCpuFeatures(void); 63*eca53ba6SRoland Levillain 64*eca53ba6SRoland Levillain /* The list of feature flags for ANDROID_CPU_FAMILY_ARM that can be 65*eca53ba6SRoland Levillain * recognized by the library (see note below for 64-bit ARM). Value details 66*eca53ba6SRoland Levillain * are: 67*eca53ba6SRoland Levillain * 68*eca53ba6SRoland Levillain * VFPv2: 69*eca53ba6SRoland Levillain * CPU supports the VFPv2 instruction set. Many, but not all, ARMv6 CPUs 70*eca53ba6SRoland Levillain * support these instructions. VFPv2 is a subset of VFPv3 so this will 71*eca53ba6SRoland Levillain * be set whenever VFPv3 is set too. 72*eca53ba6SRoland Levillain * 73*eca53ba6SRoland Levillain * ARMv7: 74*eca53ba6SRoland Levillain * CPU supports the ARMv7-A basic instruction set. 75*eca53ba6SRoland Levillain * This feature is mandated by the 'armeabi-v7a' ABI. 76*eca53ba6SRoland Levillain * 77*eca53ba6SRoland Levillain * VFPv3: 78*eca53ba6SRoland Levillain * CPU supports the VFPv3-D16 instruction set, providing hardware FPU 79*eca53ba6SRoland Levillain * support for single and double precision floating point registers. 80*eca53ba6SRoland Levillain * Note that only 16 FPU registers are available by default, unless 81*eca53ba6SRoland Levillain * the D32 bit is set too. This feature is also mandated by the 82*eca53ba6SRoland Levillain * 'armeabi-v7a' ABI. 83*eca53ba6SRoland Levillain * 84*eca53ba6SRoland Levillain * VFP_D32: 85*eca53ba6SRoland Levillain * CPU VFP optional extension that provides 32 FPU registers, 86*eca53ba6SRoland Levillain * instead of 16. Note that ARM mandates this feature is the 'NEON' 87*eca53ba6SRoland Levillain * feature is implemented by the CPU. 88*eca53ba6SRoland Levillain * 89*eca53ba6SRoland Levillain * NEON: 90*eca53ba6SRoland Levillain * CPU FPU supports "ARM Advanced SIMD" instructions, also known as 91*eca53ba6SRoland Levillain * NEON. Note that this mandates the VFP_D32 feature as well, per the 92*eca53ba6SRoland Levillain * ARM Architecture specification. 93*eca53ba6SRoland Levillain * 94*eca53ba6SRoland Levillain * VFP_FP16: 95*eca53ba6SRoland Levillain * Half-width floating precision VFP extension. If set, the CPU 96*eca53ba6SRoland Levillain * supports instructions to perform floating-point operations on 97*eca53ba6SRoland Levillain * 16-bit registers. This is part of the VFPv4 specification, but 98*eca53ba6SRoland Levillain * not mandated by any Android ABI. 99*eca53ba6SRoland Levillain * 100*eca53ba6SRoland Levillain * VFP_FMA: 101*eca53ba6SRoland Levillain * Fused multiply-accumulate VFP instructions extension. Also part of 102*eca53ba6SRoland Levillain * the VFPv4 specification, but not mandated by any Android ABI. 103*eca53ba6SRoland Levillain * 104*eca53ba6SRoland Levillain * NEON_FMA: 105*eca53ba6SRoland Levillain * Fused multiply-accumulate NEON instructions extension. Optional 106*eca53ba6SRoland Levillain * extension from the VFPv4 specification, but not mandated by any 107*eca53ba6SRoland Levillain * Android ABI. 108*eca53ba6SRoland Levillain * 109*eca53ba6SRoland Levillain * IDIV_ARM: 110*eca53ba6SRoland Levillain * Integer division available in ARM mode. Only available 111*eca53ba6SRoland Levillain * on recent CPUs (e.g. Cortex-A15). 112*eca53ba6SRoland Levillain * 113*eca53ba6SRoland Levillain * IDIV_THUMB2: 114*eca53ba6SRoland Levillain * Integer division available in Thumb-2 mode. Only available 115*eca53ba6SRoland Levillain * on recent CPUs (e.g. Cortex-A15). 116*eca53ba6SRoland Levillain * 117*eca53ba6SRoland Levillain * iWMMXt: 118*eca53ba6SRoland Levillain * Optional extension that adds MMX registers and operations to an 119*eca53ba6SRoland Levillain * ARM CPU. This is only available on a few XScale-based CPU designs 120*eca53ba6SRoland Levillain * sold by Marvell. Pretty rare in practice. 121*eca53ba6SRoland Levillain * 122*eca53ba6SRoland Levillain * AES: 123*eca53ba6SRoland Levillain * CPU supports AES instructions. These instructions are only 124*eca53ba6SRoland Levillain * available for 32-bit applications running on ARMv8 CPU. 125*eca53ba6SRoland Levillain * 126*eca53ba6SRoland Levillain * CRC32: 127*eca53ba6SRoland Levillain * CPU supports CRC32 instructions. These instructions are only 128*eca53ba6SRoland Levillain * available for 32-bit applications running on ARMv8 CPU. 129*eca53ba6SRoland Levillain * 130*eca53ba6SRoland Levillain * SHA2: 131*eca53ba6SRoland Levillain * CPU supports SHA2 instructions. These instructions are only 132*eca53ba6SRoland Levillain * available for 32-bit applications running on ARMv8 CPU. 133*eca53ba6SRoland Levillain * 134*eca53ba6SRoland Levillain * SHA1: 135*eca53ba6SRoland Levillain * CPU supports SHA1 instructions. These instructions are only 136*eca53ba6SRoland Levillain * available for 32-bit applications running on ARMv8 CPU. 137*eca53ba6SRoland Levillain * 138*eca53ba6SRoland Levillain * PMULL: 139*eca53ba6SRoland Levillain * CPU supports 64-bit PMULL and PMULL2 instructions. These 140*eca53ba6SRoland Levillain * instructions are only available for 32-bit applications 141*eca53ba6SRoland Levillain * running on ARMv8 CPU. 142*eca53ba6SRoland Levillain * 143*eca53ba6SRoland Levillain * If you want to tell the compiler to generate code that targets one of 144*eca53ba6SRoland Levillain * the feature set above, you should probably use one of the following 145*eca53ba6SRoland Levillain * flags (for more details, see technical note at the end of this file): 146*eca53ba6SRoland Levillain * 147*eca53ba6SRoland Levillain * -mfpu=vfp 148*eca53ba6SRoland Levillain * -mfpu=vfpv2 149*eca53ba6SRoland Levillain * These are equivalent and tell GCC to use VFPv2 instructions for 150*eca53ba6SRoland Levillain * floating-point operations. Use this if you want your code to 151*eca53ba6SRoland Levillain * run on *some* ARMv6 devices, and any ARMv7-A device supported 152*eca53ba6SRoland Levillain * by Android. 153*eca53ba6SRoland Levillain * 154*eca53ba6SRoland Levillain * Generated code requires VFPv2 feature. 155*eca53ba6SRoland Levillain * 156*eca53ba6SRoland Levillain * -mfpu=vfpv3-d16 157*eca53ba6SRoland Levillain * Tell GCC to use VFPv3 instructions (using only 16 FPU registers). 158*eca53ba6SRoland Levillain * This should be generic code that runs on any CPU that supports the 159*eca53ba6SRoland Levillain * 'armeabi-v7a' Android ABI. Note that no ARMv6 CPU supports this. 160*eca53ba6SRoland Levillain * 161*eca53ba6SRoland Levillain * Generated code requires VFPv3 feature. 162*eca53ba6SRoland Levillain * 163*eca53ba6SRoland Levillain * -mfpu=vfpv3 164*eca53ba6SRoland Levillain * Tell GCC to use VFPv3 instructions with 32 FPU registers. 165*eca53ba6SRoland Levillain * Generated code requires VFPv3|VFP_D32 features. 166*eca53ba6SRoland Levillain * 167*eca53ba6SRoland Levillain * -mfpu=neon 168*eca53ba6SRoland Levillain * Tell GCC to use VFPv3 instructions with 32 FPU registers, and 169*eca53ba6SRoland Levillain * also support NEON intrinsics (see <arm_neon.h>). 170*eca53ba6SRoland Levillain * Generated code requires VFPv3|VFP_D32|NEON features. 171*eca53ba6SRoland Levillain * 172*eca53ba6SRoland Levillain * -mfpu=vfpv4-d16 173*eca53ba6SRoland Levillain * Generated code requires VFPv3|VFP_FP16|VFP_FMA features. 174*eca53ba6SRoland Levillain * 175*eca53ba6SRoland Levillain * -mfpu=vfpv4 176*eca53ba6SRoland Levillain * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32 features. 177*eca53ba6SRoland Levillain * 178*eca53ba6SRoland Levillain * -mfpu=neon-vfpv4 179*eca53ba6SRoland Levillain * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32|NEON|NEON_FMA 180*eca53ba6SRoland Levillain * features. 181*eca53ba6SRoland Levillain * 182*eca53ba6SRoland Levillain * -mcpu=cortex-a7 183*eca53ba6SRoland Levillain * -mcpu=cortex-a15 184*eca53ba6SRoland Levillain * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32| 185*eca53ba6SRoland Levillain * NEON|NEON_FMA|IDIV_ARM|IDIV_THUMB2 186*eca53ba6SRoland Levillain * This flag implies -mfpu=neon-vfpv4. 187*eca53ba6SRoland Levillain * 188*eca53ba6SRoland Levillain * -mcpu=iwmmxt 189*eca53ba6SRoland Levillain * Allows the use of iWMMXt instrinsics with GCC. 190*eca53ba6SRoland Levillain * 191*eca53ba6SRoland Levillain * IMPORTANT NOTE: These flags should only be tested when 192*eca53ba6SRoland Levillain * android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM, i.e. this is a 193*eca53ba6SRoland Levillain * 32-bit process. 194*eca53ba6SRoland Levillain * 195*eca53ba6SRoland Levillain * When running a 64-bit ARM process on an ARMv8 CPU, 196*eca53ba6SRoland Levillain * android_getCpuFeatures() will return a different set of bitflags 197*eca53ba6SRoland Levillain */ 198*eca53ba6SRoland Levillain enum { 199*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_ARMv7 = (1 << 0), 200*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_VFPv3 = (1 << 1), 201*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_NEON = (1 << 2), 202*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_LDREX_STREX = (1 << 3), 203*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_VFPv2 = (1 << 4), 204*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_VFP_D32 = (1 << 5), 205*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_VFP_FP16 = (1 << 6), 206*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_VFP_FMA = (1 << 7), 207*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_NEON_FMA = (1 << 8), 208*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_IDIV_ARM = (1 << 9), 209*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_IDIV_THUMB2 = (1 << 10), 210*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_iWMMXt = (1 << 11), 211*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_AES = (1 << 12), 212*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_PMULL = (1 << 13), 213*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_SHA1 = (1 << 14), 214*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_SHA2 = (1 << 15), 215*eca53ba6SRoland Levillain ANDROID_CPU_ARM_FEATURE_CRC32 = (1 << 16), 216*eca53ba6SRoland Levillain }; 217*eca53ba6SRoland Levillain 218*eca53ba6SRoland Levillain /* The bit flags corresponding to the output of android_getCpuFeatures() 219*eca53ba6SRoland Levillain * when android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM64. Value details 220*eca53ba6SRoland Levillain * are: 221*eca53ba6SRoland Levillain * 222*eca53ba6SRoland Levillain * FP: 223*eca53ba6SRoland Levillain * CPU has Floating-point unit. 224*eca53ba6SRoland Levillain * 225*eca53ba6SRoland Levillain * ASIMD: 226*eca53ba6SRoland Levillain * CPU has Advanced SIMD unit. 227*eca53ba6SRoland Levillain * 228*eca53ba6SRoland Levillain * AES: 229*eca53ba6SRoland Levillain * CPU supports AES instructions. 230*eca53ba6SRoland Levillain * 231*eca53ba6SRoland Levillain * CRC32: 232*eca53ba6SRoland Levillain * CPU supports CRC32 instructions. 233*eca53ba6SRoland Levillain * 234*eca53ba6SRoland Levillain * SHA2: 235*eca53ba6SRoland Levillain * CPU supports SHA2 instructions. 236*eca53ba6SRoland Levillain * 237*eca53ba6SRoland Levillain * SHA1: 238*eca53ba6SRoland Levillain * CPU supports SHA1 instructions. 239*eca53ba6SRoland Levillain * 240*eca53ba6SRoland Levillain * PMULL: 241*eca53ba6SRoland Levillain * CPU supports 64-bit PMULL and PMULL2 instructions. 242*eca53ba6SRoland Levillain */ 243*eca53ba6SRoland Levillain enum { 244*eca53ba6SRoland Levillain ANDROID_CPU_ARM64_FEATURE_FP = (1 << 0), 245*eca53ba6SRoland Levillain ANDROID_CPU_ARM64_FEATURE_ASIMD = (1 << 1), 246*eca53ba6SRoland Levillain ANDROID_CPU_ARM64_FEATURE_AES = (1 << 2), 247*eca53ba6SRoland Levillain ANDROID_CPU_ARM64_FEATURE_PMULL = (1 << 3), 248*eca53ba6SRoland Levillain ANDROID_CPU_ARM64_FEATURE_SHA1 = (1 << 4), 249*eca53ba6SRoland Levillain ANDROID_CPU_ARM64_FEATURE_SHA2 = (1 << 5), 250*eca53ba6SRoland Levillain ANDROID_CPU_ARM64_FEATURE_CRC32 = (1 << 6), 251*eca53ba6SRoland Levillain }; 252*eca53ba6SRoland Levillain 253*eca53ba6SRoland Levillain /* The bit flags corresponding to the output of android_getCpuFeatures() 254*eca53ba6SRoland Levillain * when android_getCpuFamily() returns ANDROID_CPU_FAMILY_X86 or 255*eca53ba6SRoland Levillain * ANDROID_CPU_FAMILY_X86_64. 256*eca53ba6SRoland Levillain */ 257*eca53ba6SRoland Levillain enum { 258*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_SSSE3 = (1 << 0), 259*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_POPCNT = (1 << 1), 260*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_MOVBE = (1 << 2), 261*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_SSE4_1 = (1 << 3), 262*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_SSE4_2 = (1 << 4), 263*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_AES_NI = (1 << 5), 264*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_AVX = (1 << 6), 265*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_RDRAND = (1 << 7), 266*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_AVX2 = (1 << 8), 267*eca53ba6SRoland Levillain ANDROID_CPU_X86_FEATURE_SHA_NI = (1 << 9), 268*eca53ba6SRoland Levillain }; 269*eca53ba6SRoland Levillain 270*eca53ba6SRoland Levillain /* The bit flags corresponding to the output of android_getCpuFeatures() 271*eca53ba6SRoland Levillain * when android_getCpuFamily() returns ANDROID_CPU_FAMILY_MIPS 272*eca53ba6SRoland Levillain * or ANDROID_CPU_FAMILY_MIPS64. Values are: 273*eca53ba6SRoland Levillain * 274*eca53ba6SRoland Levillain * R6: 275*eca53ba6SRoland Levillain * CPU executes MIPS Release 6 instructions natively, and 276*eca53ba6SRoland Levillain * supports obsoleted R1..R5 instructions only via kernel traps. 277*eca53ba6SRoland Levillain * 278*eca53ba6SRoland Levillain * MSA: 279*eca53ba6SRoland Levillain * CPU supports Mips SIMD Architecture instructions. 280*eca53ba6SRoland Levillain */ 281*eca53ba6SRoland Levillain enum { 282*eca53ba6SRoland Levillain ANDROID_CPU_MIPS_FEATURE_R6 = (1 << 0), 283*eca53ba6SRoland Levillain ANDROID_CPU_MIPS_FEATURE_MSA = (1 << 1), 284*eca53ba6SRoland Levillain }; 285*eca53ba6SRoland Levillain 286*eca53ba6SRoland Levillain /* Return the number of CPU cores detected on this device. 287*eca53ba6SRoland Levillain * Please note the current implementation supports up to 32 cpus. 288*eca53ba6SRoland Levillain */ 289*eca53ba6SRoland Levillain extern int android_getCpuCount(void); 290*eca53ba6SRoland Levillain 291*eca53ba6SRoland Levillain /* The following is used to force the CPU count and features 292*eca53ba6SRoland Levillain * mask in sandboxed processes. Under 4.1 and higher, these processes 293*eca53ba6SRoland Levillain * cannot access /proc, which is the only way to get information from 294*eca53ba6SRoland Levillain * the kernel about the current hardware (at least on ARM). 295*eca53ba6SRoland Levillain * 296*eca53ba6SRoland Levillain * It _must_ be called only once, and before any android_getCpuXXX 297*eca53ba6SRoland Levillain * function, any other case will fail. 298*eca53ba6SRoland Levillain * 299*eca53ba6SRoland Levillain * This function return 1 on success, and 0 on failure. 300*eca53ba6SRoland Levillain */ 301*eca53ba6SRoland Levillain extern int android_setCpu(int cpu_count, uint64_t cpu_features); 302*eca53ba6SRoland Levillain 303*eca53ba6SRoland Levillain #ifdef __arm__ 304*eca53ba6SRoland Levillain 305*eca53ba6SRoland Levillain /* Retrieve the ARM 32-bit CPUID value from the kernel. 306*eca53ba6SRoland Levillain * Note that this cannot work on sandboxed processes under 4.1 and 307*eca53ba6SRoland Levillain * higher, unless you called android_setCpuArm() before. 308*eca53ba6SRoland Levillain */ 309*eca53ba6SRoland Levillain extern uint32_t android_getCpuIdArm(void); 310*eca53ba6SRoland Levillain 311*eca53ba6SRoland Levillain /* An ARM-specific variant of android_setCpu() that also allows you 312*eca53ba6SRoland Levillain * to set the ARM CPUID field. 313*eca53ba6SRoland Levillain */ 314*eca53ba6SRoland Levillain extern int android_setCpuArm(int cpu_count, uint64_t cpu_features, 315*eca53ba6SRoland Levillain uint32_t cpu_id); 316*eca53ba6SRoland Levillain 317*eca53ba6SRoland Levillain #endif 318*eca53ba6SRoland Levillain 319*eca53ba6SRoland Levillain __END_DECLS 320*eca53ba6SRoland Levillain #endif /* GOOGLE_CPU_FEATURES_H */ 321