qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: Bernhard Beschow <shentey@gmail.com>
Subject: Re: [PATCH] accel/tcg: Init tb size and icount before plugin_gen_tb_end
Date: Wed, 22 May 2024 10:11:06 -0700	[thread overview]
Message-ID: <48bd7bb4-aeca-4117-88f2-1eb320aa1e36@linaro.org> (raw)
In-Reply-To: <20240521210604.130837-1-richard.henderson@linaro.org>

On 5/21/24 14:06, Richard Henderson wrote:
> When passing disassembly data to plugin callbacks,
> translator_st_len relies on db->tb->size having been set.
> 
> Fixes: 4c833c60e047 ("disas: Use translator_st to get disassembly data")
> Reported-by: Bernhard Beschow <shentey@gmail.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   accel/tcg/translator.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
> index c56967eecd..113edcffe3 100644
> --- a/accel/tcg/translator.c
> +++ b/accel/tcg/translator.c
> @@ -214,14 +214,14 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns,
>       set_can_do_io(db, true);
>       tcg_ctx->emit_before_op = NULL;
>   
> +    /* May be used by disas_log or plugin callbacks. */
> +    tb->size = db->pc_next - db->pc_first;
> +    tb->icount = db->num_insns;
> +
>       if (plugin_enabled) {
>           plugin_gen_tb_end(cpu, db->num_insns);
>       }
>   
> -    /* The disas_log hook may use these values rather than recompute.  */
> -    tb->size = db->pc_next - db->pc_first;
> -    tb->icount = db->num_insns;
> -
>       if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)
>           && qemu_log_in_addr_range(db->pc_first)) {
>           FILE *logfile = qemu_log_trylock();

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>


  parent reply	other threads:[~2024-05-22 17:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21 21:06 [PATCH] accel/tcg: Init tb size and icount before plugin_gen_tb_end Richard Henderson
2024-05-22  9:29 ` Bernhard Beschow
2024-05-22 17:11 ` Pierrick Bouvier [this message]
2024-05-27  9:37 ` Philippe Mathieu-Daudé

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=48bd7bb4-aeca-4117-88f2-1eb320aa1e36@linaro.org \
    --to=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shentey@gmail.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).