From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH v2] x86: emulator: Fix h_mem usage in tests_smsw Date: Wed, 03 Dec 2014 16:46:12 +0100 Message-ID: <547F3044.3090609@redhat.com> References: <547ED4B1.4080805@redhat.com> <1417621455-22031-1-git-send-email-chris.j.arges@canonical.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: namit@cs.technion.ac.il To: Chris J Arges , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52705 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751360AbaLCPqY (ORCPT ); Wed, 3 Dec 2014 10:46:24 -0500 In-Reply-To: <1417621455-22031-1-git-send-email-chris.j.arges@canonical.com> Sender: kvm-owner@vger.kernel.org List-ID: On 03/12/2014 16:44, Chris J Arges wrote: > In emulator.c/tests_smsw, smsw (3) fails because h_mem isn't being set correctly > before smsw is called. By using the + constraint modifier for memory we can > ensure the compiler no longer optimizes out the assignment before smsw. > > Signed-off-by: Chris J Arges > --- > x86/emulator.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/x86/emulator.c b/x86/emulator.c > index 5aa4dbf..1e05574 100644 > --- a/x86/emulator.c > +++ b/x86/emulator.c > @@ -359,7 +359,7 @@ void test_smsw(uint64_t *h_mem) > > /* Trigger exit on smsw */ > *h_mem = 0x12345678abcdeful; > - asm volatile("smsw %0" : "=m"(*h_mem)); > + asm volatile("smsw %0" : "+m"(*h_mem)); > report("smsw (3)", msw == (unsigned short)*h_mem && > (*h_mem & ~0xfffful) == 0x12345678ab0000ul); > } > Applied, thanks. Paolo