aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/asm-x86/random.h
blob: 9e1fe0bc1d01d1ef23aed06faf7537bfc553e774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef __ASM_RANDOM_H__
#define __ASM_RANDOM_H__

#include <asm/processor.h>

static inline unsigned int arch_get_random(void)
{
    unsigned int val = 0;

    if ( cpu_has(&current_cpu_data, X86_FEATURE_RDRAND) )
        asm volatile ( ".byte 0x0f,0xc7,0xf0" : "+a" (val) );

    return val;
}

#endif /* __ASM_RANDOM_H__ */