From: Richard Henderson <rth@twiddle.net>
To: Laurent Vivier <laurent@vivier.eu>, qemu-devel@nongnu.org
Cc: schwab@linux-m68k.org, agraf@suse.de, gerg@uclinux.org
Subject: Re: [Qemu-devel] [PATCH v3 2/2] target-m68k: add cas/cas2 ops
Date: Tue, 8 Nov 2016 11:26:16 +0100 [thread overview]
Message-ID: <56972b25-0a7b-508e-511b-cdf60be3d88f@twiddle.net> (raw)
In-Reply-To: <1478541561-16718-3-git-send-email-laurent@vivier.eu>
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 <exec/cpu_ldst.h> 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~
prev parent reply other threads:[~2016-11-08 10:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-07 17:59 [Qemu-devel] [PATCH v3 0/2] target-m68k: add movem, BCD and CAS instructions Laurent Vivier
2016-11-07 17:59 ` [Qemu-devel] [PATCH v3 1/2] target-m68k: add abcd/sbcd/nbcd Laurent Vivier
2016-11-08 10:11 ` Richard Henderson
2016-11-08 10:21 ` Laurent Vivier
2016-11-07 17:59 ` [Qemu-devel] [PATCH v3 2/2] target-m68k: add cas/cas2 ops Laurent Vivier
2016-11-08 10:26 ` Richard Henderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56972b25-0a7b-508e-511b-cdf60be3d88f@twiddle.net \
--to=rth@twiddle.net \
--cc=agraf@suse.de \
--cc=gerg@uclinux.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).