PageRenderTime 54ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/kruntime/doc/core_cpuid.html

https://github.com/SDX2000/helios
HTML | 305 lines | 258 code | 46 blank | 1 comment | 0 complexity | f9464b7d6f490a1e38d13a1809fb5e5d MD5 | raw file
  1. <html><head>
  2. <META http-equiv="content-type" content="text/html; charset=utf-8">
  3. <title>core.cpuid</title>
  4. </head><body>
  5. <h1>core.cpuid</h1>
  6. <!-- Generated by Ddoc from src\core\cpuid.d -->
  7. Identify the characteristics of the host CPU, providing information
  8. about cache sizes and assembly optimisation hints.
  9. <br><br>
  10. <b>References:</b><br>
  11. Some of this information was extremely difficult to track down. Some of the
  12. documents below were found only in cached versions stored by search engines!
  13. This code relies on information found in:
  14. <br><br>
  15. <ul><li>"Intel(R) 64 and IA-32 Architectures Software Developers Manual,
  16. Volume 2A: Instruction Set Reference, A-M" (2007).
  17. </li>
  18. <li>"AMD CPUID Specification", Advanced Micro Devices, Rev 2.28 (2008).
  19. </li>
  20. <li>"AMD Processor Recognition Application Note For Processors Prior to AMD
  21. Family 0Fh Processors", Advanced Micro Devices, Rev 3.13 (2005).
  22. </li>
  23. <li>"AMD Geode(TM) GX Processors Data Book",
  24. Advanced Micro Devices, Publication ID 31505E, (2005).
  25. </li>
  26. <li>"AMD K6 Processor Code Optimisation", Advanced Micro Devices, Rev D (2000).
  27. </li>
  28. <li>"Application note 106: Software Customization for the 6x86 Family",
  29. Cyrix Corporation, Rev 1.5 (1998)
  30. </li>
  31. <li><a href="www.datasheetcatalog.org/datasheet/nationalsemiconductor/GX1.pdf">www.datasheetcatalog.org/datasheet/nationalsemiconductor/GX1.pdf</a></li>
  32. <li>"Geode(TM) GX1 Processor Series Low Power Integrated X86 Solution",
  33. National Semiconductor, (2002)
  34. </li>
  35. <li>"The VIA Isaiah Architecture", G. Glenn Henry, Centaur Technology, Inc (2008).
  36. </li>
  37. <li><a href="http://www.sandpile.org/ia32/cpuid.htm">http://www.sandpile.org/ia32/cpuid.htm</a></li>
  38. <li><a href="www.akkadia.org/drepper/cpumemory.pdf">www.akkadia.org/drepper/cpumemory.pdf</a></li>
  39. <li>"What every programmer should know about memory",
  40. Ulrich Depper, Red Hat, Inc., (2007).
  41. </li>
  42. <li>"CPU Identification by the Windows Kernel", G. Chappell (2009).
  43. <a href="http://www.geoffchappell.com/viewer.htm?doc=studies/windows/km/cpu/cx8.htm">http://www.geoffchappell.com/viewer.htm?doc=studies/windows/km/cpu/cx8.htm</a>
  44. </li>
  45. <li>"Intel(R) Processor Identification and the CPUID Instruction, Application
  46. Note 485" (2009).
  47. </li>
  48. </ul>
  49. <br><br>
  50. <font color=red>BUGS:</font><br>
  51. Currently only works on x86 and Itanium CPUs.
  52. Many processors have bugs in their microcode for the CPUID instruction,
  53. so sometimes the cache information may be incorrect.
  54. <br><br>
  55. <b>License:</b><br>
  56. <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>
  57. <br><br>
  58. <b>Authors:</b><br>
  59. Don Clugston, Tomas Lindquist Olsen &lt;tomas@famolsen.dk&gt;
  60. <br><br>
  61. <b>Source:</b><br>
  62. <br><br>
  63. <dl><dt><big>struct <u>CacheInfo</u>;
  64. </big></dt>
  65. <dd>Cache size and behaviour<br><br>
  66. <dl><dt><big>uint <u>size</u>;
  67. </big></dt>
  68. <dd>Size of the cache, in kilobytes, per CPU.
  69. For L1 unified (data + code) caches, this <u>size</u> is half the physical <u>size</u>.
  70. (we don't halve it for larger sizes, since normally
  71. data <u>size</u> is much greater than code <u>size</u> for critical loops).<br><br>
  72. </dd>
  73. <dt><big>ubyte <u>associativity</u>;
  74. </big></dt>
  75. <dd>Number of ways of <u>associativity</u>, eg:
  76. 1 = direct mapped
  77. 2 = 2-way set associative
  78. 3 = 3-way set associative
  79. ubyte.max = fully associative<br><br>
  80. </dd>
  81. <dt><big>uint <u>lineSize</u>;
  82. </big></dt>
  83. <dd>Number of bytes read into the cache when a cache miss occurs.<br><br>
  84. </dd>
  85. </dl>
  86. </dd>
  87. <dt><big>string <u>vendor</u>();
  88. </big></dt>
  89. <dd>Returns <u>vendor</u> string, for display purposes only.
  90. Do NOT use this to determine features!
  91. Note that some CPUs have programmable vendorIDs.<br><br>
  92. </dd>
  93. <dt><big>string <u>processor</u>();
  94. </big></dt>
  95. <dd>Returns <u>processor</u> string, for display purposes only<br><br>
  96. </dd>
  97. <dt><big>CacheInfo[5u] <u>datacache</u>;
  98. </big></dt>
  99. <dd>The data caches. If there are fewer than 5 physical caches levels,
  100. the remaining levels are set to uint.max (== entire memory space)<br><br>
  101. </dd>
  102. <dt><big>@property bool <u>x87onChip</u>();
  103. </big></dt>
  104. <dd>Does it have an x87 FPU on-chip?<br><br>
  105. </dd>
  106. <dt><big>@property bool <u>mmx</u>();
  107. </big></dt>
  108. <dd>Is MMX supported?<br><br>
  109. </dd>
  110. <dt><big>@property bool <u>sse</u>();
  111. </big></dt>
  112. <dd>Is SSE supported?<br><br>
  113. </dd>
  114. <dt><big>@property bool <u>sse2</u>();
  115. </big></dt>
  116. <dd>Is SSE2 supported?<br><br>
  117. </dd>
  118. <dt><big>@property bool <u>sse3</u>();
  119. </big></dt>
  120. <dd>Is SSE3 supported?<br><br>
  121. </dd>
  122. <dt><big>@property bool <u>ssse3</u>();
  123. </big></dt>
  124. <dd>Is SSSE3 supported?<br><br>
  125. </dd>
  126. <dt><big>@property bool <u>sse41</u>();
  127. </big></dt>
  128. <dd>Is SSE4.1 supported?<br><br>
  129. </dd>
  130. <dt><big>@property bool <u>sse42</u>();
  131. </big></dt>
  132. <dd>Is SSE4.2 supported?<br><br>
  133. </dd>
  134. <dt><big>@property bool <u>sse4a</u>();
  135. </big></dt>
  136. <dd>Is SSE4a supported?<br><br>
  137. </dd>
  138. <dt><big>@property bool <u>amd3dnow</u>();
  139. </big></dt>
  140. <dd>Is AMD 3DNOW supported?<br><br>
  141. </dd>
  142. <dt><big>@property bool <u>amd3dnowExt</u>();
  143. </big></dt>
  144. <dd>Is AMD 3DNOW Ext supported?<br><br>
  145. </dd>
  146. <dt><big>@property bool <u>amdMmx</u>();
  147. </big></dt>
  148. <dd>Are AMD extensions to MMX supported?<br><br>
  149. </dd>
  150. <dt><big>@property bool <u>hasFxsr</u>();
  151. </big></dt>
  152. <dd>Is fxsave/fxrstor supported?<br><br>
  153. </dd>
  154. <dt><big>@property bool <u>hasCmov</u>();
  155. </big></dt>
  156. <dd>Is cmov supported?<br><br>
  157. </dd>
  158. <dt><big>@property bool <u>hasRdtsc</u>();
  159. </big></dt>
  160. <dd>Is rdtsc supported?<br><br>
  161. </dd>
  162. <dt><big>@property bool <u>hasCmpxchg8b</u>();
  163. </big></dt>
  164. <dd>Is cmpxchg8b supported?<br><br>
  165. </dd>
  166. <dt><big>@property bool <u>hasCmpxchg16b</u>();
  167. </big></dt>
  168. <dd>Is cmpxchg8b supported?<br><br>
  169. </dd>
  170. <dt><big>@property bool <u>hasSysEnterSysExit</u>();
  171. </big></dt>
  172. <dd>Is SYSENTER/SYSEXIT supported?<br><br>
  173. </dd>
  174. <dt><big>@property bool <u>has3dnowPrefetch</u>();
  175. </big></dt>
  176. <dd>Is 3DNow prefetch supported?<br><br>
  177. </dd>
  178. <dt><big>@property bool <u>hasLahfSahf</u>();
  179. </big></dt>
  180. <dd>Are LAHF and SAHF supported in 64-bit mode?<br><br>
  181. </dd>
  182. <dt><big>@property bool <u>hasPopcnt</u>();
  183. </big></dt>
  184. <dd>Is POPCNT supported?<br><br>
  185. </dd>
  186. <dt><big>@property bool <u>hasLzcnt</u>();
  187. </big></dt>
  188. <dd>Is LZCNT supported?<br><br>
  189. </dd>
  190. <dt><big>@property bool <u>isX86_64</u>();
  191. </big></dt>
  192. <dd>Is this an Intel64 or AMD 64?<br><br>
  193. </dd>
  194. <dt><big>@property bool <u>isItanium</u>();
  195. </big></dt>
  196. <dd>Is this an IA64 (Itanium) processor?<br><br>
  197. </dd>
  198. <dt><big>@property bool <u>hyperThreading</u>();
  199. </big></dt>
  200. <dd>Is hyperthreading supported?<br><br>
  201. </dd>
  202. <dt><big>@property uint <u>threadsPerCPU</u>();
  203. </big></dt>
  204. <dd>Returns number of threads per CPU<br><br>
  205. </dd>
  206. <dt><big>@property uint <u>coresPerCPU</u>();
  207. </big></dt>
  208. <dd>Returns number of cores in CPU<br><br>
  209. </dd>
  210. <dt><big>@property bool <u>preferAthlon</u>();
  211. </big></dt>
  212. <dd>Optimisation hints for assembly code.
  213. For forward compatibility, the CPU is compared against different
  214. microarchitectures. For 32-bit X86, comparisons are made against
  215. the Intel PPro/PII/PIII/PM family.
  216. <br><br>
  217. The major 32-bit x86 microarchitecture 'dynasties' have been:
  218. (1) Intel P6 (PentiumPro, PII, PIII, PM, Core, Core2).
  219. (2) AMD Athlon (K7, K8, K10).
  220. (3) Intel NetBurst (Pentium 4, Pentium D).
  221. (4) In-order Pentium (Pentium1, PMMX, Atom)
  222. Other early CPUs (Nx586, AMD K5, K6, Centaur C3, Transmeta,
  223. Cyrix, Rise) were mostly in-order.
  224. Some new processors do not fit into the existing categories:
  225. Intel Atom 230/330 (family 6, model 0x1C) is an in-order core.
  226. Centaur Isiah = VIA Nano (family 6, model F) is an out-of-order core.
  227. <br><br>
  228. Within each dynasty, the optimisation techniques are largely
  229. identical (eg, use instruction pairing for group 4). Major
  230. instruction set improvements occur within each dynasty.
  231. Does this CPU perform better on AMD K7 code than PentiumPro..Core2 code?<br><br>
  232. </dd>
  233. <dt><big>@property bool <u>preferPentium4</u>();
  234. </big></dt>
  235. <dd>Does this CPU perform better on Pentium4 code than PentiumPro..Core2 code?<br><br>
  236. </dd>
  237. <dt><big>@property bool <u>preferPentium1</u>();
  238. </big></dt>
  239. <dd>Does this CPU perform better on Pentium I code than Pentium Pro code?<br><br>
  240. </dd>
  241. <dt><big>uint <u>stepping</u>;
  242. </big></dt>
  243. <dd>Processor type (vendor-dependent).
  244. This should be visible ONLY for display purposes.<br><br>
  245. </dd>
  246. <dt><big>uint <u>model</u>;
  247. </big></dt>
  248. <dd>Processor type (vendor-dependent).
  249. This should be visible ONLY for display purposes.<br><br>
  250. </dd>
  251. <dt><big>uint <u>family</u>;
  252. </big></dt>
  253. <dd>Processor type (vendor-dependent).
  254. This should be visible ONLY for display purposes.<br><br>
  255. </dd>
  256. </dl>
  257. <hr><small>Page generated by <a href="http://www.digitalmars.com/d/2.0/ddoc.html">Ddoc</a>. Copyright Don Clugston 2007 - 2009.
  258. </small>
  259. </body></html>