Re: [kvm-unit-tests PATCH v1 2/2] s390x: use inline assembly to test for addressing exceptions

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

 



On 26.06.2017 18:15, David Hildenbrand wrote:
> GCC is free to generate multiple stores instead of just one (e.g.
> observed by switching to -O0), making the test fail.
> 
> Make sure we really only have one store.
> 
> Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
> ---
>  s390x/selftest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/s390x/selftest.c b/s390x/selftest.c
> index 87eb934..1c8d16a 100644
> --- a/s390x/selftest.c
> +++ b/s390x/selftest.c
> @@ -33,7 +33,7 @@ static void test_pgm_int(void)
>  	check_pgm_int_code(PGM_INT_CODE_OPERATION);
>  
>  	expect_pgm_int();
> -	*((unsigned int*)-1) = 1;
> +	asm volatile("	stg %0,0(%0)\n" : : "r"(-1));
>  	check_pgm_int_code(PGM_INT_CODE_ADDRESSING);
>  }

I guess using a volatile pointer would work, too? Anyway, the inline
assembly looks certainly also fine here, so:

Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>



[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