From: Paolo Bonzini <pbonzini@redhat.com>
To: Chris J Arges <chris.j.arges@canonical.com>, kvm@vger.kernel.org
Cc: namit@cs.technion.ac.il
Subject: Re: [kvm-unit-tests PATCH] x86: emulator: Fix h_mem usage in tests_smsw
Date: Wed, 03 Dec 2014 10:15:29 +0100 [thread overview]
Message-ID: <547ED4B1.4080805@redhat.com> (raw)
In-Reply-To: <1417558962-28481-1-git-send-email-chris.j.arges@canonical.com>
On 02/12/2014 23:22, 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 declaring the h_mem function parameter as volatile,
> the compiler no longer optimizes out the assignment before smsw.
>
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> ---
> x86/emulator.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/x86/emulator.c b/x86/emulator.c
> index 5aa4dbf..570628f 100644
> --- a/x86/emulator.c
> +++ b/x86/emulator.c
> @@ -337,7 +337,7 @@ void test_incdecnotneg(void *mem)
> report("lock notb", *mb == vb);
> }
>
> -void test_smsw(uint64_t *h_mem)
> +void test_smsw(volatile uint64_t *h_mem)
> {
> char mem[16];
> unsigned short msw, msw_orig, *pmsw;
>
What if you change
asm volatile("smsw %0" : "=m"(*h_mem));
to
asm volatile("smsw %0" : "+m"(*h_mem));
Paolo
next prev parent reply other threads:[~2014-12-03 9:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 22:22 [kvm-unit-tests PATCH] x86: emulator: Fix h_mem usage in tests_smsw Chris J Arges
2014-12-03 9:15 ` Paolo Bonzini [this message]
2014-12-03 15:44 ` [kvm-unit-tests PATCH v2] " Chris J Arges
2014-12-03 15:46 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=547ED4B1.4080805@redhat.com \
--to=pbonzini@redhat.com \
--cc=chris.j.arges@canonical.com \
--cc=kvm@vger.kernel.org \
--cc=namit@cs.technion.ac.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.