qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org
Subject: Re: [PATCH v4 9/9] target/arm: Enable TARGET_TB_PCREL
Date: Thu, 22 Sep 2022 15:07:53 +0100	[thread overview]
Message-ID: <CAFEAcA-jUebgHHpShKWaR48ctfYBfpFgAkGPbxbp=13gNR=U8g@mail.gmail.com> (raw)
In-Reply-To: <20220906100528.343244-10-richard.henderson@linaro.org>

On Tue, 6 Sept 2022 at 11:31, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  target/arm/cpu-param.h     |  2 ++
>  target/arm/translate.h     |  6 ++++
>  target/arm/cpu.c           | 23 +++++++-------
>  target/arm/translate-a64.c | 37 ++++++++++++++++++-----
>  target/arm/translate.c     | 62 ++++++++++++++++++++++++++++++--------
>  5 files changed, 100 insertions(+), 30 deletions(-)
>
> diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h
> index 68ffb12427..ef62371d8f 100644
> --- a/target/arm/cpu-param.h
> +++ b/target/arm/cpu-param.h
> @@ -34,4 +34,6 @@
>
>  #define NB_MMU_MODES 15
>
> +#define TARGET_TB_PCREL 1
> +
>  #endif
> diff --git a/target/arm/translate.h b/target/arm/translate.h
> index d42059aa1d..7717ea3f45 100644
> --- a/target/arm/translate.h
> +++ b/target/arm/translate.h
> @@ -12,6 +12,12 @@ typedef struct DisasContext {
>
>      /* The address of the current instruction being translated. */
>      target_ulong pc_curr;
> +    /*
> +     * For TARGET_TB_PCREL, the value relative to pc_curr against which
> +     * offsets must be computed for cpu_pc.  -1 if unknown due to jump.
> +     */

I'm not really sure what this comment is trying to tell me. Could
you expand it a bit ?

> +    target_ulong pc_save;
> +    target_ulong pc_cond_save;
>      target_ulong page_start;
>      uint32_t insn;
>      /* Nonzero if this instruction has been conditionally skipped.  */
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 047bf3f4ab..f5e74b6c3b 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -64,17 +64,18 @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value)
>  void arm_cpu_synchronize_from_tb(CPUState *cs,
>                                   const TranslationBlock *tb)
>  {
> -    ARMCPU *cpu = ARM_CPU(cs);
> -    CPUARMState *env = &cpu->env;
> -
> -    /*
> -     * It's OK to look at env for the current mode here, because it's
> -     * never possible for an AArch64 TB to chain to an AArch32 TB.
> -     */
> -    if (is_a64(env)) {
> -        env->pc = tb_pc(tb);
> -    } else {
> -        env->regs[15] = tb_pc(tb);
> +    /* The program counter is always up to date with TARGET_TB_PCREL. */

Is it?

Is there some documentation in one of the other patchsets about
how TARGET_TB_PCREL works in general and what targets need to do to
support it?


thanks
-- PMM


  reply	other threads:[~2022-09-22 15:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 10:05 [PATCH v4 0/9] target/arm: pc-relative translation blocks Richard Henderson
2022-09-06 10:05 ` [PATCH v4 1/9] target/arm: Introduce curr_insn_len Richard Henderson
2022-09-06 12:45   ` Philippe Mathieu-Daudé via
2022-09-06 10:05 ` [PATCH v4 2/9] target/arm: Change gen_goto_tb to work on displacements Richard Henderson
2022-09-06 12:52   ` Philippe Mathieu-Daudé via
2022-09-08 11:59     ` Richard Henderson
2022-09-22 14:01   ` Peter Maydell
2022-09-06 10:05 ` [PATCH v4 3/9] target/arm: Change gen_*set_pc_im to gen_*update_pc Richard Henderson
2022-09-22 14:04   ` Peter Maydell
2022-09-29  3:06     ` Richard Henderson
2022-09-06 10:05 ` [PATCH v4 4/9] target/arm: Change gen_exception_insn* to work on displacements Richard Henderson
2022-09-06 10:05 ` [PATCH v4 5/9] target/arm: Change gen_exception_internal " Richard Henderson
2022-09-06 12:53   ` Philippe Mathieu-Daudé via
2022-09-06 10:05 ` [PATCH v4 6/9] target/arm: Change gen_jmp* " Richard Henderson
2022-09-06 10:05 ` [PATCH v4 7/9] target/arm: Introduce gen_pc_plus_diff for aarch64 Richard Henderson
2022-09-06 10:05 ` [PATCH v4 8/9] target/arm: Introduce gen_pc_plus_diff for aarch32 Richard Henderson
2022-09-06 13:02   ` Philippe Mathieu-Daudé via
2022-09-06 10:05 ` [PATCH v4 9/9] target/arm: Enable TARGET_TB_PCREL Richard Henderson
2022-09-22 14:07   ` Peter Maydell [this message]
2022-09-29  4:30     ` Richard Henderson

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='CAFEAcA-jUebgHHpShKWaR48ctfYBfpFgAkGPbxbp=13gNR=U8g@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.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).