* [PATCH] target/s390x: move tcg_gen_insn_start to s390x_tr_insn_start
@ 2021-10-11 18:53 Richard Henderson
2021-10-12 6:41 ` Alex Bennée
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2021-10-11 18:53 UTC (permalink / raw)
To: qemu-devel; +Cc: alex.bennee
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: Richard Henderson <richard.henderson@linaro.org>
---
target/s390x/tcg/translate.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
index f284870cd2..a2d6fa5cca 100644
--- a/target/s390x/tcg/translate.c
+++ b/target/s390x/tcg/translate.c
@@ -138,6 +138,7 @@ struct DisasFields {
struct DisasContext {
DisasContextBase base;
const DisasInsn *insn;
+ TCGOp *insn_start;
DisasFields fields;
uint64_t ex_value;
/*
@@ -6380,8 +6381,8 @@ 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);
+ /* Update insn_start now that we know the ILEN. */
+ tcg_set_insn_start_param(s->insn_start, 2, s->ilen);
/* Not found means unimplemented/illegal opcode. */
if (insn == NULL) {
@@ -6552,6 +6553,11 @@ static void s390x_tr_tb_start(DisasContextBase *db, CPUState *cs)
static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
{
+ DisasContext *dc = container_of(dcbase, DisasContext, base);
+
+ /* Delay the set of ilen until we've read the insn. */
+ tcg_gen_insn_start(dc->base.pc_next, dc->cc_op, 0);
+ dc->insn_start = tcg_last_op();
}
static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] target/s390x: move tcg_gen_insn_start to s390x_tr_insn_start
2021-10-11 18:53 [PATCH] target/s390x: move tcg_gen_insn_start to s390x_tr_insn_start Richard Henderson
@ 2021-10-12 6:41 ` Alex Bennée
0 siblings, 0 replies; 2+ messages in thread
From: Alex Bennée @ 2021-10-12 6:41 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel
Richard Henderson <richard.henderson@linaro.org> writes:
> 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: Richard Henderson <richard.henderson@linaro.org>
Well that is considerably simpler than my patch... I'll apply it to the
PR and resubmit ;-)
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> target/s390x/tcg/translate.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c
> index f284870cd2..a2d6fa5cca 100644
> --- a/target/s390x/tcg/translate.c
> +++ b/target/s390x/tcg/translate.c
> @@ -138,6 +138,7 @@ struct DisasFields {
> struct DisasContext {
> DisasContextBase base;
> const DisasInsn *insn;
> + TCGOp *insn_start;
> DisasFields fields;
> uint64_t ex_value;
> /*
> @@ -6380,8 +6381,8 @@ 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);
> + /* Update insn_start now that we know the ILEN. */
> + tcg_set_insn_start_param(s->insn_start, 2, s->ilen);
>
> /* Not found means unimplemented/illegal opcode. */
> if (insn == NULL) {
> @@ -6552,6 +6553,11 @@ static void s390x_tr_tb_start(DisasContextBase *db, CPUState *cs)
>
> static void s390x_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
> {
> + DisasContext *dc = container_of(dcbase, DisasContext, base);
> +
> + /* Delay the set of ilen until we've read the insn. */
> + tcg_gen_insn_start(dc->base.pc_next, dc->cc_op, 0);
> + dc->insn_start = tcg_last_op();
> }
>
> static void s390x_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
--
Alex Bennée
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-12 6:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-11 18:53 [PATCH] target/s390x: move tcg_gen_insn_start to s390x_tr_insn_start Richard Henderson
2021-10-12 6:41 ` Alex Bennée
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).