|
From: John R. <jr...@Bi...> - 2014-02-11 03:43:14
|
On 02/10/2014 03:35 PM, Jeffrey Walton wrote: > I've got some code that determines CPU capabilities for x86 > processors. I'm interested in RDRAND and AESNI, and I use three > functions to determine the capabilities: HasIntel(), HasAESNI() and > HasRDRAND(). > > Debug configurations compiled with GCC and Clang work fine. Release > configuration compiled with GCC and Clang work fine. > > However, I get *one* incorrect result when running under Valgrind. The > incorrect result is from HasRDRAND(). Under Valgrind, the result is 0, > which means RDRAND is not available. Valgrind deliberately "fakes" the results of CPUID so that the bits reflect the virtual machine that valgrind knows how to support. Valgrind does not know how to implement RDRAND. [Only Intel and very few others know *exactly* what RDRAND does.] A quick search of the web for "valgrind CPUID" will fill in the details. It's even documented: search for 'CPUID' or 'SSE2' in and below the docs/ directory of the source tree. -- |