Commit 1130328ecb4a247d00fa820768631d93facc832c

Authored by bellard
1 parent d6205959

cmpxchg 64 bit fix

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4521 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 4 deletions
target-i386/translate.c
... ... @@ -4286,7 +4286,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
4286 4286 case 0x1b0:
4287 4287 case 0x1b1: /* cmpxchg Ev, Gv */
4288 4288 {
4289   - int label1;
  4289 + int label1, label2;
4290 4290  
4291 4291 if ((b & 1) == 0)
4292 4292 ot = OT_BYTE;
... ... @@ -4309,12 +4309,18 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
4309 4309 tcg_gen_sub_tl(cpu_T3, cpu_T3, cpu_T[0]);
4310 4310 gen_extu(ot, cpu_T3);
4311 4311 tcg_gen_brcond_tl(TCG_COND_EQ, cpu_T3, tcg_const_tl(0), label1);
4312   - tcg_gen_mov_tl(cpu_T[1], cpu_T[0]);
4313   - gen_op_mov_reg_T0(ot, R_EAX);
4314   - gen_set_label(label1);
4315 4312 if (mod == 3) {
  4313 + label2 = gen_new_label();
  4314 + gen_op_mov_reg_T0(ot, R_EAX);
  4315 + tcg_gen_br(label2);
  4316 + gen_set_label(label1);
4316 4317 gen_op_mov_reg_T1(ot, rm);
  4318 + gen_set_label(label2);
4317 4319 } else {
  4320 + tcg_gen_mov_tl(cpu_T[1], cpu_T[0]);
  4321 + gen_op_mov_reg_T0(ot, R_EAX);
  4322 + gen_set_label(label1);
  4323 + /* always store */
4318 4324 gen_op_st_T1_A0(ot + s->mem_index);
4319 4325 }
4320 4326 tcg_gen_mov_tl(cpu_cc_src, cpu_T[0]);
... ...