brintos

brintos / llvm-project-archived public Read only

0
0
Text · 844 B · 6c52c53 Raw
26 lines · plain
1void __init_cpu_features_resolver(unsigned long hwcap,2                                  const __ifunc_arg_t *arg) {3  if (__atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED))4    return;5  __init_cpu_features_constructor(hwcap, arg);6}7 8void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {9  // CPU features already initialized.10  if (__atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED))11    return;12 13  unsigned long hwcap = getauxval(AT_HWCAP);14  unsigned long hwcap2 = getauxval(AT_HWCAP2);15  unsigned long hwcap3 = getauxval(AT_HWCAP3);16  unsigned long hwcap4 = getauxval(AT_HWCAP4);17 18  __ifunc_arg_t arg;19  arg._size = sizeof(__ifunc_arg_t);20  arg._hwcap = hwcap;21  arg._hwcap2 = hwcap2;22  arg._hwcap3 = hwcap3;23  arg._hwcap4 = hwcap4;24  __init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);25}26