svn commit: r256084 - projects/random_number_generator/sys/dev/random

Mark Murray markm at FreeBSD.org
Sun Oct 6 12:35:30 UTC 2013


Author: markm
Date: Sun Oct  6 12:35:29 2013
New Revision: 256084
URL: http://svnweb.freebsd.org/changeset/base/256084

Log:
  Don't use the "real" assembler mnemonics; older compilers may not
  understand them (like when building CURRENT on 9.x).
  
  Submitted by:	Konstantin Belousov <kostikbel at gmail.com>

Modified:
  projects/random_number_generator/sys/dev/random/ivy.c
  projects/random_number_generator/sys/dev/random/nehemiah.c

Modified: projects/random_number_generator/sys/dev/random/ivy.c
==============================================================================
--- projects/random_number_generator/sys/dev/random/ivy.c	Sun Oct  6 12:31:24 2013	(r256083)
+++ projects/random_number_generator/sys/dev/random/ivy.c	Sun Oct  6 12:35:29 2013	(r256084)
@@ -65,12 +65,12 @@ ivy_rng_store(uint64_t *tmp)
 
 	__asm __volatile(
 #ifdef __amd64__
-	    "rdrand\t%%rax\n\t"
+	    ".byte\t0x48,0x0f,0xc7,0xf0\n\t" /* rdrand %rax */
 	    "jnc\t1f\n\t"
 	    "movq\t%%rax,%1\n\t"
 	    "movl\t$8,%%eax\n"
 #else /* i386 */
-	    "rdrand\t%%eax\n\t"
+	    ".byte\t0x0f,0xc7,0xf0\n\t" /* rdrand %eax */
 	    "jnc\t1f\n\t"
 	    "movl\t%%eax,%1\n\t"
 	    "movl\t$4,%%eax\n"

Modified: projects/random_number_generator/sys/dev/random/nehemiah.c
==============================================================================
--- projects/random_number_generator/sys/dev/random/nehemiah.c	Sun Oct  6 12:31:24 2013	(r256083)
+++ projects/random_number_generator/sys/dev/random/nehemiah.c	Sun Oct  6 12:35:29 2013	(r256084)
@@ -71,7 +71,7 @@ VIA_RNG_store(void *buf)
 #ifdef __GNUCLIKE_ASM
 	__asm __volatile(
 		"movl	$0,%%edx\n\t"
-		"xstore"
+		".byte	0x0f, 0xa7, 0xc0" /* xstore */
 			: "=a" (retval), "+d" (rate), "+D" (buf)
 			:
 			: "memory"


More information about the svn-src-projects mailing list