Message ID | 1417558962-28481-1-git-send-email-chris.j.arges@canonical.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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;
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(-)