diff --git a/qemu/target-mips/translate.c b/qemu/target-mips/translate.c index ab98dcfa..94f5bb1c 100644 --- a/qemu/target-mips/translate.c +++ b/qemu/target-mips/translate.c @@ -20090,9 +20090,7 @@ void mips_tcg_init(struct uc_struct *uc) tcg_global_mem_new_i64(tcg_ctx, tcg_ctx->cpu_env, off, msaregnames[i * 2 + 1]); } - if (!uc->init_tcg) - tcg_ctx->cpu_PC = g_malloc0(sizeof(TCGv)); - *((TCGv *)tcg_ctx->cpu_PC) = tcg_global_mem_new(tcg_ctx, tcg_ctx->cpu_env, + tcg_ctx->cpu_PC = tcg_global_mem_new(tcg_ctx, tcg_ctx->cpu_env, offsetof(CPUMIPSState, active_tc.PC), "PC"); for (i = 0; i < MIPS_DSP_ACC; i++) { diff --git a/qemu/target-mips/unicorn.c b/qemu/target-mips/unicorn.c index 429560e7..540fc23c 100644 --- a/qemu/target-mips/unicorn.c +++ b/qemu/target-mips/unicorn.c @@ -57,7 +57,6 @@ void mips_release(void *ctx) g_free(tcg_ctx->cpu_gpr[i]); } - g_free(tcg_ctx->cpu_PC); g_free(tcg_ctx->tb_ctx.tbs); } diff --git a/qemu/tcg/tcg.h b/qemu/tcg/tcg.h index a32dae6a..90862e96 100644 --- a/qemu/tcg/tcg.h +++ b/qemu/tcg/tcg.h @@ -812,7 +812,8 @@ struct TCGContext { /* qemu/target-mips/translate.c */ /* global register indices */ - void *cpu_gpr[32], *cpu_PC; + void *cpu_gpr[32]; + TCGv cpu_PC; TCGv cpu_HI[4], cpu_LO[4]; // MIPS_DSP_ACC = 4 in qemu/target-mips/cpu.h TCGv cpu_dspctrl; TCGv btarget;