git://scm.lunaixsky.com
/
lunaix-os.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
feat: kernel stack tracing
[lunaix-os.git]
/
lunaix-os
/
includes
/
hal
/
rnd.h
1
#ifndef __LUNAIX_RND_H
2
#define __LUNAIX_RND_H
3
4
#include <lunaix/types.h>
5
6
static inline void
7
rnd_fill(void* data, size_t len)
8
{
9
asm volatile("1:\n"
10
"rdrand %%eax\n"
11
"movl %%eax, (%0)\n"
12
"addl $4, %%eax\n"
13
"subl $4, %1\n"
14
"jnz 1b" ::"r"((ptr_t)data),
15
"r"((len & ~0x3))
16
: "%eax");
17
}
18
19
int
20
rnd_is_supported();
21
22
#endif /* __LUNAIX_RND_H */