FreeBSD and rdrand()

Hello,

I have a server platform Intel R1208GZ4GC and E5-2620 processors. I'm trying to use RDRAND to generate random numbers. To put this code:
Code:
int _rdrand16_step(unsigned short *therand) {   
 unsigned char err;   
 asm volatile("rdrand %0 ; setc %1"   
 : "=r" (*therand), "=qm" (err));   
 return (int) err;   
  }
However, when compiling the error:
Code:
{standard input}: Assembler messages:  
{standard input}:7191: Error: no such instruction: `rdrand %dx'  
gmake: *** [../../main/main.o] Error 1
Operating system: FreeBsd FreeBSD 8.3

Updated files:
  • stable/8/sys/amd64/amd64/identcpu.c
  • stable/8/sys/amd64/include/specialreg.h
  • stable/8/sys/i386/conf/XENHVM
  • stable/8/sys/i386/i386/identcpu.c
  • stable/8/sys/i386/include/specialreg.h
http://svnweb.freebsd.org/base?view=revision&revision=240135

I recompiled the kernel and made a restart. But to no avail.

Help me, please.
 
san83 said:
Thanks for the reply. That's the first thing I thought. So I asked a question on the Intel forum: http://communities.intel.com/thread/41604. However, I was sent here.

Regarding your general question, whether your E5-2620 processors support the RDRAND instruction, they should have simply answered no.

Regarding the error, when compiling your code, it was indeed correct to send you to the FreeBSD forum. The standard FreeBSD-GCC-4.2.1 on Ivy Bridge processors wouldn't compile your code either. On the other hand, the latest clang-3.4 lang/clang-devel from the ports does compile it, even on non-Ivy-Bridge machines. Executing the code on non-Ivy-Bridge machines dumps the core, though: (Illegal instruction: 4 (core dumped)).

Conclusion: To get your code running, you need an Ivy Bridge machine and a modern compiler.
 
Please, same error here on my E5-2630.
I need to run IPSEC VPN so added this to /usr/src/sys/amd64/conf/kernel-ipsec:
Code:
options  IPSEC       #VPN vivo
options  IPSEC_NAT_T
device  crypto

make cleandepend && make depend == ok

But
make fails with the error:
Code:
{standard input}: Assembler messages:
{standard input}:90: Error: no such instruction: `rdrand %rax'
*** [ivy.o] Error code 1

Stop in /usr/src/sys/amd64/compile/kernel-ipsec

Is there a way to run IPSEC on this machine?
Code:
FreeBSD 9.2-PRERELEASE #0: Fri Jul 12 23:07:12 BRT 2013 amd64
 
Last edited by a moderator:
Back
Top