target-i386: fix cmpxchg instruction emulation
authorAndreas Gustafsson <gson@gson.org>
Sun, 11 Dec 2011 20:46:32 +0000 (00:46 +0400)
committerJustin M. Forbes <jforbes@redhat.com>
Tue, 10 Jan 2012 15:31:37 +0000 (09:31 -0600)
commit84c2bc4bff837a652cc1c1c2fd8db1b42aaf27fa
tree7bdcaccc681e11e2a2d7786de03791f50ec34004
parent0aa4b841b3f8a12c3d5906c33bf7b356c550c2c6
target-i386: fix cmpxchg instruction emulation

When the i386 cmpxchg instruction is executed with a memory operand
and the comparison result is "unequal", do the memory write before
changing the accumulator instead of the other way around, because
otherwise the new accumulator value will incorrectly be used in the
comparison when the instruction is restarted after a page fault.

This bug was originally reported on 2010-04-25 as
https://bugs.launchpad.net/qemu/+bug/569760

Signed-off-by: Andreas Gustafsson <gson@gson.org>
target-i386/translate.c