freebsd.inc 816 B

123456789101112131415161718192021222324252627
  1. void __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. void CONSTRUCTOR_ATTRIBUTE __init_cpu_features(void) {
  8. unsigned long hwcap = 0;
  9. unsigned long hwcap2 = 0;
  10. // CPU features already initialized.
  11. if (__atomic_load_n(&__aarch64_cpu_features.features, __ATOMIC_RELAXED))
  12. return;
  13. int res = 0;
  14. res = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
  15. res |= elf_aux_info(AT_HWCAP2, &hwcap2, sizeof hwcap2);
  16. if (res)
  17. return;
  18. __ifunc_arg_t arg;
  19. arg._size = sizeof(__ifunc_arg_t);
  20. arg._hwcap = hwcap;
  21. arg._hwcap2 = hwcap2;
  22. __init_cpu_features_constructor(hwcap | _IFUNC_ARG_HWCAP, &arg);
  23. }