qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] Replace `TARGET_TB_PCREL` with `CF_PCREL`


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 2/3] Replace `TARGET_TB_PCREL` with `CF_PCREL`
Date: Tue, 7 Feb 2023 12:26:05 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

On 7/2/23 11:43, Anton Johansson via wrote:
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
  accel/tcg/cpu-exec.c        |  8 +++----
  accel/tcg/internal.h        | 10 ++++----
  accel/tcg/perf.c            |  2 +-
  accel/tcg/tb-jmp-cache.h    | 48 ++++++++++++++++++-------------------
  accel/tcg/tb-maint.c        |  8 +++----
  accel/tcg/translate-all.c   | 14 +++++------
  include/exec/cpu-defs.h     |  3 ---
  include/exec/exec-all.h     | 27 +++++++++------------
  target/arm/cpu.c            |  8 +++----
  target/arm/translate-a64.c  |  8 +++----
  target/arm/translate.c      |  6 ++---
  target/arm/translate.h      |  2 +-
  target/i386/helper.c        |  2 +-
  target/i386/tcg/tcg-cpu.c   |  6 ++---
  target/i386/tcg/translate.c | 26 ++++++++++----------
  15 files changed, 84 insertions(+), 94 deletions(-)

diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 9c857eeb07..0a84934ed4 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -186,7 +186,7 @@ static bool tb_lookup_cmp(const void *p, const void *d)
      const TranslationBlock *tb = p;
      const struct tb_desc *desc = d;
- if ((TARGET_TB_PCREL || tb_pc(tb) == desc->pc) &&
+    if ((tb_cflags(tb) & CF_PCREL || tb_pc(tb) == desc->pc) &&
          tb_page_addr0(tb) == desc->page_addr0 &&
          tb->cs_base == desc->cs_base &&
          tb->flags == desc->flags &&
@@ -238,7 +238,7 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, 
target_ulong pc,
          return NULL;
      }
      desc.page_addr0 = phys_pc;
-    h = tb_hash_func(phys_pc, (TARGET_TB_PCREL ? 0 : pc),
+    h = tb_hash_func(phys_pc, (cflags & CF_PCREL ? 0 : pc),
                       flags, cflags, *cpu->trace_dstate);
      return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp);
  }
@@ -257,7 +257,7 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, 
target_ulong pc,
hash = tb_jmp_cache_hash_func(pc);
      jc = cpu->tb_jmp_cache;
-    tb = tb_jmp_cache_get_tb(jc, hash);
+    tb = tb_jmp_cache_get_tb(jc, cflags, hash);
if (likely(tb &&
                 tb_jmp_cache_get_pc(jc, hash, tb) == pc &&
@@ -460,7 +460,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int 
*tb_exit)
          if (cc->tcg_ops->synchronize_from_tb) {
              cc->tcg_ops->synchronize_from_tb(cpu, last_tb);
          } else {

Possibly:

#ifdef CONFIG_DEBUG_TCG

-            assert(!TARGET_TB_PCREL);
+            assert(!(tb_cflags(last_tb) & CF_PCREL));
              assert(cc->set_pc);

#endif

Or maybe clearer, use tcg_debug_assert()?

              cc->set_pc(cpu, tb_pc(last_tb));
          }

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]