mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
Kernel: Add helpers for rdrand and rdseed
This commit is contained in:
parent
8ab25f8d8c
commit
a9764dabee
Notes:
sideshowbarker
2024-07-17 16:58:34 +09:00
Author: https://github.com/IdanHo
Commit: a9764dabee
Pull-request: https://github.com/SerenityOS/serenity/pull/13179
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