You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cpuid.h 7.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*********************************************************************/
  2. /* Copyright 2009, 2010 The University of Texas at Austin. */
  3. /* All rights reserved. */
  4. /* */
  5. /* Redistribution and use in source and binary forms, with or */
  6. /* without modification, are permitted provided that the following */
  7. /* conditions are met: */
  8. /* */
  9. /* 1. Redistributions of source code must retain the above */
  10. /* copyright notice, this list of conditions and the following */
  11. /* disclaimer. */
  12. /* */
  13. /* 2. Redistributions in binary form must reproduce the above */
  14. /* copyright notice, this list of conditions and the following */
  15. /* disclaimer in the documentation and/or other materials */
  16. /* provided with the distribution. */
  17. /* */
  18. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  19. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  20. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  21. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  22. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  23. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  24. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  25. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  26. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  27. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  28. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  29. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  30. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  31. /* POSSIBILITY OF SUCH DAMAGE. */
  32. /* */
  33. /* The views and conclusions contained in the software and */
  34. /* documentation are those of the authors and should not be */
  35. /* interpreted as representing official policies, either expressed */
  36. /* or implied, of The University of Texas at Austin. */
  37. /*********************************************************************/
  38. #ifndef CPUID_H
  39. #define CPUID_H
  40. #if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
  41. #define INTEL_AMD
  42. #endif
  43. #define VENDOR_INTEL 1
  44. #define VENDOR_UMC 2
  45. #define VENDOR_AMD 3
  46. #define VENDOR_CYRIX 4
  47. #define VENDOR_NEXGEN 5
  48. #define VENDOR_CENTAUR 6
  49. #define VENDOR_RISE 7
  50. #define VENDOR_SIS 8
  51. #define VENDOR_TRANSMETA 9
  52. #define VENDOR_NSC 10
  53. #define VENDOR_UNKNOWN 99
  54. #define BITMASK(a, b, c) ((((a) >> (b)) & (c)))
  55. #define FAMILY_80486 4
  56. #define FAMILY_P5 5
  57. #define FAMILY_P6 6
  58. #define FAMILY_PM 7
  59. #define FAMILY_IA64 8
  60. #ifdef INTEL_AMD
  61. #define GET_EXFAMILY 1
  62. #define GET_EXMODEL 2
  63. #define GET_TYPE 3
  64. #define GET_FAMILY 4
  65. #define GET_MODEL 5
  66. #define GET_APICID 6
  67. #define GET_LCOUNT 7
  68. #define GET_CHUNKS 8
  69. #define GET_STEPPING 9
  70. #define GET_BLANDID 10
  71. #define GET_FEATURE 11
  72. #define GET_NUMSHARE 12
  73. #define GET_NUMCORES 13
  74. #endif
  75. #ifdef __ia64__
  76. #define GET_ARCHREV 1
  77. #define GET_FAMILY 2
  78. #define GET_MODEL 3
  79. #define GET_REVISION 4
  80. #define GET_NUMBER 5
  81. #endif
  82. #define CORE_UNKNOWN 0
  83. #define CORE_80486 1
  84. #define CORE_P5 2
  85. #define CORE_P6 3
  86. #define CORE_KATMAI 4
  87. #define CORE_COPPERMINE 5
  88. #define CORE_NORTHWOOD 6
  89. #define CORE_PRESCOTT 7
  90. #define CORE_BANIAS 8
  91. #define CORE_ATHLON 9
  92. #define CORE_OPTERON 10
  93. #define CORE_BARCELONA 11
  94. #define CORE_VIAC3 12
  95. #define CORE_YONAH 13
  96. #define CORE_CORE2 14
  97. #define CORE_PENRYN 15
  98. #define CORE_DUNNINGTON 16
  99. #define CORE_NEHALEM 17
  100. #define CORE_ATOM 18
  101. #define CORE_NANO 19
  102. #define CORE_SANDYBRIDGE 20
  103. #define CORE_BOBCAT 21
  104. #define CORE_BULLDOZER 22
  105. #define CORE_PILEDRIVER 23
  106. #define CORE_HASWELL 24
  107. #define CORE_STEAMROLLER 25
  108. #define CORE_EXCAVATOR 26
  109. #define HAVE_SSE (1 << 0)
  110. #define HAVE_SSE2 (1 << 1)
  111. #define HAVE_SSE3 (1 << 2)
  112. #define HAVE_SSSE3 (1 << 3)
  113. #define HAVE_SSE4_1 (1 << 4)
  114. #define HAVE_SSE4_2 (1 << 5)
  115. #define HAVE_SSE4A (1 << 6)
  116. #define HAVE_SSE5 (1 << 7)
  117. #define HAVE_MMX (1 << 8)
  118. #define HAVE_3DNOW (1 << 9)
  119. #define HAVE_3DNOWEX (1 << 10)
  120. #define HAVE_CMOV (1 << 11)
  121. #define HAVE_PSE (1 << 12)
  122. #define HAVE_CFLUSH (1 << 13)
  123. #define HAVE_HIT (1 << 14)
  124. #define HAVE_MISALIGNSSE (1 << 15)
  125. #define HAVE_128BITFPU (1 << 16)
  126. #define HAVE_FASTMOVU (1 << 17)
  127. #define HAVE_AVX (1 << 18)
  128. #define HAVE_FMA4 (1 << 19)
  129. #define HAVE_FMA3 (1 << 20)
  130. #define CACHE_INFO_L1_I 1
  131. #define CACHE_INFO_L1_D 2
  132. #define CACHE_INFO_L2 3
  133. #define CACHE_INFO_L3 4
  134. #define CACHE_INFO_L1_ITB 5
  135. #define CACHE_INFO_L1_DTB 6
  136. #define CACHE_INFO_L1_LITB 7
  137. #define CACHE_INFO_L1_LDTB 8
  138. #define CACHE_INFO_L2_ITB 9
  139. #define CACHE_INFO_L2_DTB 10
  140. #define CACHE_INFO_L2_LITB 11
  141. #define CACHE_INFO_L2_LDTB 12
  142. typedef struct {
  143. int size;
  144. int associative;
  145. int linesize;
  146. int shared;
  147. } cache_info_t;
  148. #define CPUTYPE_UNKNOWN 0
  149. #define CPUTYPE_INTEL_UNKNOWN 1
  150. #define CPUTYPE_UMC_UNKNOWN 2
  151. #define CPUTYPE_AMD_UNKNOWN 3
  152. #define CPUTYPE_CYRIX_UNKNOWN 4
  153. #define CPUTYPE_NEXGEN_UNKNOWN 5
  154. #define CPUTYPE_CENTAUR_UNKNOWN 6
  155. #define CPUTYPE_RISE_UNKNOWN 7
  156. #define CPUTYPE_SIS_UNKNOWN 8
  157. #define CPUTYPE_TRANSMETA_UNKNOWN 9
  158. #define CPUTYPE_NSC_UNKNOWN 10
  159. #define CPUTYPE_80386 11
  160. #define CPUTYPE_80486 12
  161. #define CPUTYPE_PENTIUM 13
  162. #define CPUTYPE_PENTIUM2 14
  163. #define CPUTYPE_PENTIUM3 15
  164. #define CPUTYPE_PENTIUMM 16
  165. #define CPUTYPE_PENTIUM4 17
  166. #define CPUTYPE_CORE2 18
  167. #define CPUTYPE_PENRYN 19
  168. #define CPUTYPE_DUNNINGTON 20
  169. #define CPUTYPE_NEHALEM 21
  170. #define CPUTYPE_ATOM 22
  171. #define CPUTYPE_ITANIUM 23
  172. #define CPUTYPE_ITANIUM2 24
  173. #define CPUTYPE_AMD5X86 25
  174. #define CPUTYPE_AMDK6 26
  175. #define CPUTYPE_ATHLON 27
  176. #define CPUTYPE_DURON 28
  177. #define CPUTYPE_OPTERON 29
  178. #define CPUTYPE_BARCELONA 30
  179. #define CPUTYPE_SHANGHAI 31
  180. #define CPUTYPE_ISTANBUL 32
  181. #define CPUTYPE_CYRIX5X86 33
  182. #define CPUTYPE_CYRIXM1 34
  183. #define CPUTYPE_CYRIXM2 35
  184. #define CPUTYPE_NEXGENNX586 36
  185. #define CPUTYPE_CENTAURC6 37
  186. #define CPUTYPE_RISEMP6 38
  187. #define CPUTYPE_SYS55X 39
  188. #define CPUTYPE_CRUSOETM3X 40
  189. #define CPUTYPE_NSGEODE 41
  190. #define CPUTYPE_VIAC3 42
  191. #define CPUTYPE_NANO 43
  192. #define CPUTYPE_SANDYBRIDGE 44
  193. #define CPUTYPE_BOBCAT 45
  194. #define CPUTYPE_BULLDOZER 46
  195. #define CPUTYPE_PILEDRIVER 47
  196. #define CPUTYPE_HASWELL 48
  197. #define CPUTYPE_STEAMROLLER 49
  198. #define CPUTYPE_EXCAVATOR 50
  199. #endif