Patchwork [1/4] clean up env->current_tb

login
register
mail settings
Submitter Paolo Bonzini
Date Jan. 15, 2010, 8:42 a.m.
Message ID <1263544930-18620-2-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/42954/
State New
Headers show

Comments

Paolo Bonzini - Jan. 15, 2010, 8:42 a.m.
There are three paths from the innermost while loop of cpu_exec
to the top of the outermost for loop.  Two do not reset
env->current_tb.  Fix this.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpu-exec.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Anthony Liguori - Jan. 19, 2010, 10:40 p.m.
On 01/15/2010 02:42 AM, Paolo Bonzini wrote:
> There are three paths from the innermost while loop of cpu_exec
> to the top of the outermost for loop.  Two do not reset
> env->current_tb.  Fix this.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>   cpu-exec.c |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 6f6ed14..9128df9 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -56,6 +56,7 @@ int qemu_cpu_has_work(CPUState *env)
>
>   void cpu_loop_exit(void)
>   {
> +    env->current_tb = NULL;
>       longjmp(env->jmp_env, 1);
>   }
>
> @@ -107,6 +108,7 @@ static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb)
>       env->current_tb = tb;
>       /* execute the generated code */
>       next_tb = tcg_qemu_tb_exec(tb->tc_ptr);
> +    env->current_tb = NULL;
>
>       if ((next_tb&  3) == 2) {
>           /* Restore PC.  This may happen if async event occurs before
>

Patch

diff --git a/cpu-exec.c b/cpu-exec.c
index 6f6ed14..9128df9 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -56,6 +56,7 @@  int qemu_cpu_has_work(CPUState *env)
 
 void cpu_loop_exit(void)
 {
+    env->current_tb = NULL;
     longjmp(env->jmp_env, 1);
 }
 
@@ -107,6 +108,7 @@  static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb)
     env->current_tb = tb;
     /* execute the generated code */
     next_tb = tcg_qemu_tb_exec(tb->tc_ptr);
+    env->current_tb = NULL;
 
     if ((next_tb & 3) == 2) {
         /* Restore PC.  This may happen if async event occurs before