cpu-exec: elide more icount code if CONFIG_USER_ONLY

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Alex Bennée: #ifndef replay code to match elided functions]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Paolo Bonzini 2015-08-11 11:05:12 +02:00 committed by Richard Henderson
parent 1279f323d6
commit 7687bf52e5
1 changed files with 8 additions and 0 deletions

View File

@ -192,6 +192,7 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
return next_tb; return next_tb;
} }
#ifndef CONFIG_USER_ONLY
/* Execute the code without caching the generated code. An interpreter /* Execute the code without caching the generated code. An interpreter
could be used if available. */ could be used if available. */
static void cpu_exec_nocache(CPUState *cpu, int max_cycles, static void cpu_exec_nocache(CPUState *cpu, int max_cycles,
@ -216,6 +217,7 @@ static void cpu_exec_nocache(CPUState *cpu, int max_cycles,
tb_phys_invalidate(tb, -1); tb_phys_invalidate(tb, -1);
tb_free(tb); tb_free(tb);
} }
#endif
static TranslationBlock *tb_find_physical(CPUState *cpu, static TranslationBlock *tb_find_physical(CPUState *cpu,
target_ulong pc, target_ulong pc,
@ -430,12 +432,14 @@ int cpu_exec(CPUState *cpu)
} }
#endif #endif
} }
#ifndef CONFIG_USER_ONLY
} else if (replay_has_exception() } else if (replay_has_exception()
&& cpu->icount_decr.u16.low + cpu->icount_extra == 0) { && cpu->icount_decr.u16.low + cpu->icount_extra == 0) {
/* try to cause an exception pending in the log */ /* try to cause an exception pending in the log */
cpu_exec_nocache(cpu, 1, tb_find_fast(cpu), true); cpu_exec_nocache(cpu, 1, tb_find_fast(cpu), true);
ret = -1; ret = -1;
break; break;
#endif
} }
next_tb = 0; /* force lookup of first TB */ next_tb = 0; /* force lookup of first TB */
@ -542,6 +546,9 @@ int cpu_exec(CPUState *cpu)
case TB_EXIT_ICOUNT_EXPIRED: case TB_EXIT_ICOUNT_EXPIRED:
{ {
/* Instruction counter expired. */ /* Instruction counter expired. */
#ifdef CONFIG_USER_ONLY
abort();
#else
int insns_left = cpu->icount_decr.u32; int insns_left = cpu->icount_decr.u32;
if (cpu->icount_extra && insns_left >= 0) { if (cpu->icount_extra && insns_left >= 0) {
/* Refill decrementer and continue execution. */ /* Refill decrementer and continue execution. */
@ -561,6 +568,7 @@ int cpu_exec(CPUState *cpu)
cpu_loop_exit(cpu); cpu_loop_exit(cpu);
} }
break; break;
#endif
} }
default: default:
break; break;