mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-25 18:36:32 +00:00
tcg: Pass generic CPUState to gen_intermediate_code()
Needed to implement a target-agnostic gen_intermediate_code() in the future. Backports commit 9c489ea6bed134fecfd556b439c68bba48fbe102 from qemu
This commit is contained in:
parent
382dcb2deb
commit
32b3c3815d
9 changed files with 18 additions and 22 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue