]> git.proxmox.com Git - qemu.git/commitdiff
add assertions about env->current_tb
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 Jan 2010 08:42:08 +0000 (09:42 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 19 Jan 2010 22:31:03 +0000 (16:31 -0600)
By virtue of the previous patch env->current_tb will always be NULL at
the top of cpu_exec's outermost for loop, and at the end of the innermost
while loop.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cpu-exec.c

index 2b3e6989e3cd49a2ceceaec6b24d5894c7e969fe..44d45fcd368441cc92a239a8642598b10423e72e 100644 (file)
@@ -22,6 +22,8 @@
 #include "tcg.h"
 #include "kvm.h"
 
+#include <assert.h>
+
 #if !defined(CONFIG_SOFTMMU)
 #undef EAX
 #undef ECX
@@ -260,7 +262,7 @@ int cpu_exec(CPUState *env1)
                     env = cpu_single_env;
 #define env cpu_single_env
 #endif
-            env->current_tb = NULL;
+            assert (env->current_tb == NULL);
             /* if an exception is pending, we execute it here */
             if (env->exception_index >= 0) {
                 if (env->exception_index >= EXCP_INTERRUPT) {
@@ -595,6 +597,7 @@ int cpu_exec(CPUState *env1)
                 }
                 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
@@ -640,6 +643,7 @@ int cpu_exec(CPUState *env1)
                             cpu_loop_exit();
                         }
                     }
+                    assert (env->current_tb == NULL);
                 }
                 /* reset soft MMU for next block (it can currently
                    only be set by a memory fault) */