accel/tcg: Pass TCGTBCPUState to tb_htable_lookup

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2025-04-29 13:02:32 -07:00
parent b46357db32
commit 088caf3de4

View file

@ -195,26 +195,24 @@ static bool tb_lookup_cmp(const void *p, const void *d)
return false; return false;
} }
static TranslationBlock *tb_htable_lookup(CPUState *cpu, vaddr pc, static TranslationBlock *tb_htable_lookup(CPUState *cpu, TCGTBCPUState s)
uint64_t cs_base, uint32_t flags,
uint32_t cflags)
{ {
tb_page_addr_t phys_pc; tb_page_addr_t phys_pc;
struct tb_desc desc; struct tb_desc desc;
uint32_t h; uint32_t h;
desc.env = cpu_env(cpu); desc.env = cpu_env(cpu);
desc.cs_base = cs_base; desc.cs_base = s.cs_base;
desc.flags = flags; desc.flags = s.flags;
desc.cflags = cflags; desc.cflags = s.cflags;
desc.pc = pc; desc.pc = s.pc;
phys_pc = get_page_addr_code(desc.env, pc); phys_pc = get_page_addr_code(desc.env, s.pc);
if (phys_pc == -1) { if (phys_pc == -1) {
return NULL; return NULL;
} }
desc.page_addr0 = phys_pc; desc.page_addr0 = phys_pc;
h = tb_hash_func(phys_pc, (cflags & CF_PCREL ? 0 : pc), h = tb_hash_func(phys_pc, (s.cflags & CF_PCREL ? 0 : s.pc),
flags, cs_base, cflags); s.flags, s.cs_base, s.cflags);
return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp); return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp);
} }
@ -253,7 +251,7 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, TCGTBCPUState s)
goto hit; goto hit;
} }
tb = tb_htable_lookup(cpu, s.pc, s.cs_base, s.flags, s.cflags); tb = tb_htable_lookup(cpu, s);
if (tb == NULL) { if (tb == NULL) {
return NULL; return NULL;
} }