cpu_feature.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (C) 2015 Martin Willi
  3. * Copyright (C) 2015 revosec AG
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  12. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  13. * for more details.
  14. */
  15. /**
  16. * @defgroup cpu_feature cpu_feature
  17. * @{ @ingroup utils
  18. */
  19. #ifndef CPU_FEATURE_H_
  20. #define CPU_FEATURE_H_
  21. #include <library.h>
  22. typedef enum {
  23. /** x86/x64 extensions */
  24. CPU_FEATURE_MMX = (1 << 0),
  25. CPU_FEATURE_SSE = (1 << 1),
  26. CPU_FEATURE_SSE2 = (1 << 2),
  27. CPU_FEATURE_SSE3 = (1 << 3),
  28. CPU_FEATURE_SSSE3 = (1 << 4),
  29. CPU_FEATURE_SSE41 = (1 << 5),
  30. CPU_FEATURE_SSE42 = (1 << 6),
  31. CPU_FEATURE_AVX = (1 << 7),
  32. CPU_FEATURE_RDRAND = (1 << 8),
  33. CPU_FEATURE_AESNI = (1 << 9),
  34. CPU_FEATURE_PCLMULQDQ = (1 << 10),
  35. /** Via Padlock Security features */
  36. CPU_FEATURE_PADLOCK_RNG_AVAILABLE = (1 << 22),
  37. CPU_FEATURE_PADLOCK_RNG_ENABLED = (1 << 23),
  38. CPU_FEATURE_PADLOCK_ACE_AVAILABLE = (1 << 24),
  39. CPU_FEATURE_PADLOCK_ACE_ENABLED = (1 << 25),
  40. CPU_FEATURE_PADLOCK_ACE2_AVAILABLE = (1 << 26),
  41. CPU_FEATURE_PADLOCK_ACE2_ENABLED = (1 << 27),
  42. CPU_FEATURE_PADLOCK_PHE_AVAILABLE = (1 << 28),
  43. CPU_FEATURE_PADLOCK_PHE_ENABLED = (1 << 29),
  44. CPU_FEATURE_PADLOCK_PMM_AVAILABLE = (1 << 30),
  45. CPU_FEATURE_PADLOCK_PMM_ENABLED = (1 << 31),
  46. } cpu_feature_t;
  47. /**
  48. * Get a bitmask for all supported CPU features
  49. */
  50. cpu_feature_t cpu_feature_get_all();
  51. /**
  52. * Check if a given set of CPU features is available.
  53. */
  54. bool cpu_feature_available(cpu_feature_t feature);
  55. #endif /** CPU_FEATURE_H_ @}*/