From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHboA-0006fO-Fp for qemu-devel@nongnu.org; Mon, 27 Jun 2016 15:02:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHbo6-0008HU-UX for qemu-devel@nongnu.org; Mon, 27 Jun 2016 15:02:57 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:38291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHbo5-0008Cb-KE for qemu-devel@nongnu.org; Mon, 27 Jun 2016 15:02:54 -0400 From: "Emilio G. Cota" Date: Mon, 27 Jun 2016 15:02:00 -0400 Message-Id: <1467054136-10430-15-git-send-email-cota@braap.org> In-Reply-To: <1467054136-10430-1-git-send-email-cota@braap.org> References: <1467054136-10430-1-git-send-email-cota@braap.org> Subject: [Qemu-devel] [RFC 14/30] target-i386: emulate LOCK'ed NOT using atomic helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developers , MTTCG Devel Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Richard Henderson , Sergey Fedorov , Alvise Rigo , Peter Maydell Signed-off-by: Emilio G. Cota --- target-i386/translate.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index a9fa25a..fcccb1a 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -4784,11 +4784,19 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, set_cc_op(s, CC_OP_LOGICB + ot); break; case 2: /* not */ - tcg_gen_not_tl(cpu_T0, cpu_T0); - if (mod != 3) { - gen_op_st_v(s, ot, cpu_T0, cpu_A0); + if (s->prefix & PREFIX_LOCK) { + if (mod == 3) { + goto illegal_op; + } + tcg_gen_movi_tl(cpu_T0, ~0); + gen_atomic_xor_fetch(cpu_T0, cpu_A0, cpu_T0, ot); } else { - gen_op_mov_reg_v(ot, rm, cpu_T0); + tcg_gen_not_tl(cpu_T0, cpu_T0); + if (mod != 3) { + gen_op_st_v(s, ot, cpu_T0, cpu_A0); + } else { + gen_op_mov_reg_v(ot, rm, cpu_T0); + } } break; case 3: /* neg */ -- 2.5.0