Skip to content

Commit c3bf5b2

Browse files
bonzinifiglesia-xilinx
authored andcommitted
accel/tcg: Revert mapping of PCREL translation block to multiple virtual addresses
This is causing regressions that have not been analyzed yet. Revert the change on stable branches. Cc: qemu-stable@nongnu.org Cc: Michael Tokarev <mjt@tls.msk.ru> Related: https://gitlab.com/qemu-project/qemu/-/issues/2092 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
1 parent 3e601fb commit c3bf5b2

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

accel/tcg/cpu-exec.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static bool tb_lookup_cmp(const void *p, const void *d)
184184
const TranslationBlock *tb = p;
185185
const struct tb_desc *desc = d;
186186

187-
if ((tb_cflags(tb) & CF_PCREL || tb->pc == desc->pc) &&
187+
if (tb->pc == desc->pc &&
188188
tb_page_addr0(tb) == desc->page_addr0 &&
189189
tb->cs_base == desc->cs_base &&
190190
tb->flags == desc->flags &&
@@ -234,7 +234,7 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, vaddr pc,
234234
return NULL;
235235
}
236236
desc.page_addr0 = phys_pc;
237-
h = tb_hash_func(phys_pc, (cflags & CF_PCREL ? 0 : pc),
237+
h = tb_hash_func(phys_pc, pc,
238238
flags, cs_base, cflags);
239239
return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp);
240240
}

accel/tcg/tb-maint.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static bool tb_cmp(const void *ap, const void *bp)
4747
const TranslationBlock *a = ap;
4848
const TranslationBlock *b = bp;
4949

50-
return ((tb_cflags(a) & CF_PCREL || a->pc == b->pc) &&
50+
return (a->pc == b->pc &&
5151
a->cs_base == b->cs_base &&
5252
a->flags == b->flags &&
5353
(tb_cflags(a) & ~CF_INVALID) == (tb_cflags(b) & ~CF_INVALID) &&
@@ -916,7 +916,7 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
916916

917917
/* remove the TB from the hash list */
918918
phys_pc = tb_page_addr0(tb);
919-
h = tb_hash_func(phys_pc, (orig_cflags & CF_PCREL ? 0 : tb->pc),
919+
h = tb_hash_func(phys_pc, tb->pc,
920920
tb->flags, tb->cs_base, orig_cflags);
921921
if (!qht_remove(&tb_ctx.htable, tb, h)) {
922922
return;
@@ -983,7 +983,7 @@ TranslationBlock *tb_link_page(TranslationBlock *tb)
983983
tb_record(tb);
984984

985985
/* add in the hash table */
986-
h = tb_hash_func(tb_page_addr0(tb), (tb->cflags & CF_PCREL ? 0 : tb->pc),
986+
h = tb_hash_func(tb_page_addr0(tb), tb->pc,
987987
tb->flags, tb->cs_base, tb->cflags);
988988
qht_insert(&tb_ctx.htable, tb, h, &existing_tb);
989989

accel/tcg/translate-all.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
329329

330330
gen_code_buf = tcg_ctx->code_gen_ptr;
331331
tb->tc.ptr = tcg_splitwx_to_rx(gen_code_buf);
332-
if (!(cflags & CF_PCREL)) {
333-
tb->pc = pc;
334-
}
332+
tb->pc = pc;
335333
tb->cs_base = cs_base;
336334
tb->flags = flags;
337335
tb->cflags = cflags;

0 commit comments

Comments
 (0)