Skip to content

Commit

Permalink
icount: set can_do_io outside TB execution
Browse files Browse the repository at this point in the history
This patch sets can_do_io function to allow reading icount
within cpu-exec, but outside TB execution.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Dovgalyuk authored and bonzini committed Dec 15, 2014
1 parent e511b4d commit 626cf8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cpu-exec.c
Expand Up @@ -168,7 +168,9 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, uint8_t *tb_ptr)
}
#endif /* DEBUG_DISAS */

cpu->can_do_io = 0;
next_tb = tcg_qemu_tb_exec(env, tb_ptr);
cpu->can_do_io = 1;
trace_exec_tb_exit((void *) (next_tb & ~TB_EXIT_MASK),
next_tb & TB_EXIT_MASK);

Expand Down Expand Up @@ -543,6 +545,7 @@ int cpu_exec(CPUArchState *env)
cpu = current_cpu;
env = cpu->env_ptr;
cc = CPU_GET_CLASS(cpu);
cpu->can_do_io = 1;
#ifdef TARGET_I386
x86_cpu = X86_CPU(cpu);
#endif
Expand Down
3 changes: 3 additions & 0 deletions cpus.c
Expand Up @@ -935,6 +935,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
qemu_thread_get_self(cpu->thread);
cpu->thread_id = qemu_get_thread_id();
cpu->exception_index = -1;
cpu->can_do_io = 1;
current_cpu = cpu;

r = kvm_init_vcpu(cpu);
Expand Down Expand Up @@ -976,6 +977,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
qemu_thread_get_self(cpu->thread);
cpu->thread_id = qemu_get_thread_id();
cpu->exception_index = -1;
cpu->can_do_io = 1;

sigemptyset(&waitset);
sigaddset(&waitset, SIG_IPI);
Expand Down Expand Up @@ -1019,6 +1021,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
cpu->thread_id = qemu_get_thread_id();
cpu->created = true;
cpu->exception_index = -1;
cpu->can_do_io = 1;
}
qemu_cond_signal(&qemu_cpu_cond);

Expand Down

0 comments on commit 626cf8f

Please sign in to comment.