cpu_features.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* cpu_features.h -- CPU architecture feature check
  2. * Copyright (C) 2017 Hans Kristian Rosbach
  3. * For conditions of distribution and use, see copyright notice in zlib.h
  4. */
  5. #ifndef CPU_FEATURES_H_
  6. #define CPU_FEATURES_H_
  7. #ifndef DISABLE_RUNTIME_CPU_DETECTION
  8. #if defined(X86_FEATURES)
  9. # include "arch/x86/x86_features.h"
  10. #elif defined(ARM_FEATURES)
  11. # include "arch/arm/arm_features.h"
  12. #elif defined(PPC_FEATURES) || defined(POWER_FEATURES)
  13. # include "arch/power/power_features.h"
  14. #elif defined(S390_FEATURES)
  15. # include "arch/s390/s390_features.h"
  16. #elif defined(RISCV_FEATURES)
  17. # include "arch/riscv/riscv_features.h"
  18. #endif
  19. struct cpu_features {
  20. #if defined(X86_FEATURES)
  21. struct x86_cpu_features x86;
  22. #elif defined(ARM_FEATURES)
  23. struct arm_cpu_features arm;
  24. #elif defined(PPC_FEATURES) || defined(POWER_FEATURES)
  25. struct power_cpu_features power;
  26. #elif defined(S390_FEATURES)
  27. struct s390_cpu_features s390;
  28. #elif defined(RISCV_FEATURES)
  29. struct riscv_cpu_features riscv;
  30. #else
  31. char empty;
  32. #endif
  33. };
  34. void cpu_check_features(struct cpu_features *features);
  35. #endif
  36. #endif