mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
Kernel: Add helpers for rdrand and rdseed
This commit is contained in:
parent
8ab25f8d8c
commit
a9764dabee
1 changed files with 22 additions and 0 deletions
|
@ -160,6 +160,28 @@ ALWAYS_INLINE u64 read_tsc()
|
|||
return ((u64)msw << 32) | lsw;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u32 rdrand()
|
||||
{
|
||||
u32 value;
|
||||
asm volatile(
|
||||
"1:\n"
|
||||
"rdrand %0\n"
|
||||
"jnc 1b\n"
|
||||
: "=r"(value)::"cc");
|
||||
return value;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u32 rdseed()
|
||||
{
|
||||
u32 value;
|
||||
asm volatile(
|
||||
"1:\n"
|
||||
"rdseed %0\n"
|
||||
"jnc 1b\n"
|
||||
: "=r"(value)::"cc");
|
||||
return value;
|
||||
}
|
||||
|
||||
void stac();
|
||||
void clac();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue