From: Richard Henderson <richard.henderson@linaro.org>
To: yqwfh <amdeniulari@protonmail.com>, qemu-devel@nongnu.org
Cc: Daniele Ahmed <ahmeddan@amazon.com>
Subject: Re: [PATCH] target/i386: cmpxchg should not touch accumulator
Date: Mon, 2 Aug 2021 08:46:22 -1000 [thread overview]
Message-ID: <b314b0e0-c76e-bcc7-72a2-494ef7ae7f03@linaro.org> (raw)
In-Reply-To: <20210731190507.9007-1-amdeniulari@protonmail.com>
On 7/31/21 9:06 AM, yqwfh wrote:
> Signed-off-by: Daniele Ahmed <ahmeddan@amazon.com>
> ---
> target/i386/tcg/translate.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
> index aacb605..41386dd 100644
> --- a/target/i386/tcg/translate.c
> +++ b/target/i386/tcg/translate.c
> @@ -5366,7 +5366,6 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
> gen_lea_modrm(env, s, modrm);
> tcg_gen_atomic_cmpxchg_tl(oldv, s->A0, cmpv, newv,
> s->mem_index, ot | MO_LE);
> - gen_op_mov_reg_v(s, ot, R_EAX, oldv);
> } else {
> if (mod == 3) {
> rm = (modrm & 7) | REX_B(s);
> @@ -5381,15 +5380,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
> /* store value = (old == cmp ? new : old); */
> tcg_gen_movcond_tl(TCG_COND_EQ, newv, oldv, cmpv, newv, oldv);
> if (mod == 3) {
> - gen_op_mov_reg_v(s, ot, R_EAX, oldv);
> gen_op_mov_reg_v(s, ot, rm, newv);
> - } else {
> - /* Perform an unconditional store cycle like physical cpu;
> - must be before changing accumulator to ensure
> - idempotency if the store faults and the instruction
> - is restarted */
> - gen_op_st_v(s, ot, newv, s->A0);
> - gen_op_mov_reg_v(s, ot, R_EAX, oldv);
> }
Obviously incorrect. You can't *not* store to EAX. You must conditionally store to EAX.
r~
prev parent reply other threads:[~2021-08-02 18:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-31 19:06 [PATCH] target/i386: cmpxchg should not touch accumulator yqwfh
2021-08-02 18:46 ` 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=b314b0e0-c76e-bcc7-72a2-494ef7ae7f03@linaro.org \
--to=richard.henderson@linaro.org \
--cc=ahmeddan@amazon.com \
--cc=amdeniulari@protonmail.com \
--cc=qemu-devel@nongnu.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).