diff mbox

[RFC,v8,03/21] sysemu: system functions for replay

Message ID 20150122085147.5276.43446.stgit@PASHA-ISP.def.inno
State New
Headers show

Commit Message

Pavel Dovgalyuk Jan. 22, 2015, 8:51 a.m. UTC
This patch removes "static" specifier from several qemu function to make
them visible to the replay module. It also invents several system functions
that will be used by replay.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
---
 cpus.c                  |    4 ++--
 include/exec/exec-all.h |    1 +
 include/qom/cpu.h       |   10 ++++++++++
 include/sysemu/cpus.h   |    1 +
 translate-all.c         |    8 ++++++++
 5 files changed, 22 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini Jan. 29, 2015, 9:03 a.m. UTC | #1
On 22/01/2015 09:51, Pavel Dovgalyuk wrote:
> This patch removes "static" specifier from several qemu function to make
> them visible to the replay module. It also invents several system functions
> that will be used by replay.
> 
> Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
> ---
>  cpus.c                  |    4 ++--
>  include/exec/exec-all.h |    1 +
>  include/qom/cpu.h       |   10 ++++++++++
>  include/sysemu/cpus.h   |    1 +
>  translate-all.c         |    8 ++++++++
>  5 files changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 3a5323b..c513275 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -88,7 +88,7 @@ static bool cpu_thread_is_idle(CPUState *cpu)
>      return true;
>  }
>  
> -static bool all_cpu_threads_idle(void)
> +bool all_cpu_threads_idle(void)
>  {
>      CPUState *cpu;
>  
> @@ -1121,7 +1121,7 @@ bool qemu_cpu_is_self(CPUState *cpu)
>      return qemu_thread_is_self(cpu->thread);
>  }
>  
> -static bool qemu_in_vcpu_thread(void)
> +bool qemu_in_vcpu_thread(void)
>  {
>      return current_cpu && qemu_cpu_is_self(current_cpu);
>  }
> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> index 4a6237f..63fb1a3 100644
> --- a/include/exec/exec-all.h
> +++ b/include/exec/exec-all.h
> @@ -214,6 +214,7 @@ static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
>  
>  void tb_free(TranslationBlock *tb);
>  void tb_flush(CPUArchState *env);
> +void tb_flush_all(void);
>  void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
>  
>  #if defined(USE_DIRECT_JUMP)
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 2098f1c..5afb44c 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -480,6 +480,16 @@ static inline bool cpu_has_work(CPUState *cpu)
>  bool qemu_cpu_is_self(CPUState *cpu);
>  
>  /**
> + * qemu_in_vcpu_thread:
> + *
> + * Checks whether the caller is executing on the vCPU thread
> + * of the current vCPU.
> + *
> + * Returns: %true if called from vCPU's thread, %false otherwise.
> + */
> +bool qemu_in_vcpu_thread(void);
> +
> +/**
>   * qemu_cpu_kick:
>   * @cpu: The vCPU to kick.
>   *
> diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
> index 3f162a9..86ae556 100644
> --- a/include/sysemu/cpus.h
> +++ b/include/sysemu/cpus.h
> @@ -6,6 +6,7 @@ void qemu_init_cpu_loop(void);
>  void resume_all_vcpus(void);
>  void pause_all_vcpus(void);
>  void cpu_stop_current(void);
> +bool all_cpu_threads_idle(void);
>  
>  void cpu_synchronize_all_states(void);
>  void cpu_synchronize_all_post_reset(void);
> diff --git a/translate-all.c b/translate-all.c
> index 4a1b64f..c0cba7d 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -812,6 +812,14 @@ void tb_flush(CPUArchState *env1)
>      tcg_ctx.tb_ctx.tb_flush_count++;
>  }
>  
> +void tb_flush_all(void)
> +{
> +    CPUState *cpu;
> +    for (cpu = first_cpu ; cpu != NULL ; cpu = CPU_NEXT(cpu)) {
> +        tb_flush(cpu->env_ptr);
> +    }
> +}
> +
>  #ifdef DEBUG_TB_CHECK
>  
>  static void tb_invalidate_check(target_ulong address)
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index 3a5323b..c513275 100644
--- a/cpus.c
+++ b/cpus.c
@@ -88,7 +88,7 @@  static bool cpu_thread_is_idle(CPUState *cpu)
     return true;
 }
 
-static bool all_cpu_threads_idle(void)
+bool all_cpu_threads_idle(void)
 {
     CPUState *cpu;
 
@@ -1121,7 +1121,7 @@  bool qemu_cpu_is_self(CPUState *cpu)
     return qemu_thread_is_self(cpu->thread);
 }
 
-static bool qemu_in_vcpu_thread(void)
+bool qemu_in_vcpu_thread(void)
 {
     return current_cpu && qemu_cpu_is_self(current_cpu);
 }
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 4a6237f..63fb1a3 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -214,6 +214,7 @@  static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
 
 void tb_free(TranslationBlock *tb);
 void tb_flush(CPUArchState *env);
+void tb_flush_all(void);
 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
 
 #if defined(USE_DIRECT_JUMP)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 2098f1c..5afb44c 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -480,6 +480,16 @@  static inline bool cpu_has_work(CPUState *cpu)
 bool qemu_cpu_is_self(CPUState *cpu);
 
 /**
+ * qemu_in_vcpu_thread:
+ *
+ * Checks whether the caller is executing on the vCPU thread
+ * of the current vCPU.
+ *
+ * Returns: %true if called from vCPU's thread, %false otherwise.
+ */
+bool qemu_in_vcpu_thread(void);
+
+/**
  * qemu_cpu_kick:
  * @cpu: The vCPU to kick.
  *
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index 3f162a9..86ae556 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -6,6 +6,7 @@  void qemu_init_cpu_loop(void);
 void resume_all_vcpus(void);
 void pause_all_vcpus(void);
 void cpu_stop_current(void);
+bool all_cpu_threads_idle(void);
 
 void cpu_synchronize_all_states(void);
 void cpu_synchronize_all_post_reset(void);
diff --git a/translate-all.c b/translate-all.c
index 4a1b64f..c0cba7d 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -812,6 +812,14 @@  void tb_flush(CPUArchState *env1)
     tcg_ctx.tb_ctx.tb_flush_count++;
 }
 
+void tb_flush_all(void)
+{
+    CPUState *cpu;
+    for (cpu = first_cpu ; cpu != NULL ; cpu = CPU_NEXT(cpu)) {
+        tb_flush(cpu->env_ptr);
+    }
+}
+
 #ifdef DEBUG_TB_CHECK
 
 static void tb_invalidate_check(target_ulong address)