gen-icount: check cflags instead of use_icount global

Backports commit cd42d5b23691ad73edfd6dbcfc935a960a9c5a65 from qemu
This commit is contained in:
Paolo Bonzini 2018-03-04 14:25:10 -05:00 committed by Lioncash
parent cbb20881a2
commit 6997a5a090
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
7 changed files with 16 additions and 16 deletions

View file

@ -9,7 +9,7 @@
//static TCGLabel *icount_label;
//static TCGLabel *exitreq_label;
static inline void gen_tb_start(TCGContext *tcg_ctx)
static inline void gen_tb_start(TCGContext *tcg_ctx, TranslationBlock *tb)
{
//TCGv_i32 count, flag, imm;
TCGv_i32 flag;
@ -22,7 +22,7 @@ static inline void gen_tb_start(TCGContext *tcg_ctx)
tcg_temp_free_i32(tcg_ctx, flag);
#if 0
if (!(s->tb->cflags & CF_USE_ICOUNT)) {
if (!(tb->cflags & CF_USE_ICOUNT))
return;
}
@ -53,7 +53,7 @@ static inline void gen_tb_end(TCGContext *tcg_ctx, TranslationBlock *tb, int num
tcg_gen_exit_tb(tcg_ctx, (uintptr_t)tb + TB_EXIT_REQUESTED);
#if 0
if (use_icount) {
if (tb->cflags & CF_USE_ICOUNT) {
/* Update the num_insn immediate parameter now that we know
* the actual insn count. */
tcg_set_insn_param(tcg_ctx, icount_start_insn_idx, 1, num_insns);

View file

@ -11515,7 +11515,7 @@ void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb)
// Unicorn: early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {
// imitate WFI instruction to halt emulation
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
dc->is_jmp = DISAS_WFI;
goto tb_end;
}
@ -11532,7 +11532,7 @@ void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb)
env->uc->size_arg = -1;
}
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
do {
dc->insn_start_idx = tcg_op_buf_count(tcg_ctx);

View file

@ -12124,7 +12124,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
// Unicorn: early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {
// imitate WFI instruction to halt emulation
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
dc->is_jmp = DISAS_WFI;
goto tb_end;
}
@ -12141,7 +12141,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
env->uc->size_arg = -1;
}
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
/* A note on handling of the condexec (IT) bits:
*

View file

@ -9242,7 +9242,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
// early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {
// imitate the HLT instruction
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
gen_jmp_im(dc, tb->pc - tb->cs_base);
gen_helper_hlt(tcg_ctx, tcg_ctx->cpu_env, tcg_const_i32(tcg_ctx, 0));
dc->is_jmp = DISAS_NORETURN;
@ -9269,7 +9269,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
env->uc->size_arg = -1;
}
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
for(;;) {
tcg_gen_insn_start(tcg_ctx, pc_start, dc->cc_op);
num_insns++;

View file

@ -5774,7 +5774,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
// Unicorn: early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
gen_exception(dc, dc->pc, EXCP_HLT);
goto done_generating;
}
@ -5791,7 +5791,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
env->uc->size_arg = -1;
}
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
do {
pc_offset = dc->pc - pc_start;
tcg_gen_insn_start(tcg_ctx, dc->pc, dc->cc_op);

View file

@ -20444,7 +20444,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
// Unicorn: early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
gen_helper_wait(tcg_ctx, tcg_ctx->cpu_env);
ctx.bstate = BS_EXCP;
goto done_generating;
@ -20463,7 +20463,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
env->uc->size_arg = -1;
}
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
while (ctx.bstate == BS_NONE) {
tcg_gen_insn_start(tcg_ctx, ctx.pc, ctx.hflags & MIPS_HFLAG_BMASK, ctx.btarget);
num_insns++;

View file

@ -5958,7 +5958,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb)
// early check to see if the address of this block is the until address
if (pc_start == env->uc->addr_end) {
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
gen_helper_power_down(tcg_ctx, tcg_ctx->cpu_env);
goto done_generating;
}
@ -5973,7 +5973,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb)
// Unicorn: early check to see if the address of this block is the until address
if (tb->pc == env->uc->addr_end) {
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
save_state(dc);
gen_helper_power_down(tcg_ctx, tcg_ctx->cpu_env);
goto done_generating;
@ -5989,7 +5989,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb)
gen_uc_tracecode(tcg_ctx, 0xf8f8f8f8, UC_HOOK_BLOCK_IDX, env->uc, pc_start);
}
gen_tb_start(tcg_ctx);
gen_tb_start(tcg_ctx, tb);
do {
if (dc->npc & JUMP_PC) {
assert(dc->jump_pc[1] == dc->pc + 4);