change while to if

The while loop will be executed exactly 0 or 1 times, depending on
env->exit_request.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
master
Paolo Bonzini 2010-01-15 09:42:09 +01:00 committed by Anthony Liguori
parent 34dec6a560
commit 6113d6d316
1 changed files with 3 additions and 7 deletions

View File

@ -596,17 +596,13 @@ int cpu_exec(CPUState *env1)
tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb); tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb);
} }
spin_unlock(&tb_lock); spin_unlock(&tb_lock);
env->current_tb = tb;
assert (env->current_tb);
/* cpu_interrupt might be called while translating the /* cpu_interrupt might be called while translating the
TB, but before it is linked into a potentially TB, but before it is linked into a potentially
infinite loop and becomes env->current_tb. Avoid infinite loop and becomes env->current_tb. Avoid
starting execution if there is a pending interrupt. */ starting execution if there is a pending interrupt. */
if (unlikely (env->exit_request)) if (!unlikely (env->exit_request)) {
env->current_tb = NULL; env->current_tb = tb;
while (env->current_tb) {
tc_ptr = tb->tc_ptr; tc_ptr = tb->tc_ptr;
/* execute the generated code */ /* execute the generated code */
#if defined(__sparc__) && !defined(CONFIG_SOLARIS) #if defined(__sparc__) && !defined(CONFIG_SOLARIS)
@ -643,8 +639,8 @@ int cpu_exec(CPUState *env1)
cpu_loop_exit(); cpu_loop_exit();
} }
} }
assert (env->current_tb == NULL);
} }
assert (env->current_tb == NULL);
/* reset soft MMU for next block (it can currently /* reset soft MMU for next block (it can currently
only be set by a memory fault) */ only be set by a memory fault) */
} /* for(;;) */ } /* for(;;) */