Received: from eggs.gnu.org ([2001:4830:134:3::10]:44522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c43bk-0000jg-Tc for qemu-devel@nongnu.org; Tue, 08 Nov 2016 05:26:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c43bh-0000aA-QS for qemu-devel@nongnu.org; Tue, 08 Nov 2016 05:26:24 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:33239) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c43bh-0000Zu-JL for qemu-devel@nongnu.org; Tue, 08 Nov 2016 05:26:21 -0500 Received: by mail-wm0-x244.google.com with SMTP id u144so21576599wmu.0 for ; Tue, 08 Nov 2016 02:26:21 -0800 (PST) Sender: Richard Henderson References: <1478541561-16718-1-git-send-email-laurent@vivier.eu> <1478541561-16718-3-git-send-email-laurent@vivier.eu> From: Richard Henderson Message-ID: <56972b25-0a7b-508e-511b-cdf60be3d88f@twiddle.net> Date: Tue, 8 Nov 2016 11:26:16 +0100 MIME-Version: 1.0 In-Reply-To: <1478541561-16718-3-git-send-email-laurent@vivier.eu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/2] target-m68k: add cas/cas2 ops List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier , qemu-devel@nongnu.org Cc: schwab@linux-m68k.org, agraf@suse.de, gerg@uclinux.org On 11/07/2016 06:59 PM, Laurent Vivier wrote: > + } else { > + /* We're executing in a serial context -- no need to be atomic. */ > +#ifdef CONFIG_USER_ONLY > + int16_t *ha1 = g2h(a1); > + int16_t *ha2 = g2h(a2); > + l1 = lduw_be_p(ha1); > + l2 = lduw_be_p(ha2); > + if (l1 == c1 && l2 == c2) { > + stw_be_p(ha1, u1); > + stw_be_p(ha2, u2); > + } > +#else > + int mmu_idx = cpu_mmu_index(env, 0); > + TCGMemOpIdx oi = make_memop_idx(MO_BESW, mmu_idx); > + l1 = helper_be_lduw_mmu(env, a1, oi, ra); > + l2 = helper_be_lduw_mmu(env, a2, oi, ra); > + if (l1 == c1 && l2 == c2) { > + helper_be_stw_mmu(env, a1, u1, oi, ra); > + helper_be_stw_mmu(env, a2, u2, oi, ra); > + } > +#endif > + } I think I gave you bad advice earlier. For the non-atomic parts we can combine these by using the functions: cpu_lduw_data_ra cpu_ldl_data_ra cpu_stw_data_ra cpu_stl_data_ra > +DISAS_INSN(cas) > +{ > + int opsize; > + TCGv addr; > + uint16_t ext; > + TCGv load; > + TCGv cmp; > + TCGMemOp opc; > + > + switch ((insn >> 9) & 3) { > + case 1: > + opsize = OS_BYTE; > + opc = MO_UB; > + break; > + case 2: > + opsize = OS_WORD; > + opc = MO_TEUW; > + break; > + case 3: > + opsize = OS_LONG; > + opc = MO_TEUL; > + break; > + default: > + g_assert_not_reached(); > + } Return illegal opcode here, or 3 decode lines in register_m68k_insns. r~