static arm_cpu_features_t
detect_cpu_features (void)
{
arm_cpu_features_t features = 0;
features |= ARM_V6;
/* Detection of ARM NEON on iOS is fairly simple because iOS binaries * contain separate executable images for each processor architecture. * So all we have to do is detect the armv7 architecture build. The * operating system automatically runs the armv7 binary for armv7 devices * and the armv6 binary for armv6 devices.
*/ #ifdefined(__ARM_NEON__)
features |= ARM_NEON; #endif
static arm_cpu_features_t
detect_cpu_features (void)
{
arm_cpu_features_t features = 0;
Elf32_auxv_t aux; int fd;
fd = open ("/proc/self/auxv", O_RDONLY); if (fd >= 0)
{ while (read (fd, &aux, sizeof(Elf32_auxv_t)) == sizeof(Elf32_auxv_t))
{ if (aux.a_type == AT_HWCAP)
{
uint32_t hwcap = aux.a_un.a_val;
/* hardcode these values to avoid depending on specific * versions of the hwcap header, e.g. HWCAP_NEON
*/ if ((hwcap & 64) != 0)
features |= ARM_VFP; /* this flag is only present on kernel 2.6.29 */ if ((hwcap & 4096) != 0)
features |= ARM_NEON;
} elseif (aux.a_type == AT_PLATFORM)
{ constchar *plat = (constchar*) aux.a_un.a_val;
if (strncmp (plat, "v7l", 3) == 0)
features |= (ARM_V7 | ARM_V6); elseif (strncmp (plat, "v6l", 3) == 0)
features |= ARM_V6;
}
}
close (fd);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.