Cpuid说我的系统上有rdrand,但是rdrand指令抛出西格。我在VmWare工作站11中使用linux,我在googled上搜索了对rdrand的工作站支持,他们说它从第9版就启用了。寄主过程为i5-2550k,应支持rdrand。我能解决这个问题吗?以下是gdb的清单:
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 ()发布于 2015-06-16 09:11:19
你看错了ECX寄存器。未设置RDRAND位。第30位是左边的第二个位:
10011111101110100010001000000011
^
Bit 30 ^ Bit 0

以上图片取自英特尔64和IA-32架构软件开发人员手册中给出的CPUID指令说明。
此外,您的i5-2550K CPU是一个桑迪桥处理器。直到下一代英特尔处理器Ivy Bridge才推出RDRAND。
发布于 2020-07-07 19:15:03
RdRand是在常春藤桥上引入的。i5-2550K是上一代沙桥的一部分。
https://stackoverflow.com/questions/30860025
复制相似问题