On 05/04/2025 2:25 am, dm...@proton.me wrote:
> From: Denis Mukhin <dmuk...@ford.com>
>
> The new toolchain baseline knows the rdrand/rdseed instructions,
> no need to carry the workaround in the code.

A few minor notes.  Instructions in CAPITALS please to make them easier
to parse in context.  The comma ought to be a semi-colon.

You should note that arch_get_random() is adjusted too.

Also, it's useful to state "No functional change." to help reviewers. 
(Or to help archaeologies figure out the intent of the patch if they
subsequently find a bug in it.)

> diff --git a/xen/arch/x86/include/asm/random.h 
> b/xen/arch/x86/include/asm/random.h
> index 9e1fe0bc1d..e1c1c765e1 100644
> --- a/xen/arch/x86/include/asm/random.h
> +++ b/xen/arch/x86/include/asm/random.h
> @@ -8,7 +8,7 @@ static inline unsigned int arch_get_random(void)
>      unsigned int val = 0;
>  
>      if ( cpu_has(&current_cpu_data, X86_FEATURE_RDRAND) )
> -        asm volatile ( ".byte 0x0f,0xc7,0xf0" : "+a" (val) );
> +        asm volatile ( "rdrand %0" : "=a" (val) );

This was only tied to "a" because 0xf0 is the ModRM byte.  Now that we
can use the mnemonic, it can become "=r".

I've fixed all on commit.

~Andrew

Reply via email to