Kernel: Clobber flags in `rdrand`

This commit is contained in:
Bananymous 2025-07-18 19:36:37 +03:00
parent 7af6e1cd34
commit 5df6270e32
1 changed files with 2 additions and 1 deletions

View File

@ -21,13 +21,14 @@ namespace Kernel
if (ecx & CPUID::ECX_RDRND) if (ecx & CPUID::ECX_RDRND)
{ {
#if ARCH(x86_64) #if ARCH(x86_64)
asm volatile("rdrand %0" : "=r"(s_rand_seed)); asm volatile("rdrand %0" : "=r"(s_rand_seed) :: "flags");
#elif ARCH(i686) #elif ARCH(i686)
uint32_t lo, hi; uint32_t lo, hi;
asm volatile( asm volatile(
"rdrand %[lo];" "rdrand %[lo];"
"rdrand %[hi];" "rdrand %[hi];"
: [lo]"=r"(lo), [hi]"=r"(hi) : [lo]"=r"(lo), [hi]"=r"(hi)
:: "flags"
); );
s_rand_seed = ((uint64_t)hi << 32) | lo; s_rand_seed = ((uint64_t)hi << 32) | lo;
#else #else