diff options
Diffstat (limited to 'libc/random.c')
-rw-r--r-- | libc/random.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libc/random.c b/libc/random.c index cfd082d..2801029 100644 --- a/libc/random.c +++ b/libc/random.c @@ -19,7 +19,10 @@ u32 rdrand(void) return rand(); u32 rd; - __asm__ volatile("rdrand %%eax" : "=a"(rd)); + __asm__ volatile("1:\n" + "rdrand %0\n" + "jnc 1b\n" + : "=r"(rd)); return rd; #else return rand(); @@ -33,7 +36,10 @@ u32 rdseed(void) return rand(); u32 rd; - __asm__ volatile("rdseed %%eax" : "=a"(rd)); + __asm__ volatile("1:\n" + "rdseed %0\n" + "jnc 1b\n" + : "=r"(rd)); return rd; #else return rand(); |