@@ -18,18 +18,25 @@
#include <cpu-features.h>
#include <sys/auxv.h>
+#include <elf/dl-tunables.h>
static inline void
init_cpu_features (struct cpu_features *cpu_features)
{
- if (GLRO(dl_hwcap) & HWCAP_CPUID)
+#if HAVE_TUNABLES
+ uint64_t hwcap_mask = TUNABLE_GET (glibc, tune, hwcap_mask, uint64_t);
+#else
+ uint64_t hwcap_mask = GLRO (dl_hwcap_mask);
+#endif
+
+ uint64_t hwcap = GLRO (dl_hwcap) & hwcap_mask;
+
+ if (hwcap & HWCAP_CPUID)
{
register uint64_t id = 0;
asm volatile ("mrs %0, midr_el1" : "=r"(id));
cpu_features->midr_el1 = id;
}
else
- {
- cpu_features->midr_el1 = 0;
- }
+ cpu_features->midr_el1 = 0;
}