23 #ifndef ASM_X86_ARCHRANDOM_H
24 #define ASM_X86_ARCHRANDOM_H
26 #include <asm/processor.h>
27 #include <asm/cpufeature.h>
31 #define RDRAND_RETRY_LOOPS 10
33 #define RDRAND_INT ".byte 0x0f,0xc7,0xf0"
35 # define RDRAND_LONG ".byte 0x48,0x0f,0xc7,0xf0"
37 # define RDRAND_LONG RDRAND_INT
40 #ifdef CONFIG_ARCH_RANDOM
42 #define GET_RANDOM(name, type, rdrand, nop) \
43 static inline int name(type *v) \
46 alternative_io("movl $0, %0\n\t" \
48 "\n1: " rdrand "\n\t" \
54 ASM_OUTPUT2("=r" (ok), "=a" (*v)), \
55 "0" (RDRAND_RETRY_LOOPS)); \