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
Subject: Re: [PATCH 3/7] accel/tcg: Return the TranslationBlock from cpu_unwind_state_data
Date: Thu, 18 Apr 2024 10:54:54 -0700	[thread overview]
Message-ID: <68de4f64-90a7-49d0-8d14-57e510da3daf@linaro.org> (raw)
In-Reply-To: <20240416040609.1313605-4-richard.henderson@linaro.org>

On 4/15/24 21:06, Richard Henderson wrote:
> Fix the i386 get_memio_eip function to use tb->cflags
> instead of cs->tcg_cflags.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/exec/cpu-common.h | 9 +++++----
>   accel/tcg/translate-all.c | 9 +++++----
>   target/i386/helper.c      | 6 ++++--
>   3 files changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index 6346df17ce..f056132cab 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -176,12 +176,13 @@ void list_cpus(void);
>    * @host_pc: the host pc within the translation
>    * @data: output data
>    *
> - * Attempt to load the the unwind state for a host pc occurring in
> - * translated code.  If @host_pc is not in translated code, the
> - * function returns false; otherwise @data is loaded.
> + * Attempt to load the the unwind state for a host pc occurring in translated
> + * code.  If @host_pc is not in translated code, the function returns NULL;
> + * otherwise @data is loaded and the TranslationBlock is returned.
>    * This is the same unwind info as given to restore_state_to_opc.
>    */
> -bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);
> +const TranslationBlock *cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc,
> +                                              uint64_t *data);
>   
>   /**
>    * cpu_restore_state:
> diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
> index 83cc14fbde..c745bc5b6c 100644
> --- a/accel/tcg/translate-all.c
> +++ b/accel/tcg/translate-all.c
> @@ -243,15 +243,16 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc)
>       return false;
>   }
>   
> -bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data)
> +const TranslationBlock *
> +cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data)
>   {
>       if (in_code_gen_buffer((const void *)(host_pc - tcg_splitwx_diff))) {
>           TranslationBlock *tb = tcg_tb_lookup(host_pc);
> -        if (tb) {
> -            return cpu_unwind_data_from_tb(tb, host_pc, data) >= 0;
> +        if (tb && cpu_unwind_data_from_tb(tb, host_pc, data) >= 0) {
> +            return tb;
>           }
>       }
> -    return false;
> +    return NULL;
>   }
>   
>   void page_init(void)
> diff --git a/target/i386/helper.c b/target/i386/helper.c
> index 23ccb23a5b..eaa691a851 100644
> --- a/target/i386/helper.c
> +++ b/target/i386/helper.c
> @@ -517,13 +517,15 @@ static inline target_ulong get_memio_eip(CPUX86State *env)
>   #ifdef CONFIG_TCG
>       uint64_t data[TARGET_INSN_START_WORDS];
>       CPUState *cs = env_cpu(env);
> +    const TranslationBlock *tb;
>   
> -    if (!cpu_unwind_state_data(cs, cs->mem_io_pc, data)) {
> +    tb = cpu_unwind_state_data(cs, cs->mem_io_pc, data);
> +    if (!tb) {
>           return env->eip;
>       }
>   
>       /* Per x86_restore_state_to_opc. */
> -    if (cs->tcg_cflags & CF_PCREL) {
> +    if (tb->cflags & CF_PCREL) {
>           return (env->eip & TARGET_PAGE_MASK) | data[0];
>       } else {
>           return data[0] - env->segs[R_CS].base;

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


  reply	other threads:[~2024-04-18 17:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  4:06 [PATCH 0/7] plugins: Use unwind info for special gdb registers Richard Henderson
2024-04-16  4:06 ` [PATCH 1/7] tcg: Introduce INDEX_op_plugin_pc Richard Henderson
2024-04-18 17:53   ` Pierrick Bouvier
2024-04-16  4:06 ` [PATCH 2/7] accel/tcg: Set CPUState.plugin_ra before all plugin callbacks Richard Henderson
2024-04-18 17:54   ` Pierrick Bouvier
2024-05-31 16:46   ` Alex Bennée
2024-04-16  4:06 ` [PATCH 3/7] accel/tcg: Return the TranslationBlock from cpu_unwind_state_data Richard Henderson
2024-04-18 17:54   ` Pierrick Bouvier [this message]
2024-05-31 16:52   ` Alex Bennée
2024-04-16  4:06 ` [PATCH 4/7] plugins: Introduce TCGCPUOps callbacks for mid-tb register reads Richard Henderson
2024-04-18 17:55   ` Pierrick Bouvier
2024-04-16  4:06 ` [PATCH 5/7] target/i386: Split out gdb-internal.h Richard Henderson
2024-04-18 17:55   ` Pierrick Bouvier
2024-05-31 17:00   ` Alex Bennée
2024-04-16  4:06 ` [PATCH 6/7] target/i386: Introduce cpu_compute_eflags_ccop Richard Henderson
2024-04-18 17:56   ` Pierrick Bouvier
2024-04-16  4:06 ` [PATCH 7/7] target/i386: Implement TCGCPUOps for plugin register reads Richard Henderson
2024-04-18 17:56   ` Pierrick Bouvier
2024-04-17  0:35 ` [PATCH 0/7] plugins: Use unwind info for special gdb registers Pierrick Bouvier
2024-04-17  2:40   ` Richard Henderson
2024-04-17 15:39     ` Pierrick Bouvier
2024-04-22 16:49 ` 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=68de4f64-90a7-49d0-8d14-57e510da3daf@linaro.org \
    --to=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).