Commit 278ed7c329b7e5a8dbef8da7efd42a5b73ca785d

Authored by bellard
1 parent caa88be0

cmpxchg fixes

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4755 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 7 additions and 0 deletions
target-i386/op_helper.c
... ... @@ -1837,6 +1837,8 @@ void helper_cmpxchg8b(target_ulong a0)
1837 1837 stq(a0, ((uint64_t)ECX << 32) | (uint32_t)EBX);
1838 1838 eflags |= CC_Z;
1839 1839 } else {
  1840 + /* always do the store */
  1841 + stq(a0, d);
1840 1842 EDX = (uint32_t)(d >> 32);
1841 1843 EAX = (uint32_t)d;
1842 1844 eflags &= ~CC_Z;
... ... @@ -1850,6 +1852,8 @@ void helper_cmpxchg16b(target_ulong a0)
1850 1852 uint64_t d0, d1;
1851 1853 int eflags;
1852 1854  
  1855 + if ((a0 & 0xf) != 0)
  1856 + raise_exception(EXCP0D_GPF);
1853 1857 eflags = cc_table[CC_OP].compute_all();
1854 1858 d0 = ldq(a0);
1855 1859 d1 = ldq(a0 + 8);
... ... @@ -1858,6 +1862,9 @@ void helper_cmpxchg16b(target_ulong a0)
1858 1862 stq(a0 + 8, ECX);
1859 1863 eflags |= CC_Z;
1860 1864 } else {
  1865 + /* always do the store */
  1866 + stq(a0, d0);
  1867 + stq(a0 + 8, d1);
1861 1868 EDX = d1;
1862 1869 EAX = d0;
1863 1870 eflags &= ~CC_Z;
... ...