diff --git a/qemu/include/exec/exec-all.h b/qemu/include/exec/exec-all.h index e7ecd6a7..06fbb6a3 100644 --- a/qemu/include/exec/exec-all.h +++ b/qemu/include/exec/exec-all.h @@ -66,7 +66,7 @@ typedef ram_addr_t tb_page_addr_t; #include "qemu/log.h" -void gen_intermediate_code(CPUArchState *env, struct TranslationBlock *tb); +void gen_intermediate_code(CPUState *cpu, struct TranslationBlock *tb); void restore_state_to_opc(CPUArchState *env, struct TranslationBlock *tb, target_ulong *data); bool cpu_restore_state(CPUState *cpu, uintptr_t searched_pc); diff --git a/qemu/target/arm/translate-a64.c b/qemu/target/arm/translate-a64.c index 697a50cc..716ed106 100644 --- a/qemu/target/arm/translate-a64.c +++ b/qemu/target/arm/translate-a64.c @@ -11416,10 +11416,10 @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s) free_tmp_a64(s); } -void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb) +void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb) { - CPUState *cs = CPU(cpu); - CPUARMState *env = &cpu->env; + CPUARMState *env = cs->env_ptr; + ARMCPU *cpu = arm_env_get_cpu(env); DisasContext dc1, *dc = &dc1; target_ulong pc_start; target_ulong next_page_start; diff --git a/qemu/target/arm/translate.c b/qemu/target/arm/translate.c index 214c96ea..ab050630 100644 --- a/qemu/target/arm/translate.c +++ b/qemu/target/arm/translate.c @@ -11991,10 +11991,10 @@ static bool insn_crosses_page(CPUARMState *env, DisasContext *s) } /* generate intermediate code for basic block 'tb'. */ -void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb) +void gen_intermediate_code(CPUState *cs, TranslationBlock *tb) { + CPUARMState *env = cs->env_ptr; ARMCPU *cpu = arm_env_get_cpu(env); - CPUState *cs = CPU(cpu); DisasContext dc1, *dc = &dc1; target_ulong pc_start; target_ulong next_page_start; @@ -12010,7 +12010,7 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb) * the A32/T32 complexity to do with conditional execution/IT blocks/etc. */ if (ARM_TBFLAG_AARCH64_STATE(tb->flags)) { - gen_intermediate_code_a64(cpu, tb); + gen_intermediate_code_a64(cs, tb); return; } diff --git a/qemu/target/arm/translate.h b/qemu/target/arm/translate.h index 780d48de..985232c5 100644 --- a/qemu/target/arm/translate.h +++ b/qemu/target/arm/translate.h @@ -148,14 +148,14 @@ static void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) #ifdef TARGET_AARCH64 void a64_translate_init(struct uc_struct *uc); -void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb); +void gen_intermediate_code_a64(CPUState *cpu, TranslationBlock *tb); void gen_a64_set_pc_im(DisasContext *s, uint64_t val); #else static inline void a64_translate_init(struct uc_struct *uc) { } -static inline void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb) +static inline void gen_intermediate_code_a64(CPUState *cpu, TranslationBlock *tb) { } diff --git a/qemu/target/i386/translate.c b/qemu/target/i386/translate.c index 4a2d0fc3..74da7f71 100644 --- a/qemu/target/i386/translate.c +++ b/qemu/target/i386/translate.c @@ -9144,10 +9144,9 @@ void tcg_x86_init(struct uc_struct *uc) } /* generate intermediate code for basic block 'tb'. */ -void gen_intermediate_code(CPUX86State *env, TranslationBlock *tb) +void gen_intermediate_code(CPUState *cs, TranslationBlock *tb) { - X86CPU *cpu = x86_env_get_cpu(env); - CPUState *cs = CPU(cpu); + CPUX86State *env = cs->env_ptr; TCGContext *tcg_ctx = env->uc->tcg_ctx; DisasContext dc1, *dc = &dc1; target_ulong pc_ptr; diff --git a/qemu/target/m68k/translate.c b/qemu/target/m68k/translate.c index 7a4e07a5..193d345b 100644 --- a/qemu/target/m68k/translate.c +++ b/qemu/target/m68k/translate.c @@ -5732,10 +5732,9 @@ static void disas_m68k_insn(CPUM68KState * env, DisasContext *s) } /* generate intermediate code for basic block 'tb'. */ -void gen_intermediate_code(CPUM68KState *env, TranslationBlock *tb) +void gen_intermediate_code(CPUState *cs, TranslationBlock *tb) { - M68kCPU *cpu = m68k_env_get_cpu(env); - CPUState *cs = CPU(cpu); + CPUM68KState *env = cs->env_ptr; DisasContext dc1, *dc = &dc1; target_ulong pc_start; int pc_offset; diff --git a/qemu/target/mips/translate.c b/qemu/target/mips/translate.c index 9df7d33a..acaeacab 100644 --- a/qemu/target/mips/translate.c +++ b/qemu/target/mips/translate.c @@ -20013,10 +20013,9 @@ static void decode_opc(CPUMIPSState *env, DisasContext *ctx, bool *insn_need_pat } } -void gen_intermediate_code(CPUMIPSState *env, struct TranslationBlock *tb) +void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb) { - MIPSCPU *cpu = mips_env_get_cpu(env); - CPUState *cs = CPU(cpu); + CPUMIPSState *env = cs->env_ptr; DisasContext ctx; target_ulong pc_start; target_ulong next_page_start; diff --git a/qemu/target/sparc/translate.c b/qemu/target/sparc/translate.c index a35fc2ca..5e309bc3 100644 --- a/qemu/target/sparc/translate.c +++ b/qemu/target/sparc/translate.c @@ -5921,10 +5921,9 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn, bool hook_ins } } -void gen_intermediate_code(CPUSPARCState * env, TranslationBlock * tb) +void gen_intermediate_code(CPUState *cs, TranslationBlock * tb) { - SPARCCPU *cpu = sparc_env_get_cpu(env); - CPUState *cs = CPU(cpu); + CPUSPARCState *env = cs->env_ptr; target_ulong pc_start, last_pc; DisasContext dc1, *dc = &dc1; int num_insns = 0; diff --git a/qemu/translate-all.c b/qemu/translate-all.c index 00c90754..4835fd5a 100644 --- a/qemu/translate-all.c +++ b/qemu/translate-all.c @@ -1334,7 +1334,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_func_start(tcg_ctx); tcg_ctx->cpu = ENV_GET_CPU(env); - gen_intermediate_code(env, tb); + gen_intermediate_code(cpu, tb); tcg_ctx->cpu = NULL; // Unicorn: when tracing block, patch block size operand for callback