From bc5d7c5e1d0a24bbb603e04f93b4fb2af489ab06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 22 Feb 2018 09:27:56 -0500 Subject: [PATCH] tcg: pass down TranslationBlock to tcg_code_gen My later debugging patches need access to the origin PC which is held in the TranslationBlock structure. Pass down the whole structure as it also holds the information about the code start point. Backports commit 5bd2ec3d7b47b2252745882795d79aef36380fb7 from qemu --- qemu/tcg/tcg.c | 6 +++--- qemu/tcg/tcg.h | 2 +- qemu/translate-all.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qemu/tcg/tcg.c b/qemu/tcg/tcg.c index 567e9f33..0afd3dfe 100644 --- a/qemu/tcg/tcg.c +++ b/qemu/tcg/tcg.c @@ -2379,7 +2379,7 @@ static void dump_op_count(void) #endif -int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf) +int tcg_gen_code(TCGContext *s, TranslationBlock *tb) { int i, oi, oi_next, num_insns; @@ -2438,8 +2438,8 @@ int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf) tcg_reg_alloc_start(s); - s->code_buf = gen_code_buf; - s->code_ptr = gen_code_buf; + s->code_buf = tb->tc_ptr; + s->code_ptr = tb->tc_ptr; tcg_out_tb_init(s); diff --git a/qemu/tcg/tcg.h b/qemu/tcg/tcg.h index 91b7b323..ee1b49e5 100644 --- a/qemu/tcg/tcg.h +++ b/qemu/tcg/tcg.h @@ -515,7 +515,7 @@ void tcg_context_free(void *s); // free memory allocated for @s void tcg_prologue_init(TCGContext *s); void tcg_func_start(TCGContext *s); -int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf); +int tcg_gen_code(TCGContext *s, TranslationBlock *tb); void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t start, intptr_t size); diff --git a/qemu/translate-all.c b/qemu/translate-all.c index b550cb21..5165f1fe 100644 --- a/qemu/translate-all.c +++ b/qemu/translate-all.c @@ -1236,7 +1236,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, the tcg optimization currently hidden inside tcg_gen_code. All that should be required is to flush the TBs, allocate a new TB, re-initialize it per above, and re-do the actual code generation. */ - gen_code_size = tcg_gen_code(tcg_ctx, gen_code_buf); + gen_code_size = tcg_gen_code(tcg_ctx, tb); if (unlikely(gen_code_size < 0)) { goto buffer_overflow; }