Cpuid says that I have rdrand on my system, but rdrand instruction throws sigill. I'm using linux mint inside VmWare workstation 11, I googled workstation support of rdrand, and they say that it enabled since 9th version. Proccess of host is i5-2550k and it should support rdrand. Can I somehow fix this? Here is gdb listing:
Breakpoint 1, 0x08048060 in _start ()
(gdb) x/5i $eip
=> 0x8048060 <_start>: mov $0x1,%eax
0x8048065 <_start+5>: cpuid
0x8048067 <_start+7>: rdrand %eax
0x804806a <_start+10>: mov $0x1,%eax
0x804806f <_start+15>: int $0x80
(gdb) si 2
0x08048067 in _start ()
(gdb) p/t $ecx
$1 = 10011111101110100010001000000011 ; bit 30 is set -- rdrand enabled.
(gdb) p/t $ebx
$2 = 10000100000000000
(gdb) p/t $eax
$3 = 100000011010100111
(gdb) si
Program received signal SIGILL, Illegal instruction.
0x08048067 in _start ()
Breakpoint 1, 0x08048060 in _start ()
(gdb) x/5i $eip
=> 0x8048060 <_start>: mov $0x1,%eax
0x8048065 <_start+5>: cpuid
0x8048067 <_start+7>: rdrand %eax
0x804806a <_start+10>: mov $0x1,%eax
0x804806f <_start+15>: int $0x80
(gdb) si 2
0x08048067 in _start ()
(gdb) p/t $ecx
$1 = 10011111101110100010001000000011
(gdb) p/t $ebx
$2 = 10000100000000000
(gdb) p/t $eax
$3 = 100000011010100111
(gdb) si
Program received signal SIGILL, Illegal instruction.
0x08048067 in _start ()
You've read the ECX register wrong. The RDRAND bit is not set. Bit 30 is the second bit from the left:
The above image is taken from the CPUID instruction description given in the Intel 64 and IA-32 Architectures Software Developer’s Manual.
Also your i5-2550K CPU is a Sandy Bridge processor. RDRAND wasn't introduced until the next generation of Intel processors, Ivy Bridge.