Re: [kvm-unit-tests PATCH 3/4] lib/s390x: Fix the epsw inline assembly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 22 Jun 2021 15:55:16 +0200
Thomas Huth <thuth@xxxxxxxxxx> wrote:

> According to the Principles of Operation, the epsw instruction
> does not touch the second register if it is r0. With GCC we were
> lucky so far that it never tried to use r0 here, but when compiling
> the kvm-unit-tests with Clang, this indeed happens and leads to
> very weird crashes. Thus let's make sure to never use r0 for the
> second operand of the epsw instruction.
> 
> Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>

Reviewed-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>

maybe also mention in the patch description why you changed + to =

> ---
>  lib/s390x/asm/arch_def.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index 3aa5da9..15cf7d4 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -265,7 +265,7 @@ static inline uint64_t extract_psw_mask(void)
>  
>  	asm volatile(
>  		"	epsw	%0,%1\n"
> -		: "+r" (mask_upper), "+r" (mask_lower) : : );
> +		: "=r" (mask_upper), "=a" (mask_lower));
>  
>  	return (uint64_t) mask_upper << 32 | mask_lower;
>  }




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux