1// For baremetal platforms, we don't really initialise '__aarch64_cpu_features', 2// with exception of FEAT_SME that we can get from '__aarch64_sme_accessible'. 3 4#if defined(COMPILER_RT_SHARED_LIB) 5__attribute__((weak)) 6#endif 7extern _Bool 8__aarch64_sme_accessible(void); 9 10static _Bool has_sme(void) { 11#if defined(COMPILER_RT_SHARED_LIB) 12 if (!__aarch64_sme_accessible) 13 return 0; 14#endif 15 return __aarch64_sme_accessible(); 16} 17 18void __init_cpu_features_resolver(unsigned long hwcap, 19 const __ifunc_arg_t *arg) {} 20 21void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) { 22 // CPU features already initialized. 23 if (__atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED)) 24 return; 25 26 unsigned long long feat = 0; 27 if (has_sme()) 28 feat |= 1ULL << FEAT_SME; 29 30 __atomic_store_n(&__aarch64_cpu_features.features, feat, __ATOMIC_RELAXED); 31} 32