From: Richard Henderson <richard.henderson@linaro.org>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>, Cornelia Huck <cohuck@redhat.com>,
"open list:S390 TCG CPUs" <qemu-s390x@nongnu.org>,
David Hildenbrand <david@redhat.com>
Subject: Re: [RFC PATCH] target/s390x: move tcg_gen_insn_start to s390x_tr_insn_start
Date: Mon, 11 Oct 2021 11:34:25 -0700 [thread overview]
Message-ID: <0a67b397-813d-b34a-22fd-ee480dc6809b@linaro.org> (raw)
In-Reply-To: <20211011155729.3222362-1-alex.bennee@linaro.org>
On 10/11/21 8:57 AM, Alex Bennée wrote:
> We use INDEX_op_insn_start to make the start of instruction
> boundaries. If we don't do it in the .insn_start hook things get
> confused especially now plugins want to use that marking to identify
> the start of instructions and will bomb out if it sees instrumented
> ops before the first instruction boundary.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> target/s390x/tcg/translate.c | 25 ++++++++++++++++++++++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
> index f284870cd2..fe145ff2eb 100644
> --- a/target/s390x/tcg/translate.c
> +++ b/target/s390x/tcg/translate.c
> @@ -6380,9 +6380,6 @@ static DisasJumpType translate_one(CPUS390XState *env, DisasContext *s)
> /* Search for the insn in the table. */
> insn = extract_insn(env, s);
>
> - /* Emit insn_start now that we know the ILEN. */
> - tcg_gen_insn_start(s->base.pc_next, s->cc_op, s->ilen);
> -
> /* Not found means unimplemented/illegal opcode. */
> if (insn == NULL) {
> qemu_log_mask(LOG_UNIMP, "unimplemented opcode 0x%02x%02x\n",
> @@ -6550,8 +6547,30 @@ static void s390x_tr_tb_start(DisasContextBase *db, CPUState *cs)
> {
> }
>
> +/*
> + * We just enough partial instruction decoding here to calculate the
> + * length of the instruction so we can drop the INDEX_op_insn_start
> + * before anything else is emitted in the TCGOp stream.
> + *
> + * See extract_insn for the full decode.
> + */
> static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
> {
> + CPUS390XState *env = cs->env_ptr;
> + DisasContext *s = container_of(dcbase, DisasContext, base);
> + uint64_t insn, pc = s->base.pc_next;
> + int op, ilen;
> +
> + if (unlikely(s->ex_value)) {
> + ilen = s->ex_value & 0xf;
> + } else {
> + insn = ld_code2(env, s, pc); /* FIXME: don't reload same pc twice */
I think we might as well delay the set of ilen until after the normal load, rather than
introduce a fixme.
r~
> + op = (insn >> 8) & 0xff;
> + ilen = get_ilen(op);
> + }
> +
> + /* Emit insn_start now that we know the ILEN. */
> + tcg_gen_insn_start(s->base.pc_next, s->cc_op, ilen);
> }
>
> static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
>
next prev parent reply other threads:[~2021-10-11 18:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 15:57 [RFC PATCH] target/s390x: move tcg_gen_insn_start to s390x_tr_insn_start Alex Bennée
2021-10-11 18:34 ` Richard Henderson [this message]
2021-10-11 21:31 ` Alex Bennée
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=0a67b397-813d-b34a-22fd-ee480dc6809b@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
/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).