]> git.proxmox.com Git - qemu.git/commitdiff
change while to if
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 Jan 2010 08:42:09 +0000 (09:42 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 19 Jan 2010 22:31:03 +0000 (16:31 -0600)
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>
cpu-exec.c

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