diff mbox

[v2,03/24] Stop current VCPU on synchronous reset requests

Message ID 22c2932c3338907497cabeca38816a6973b19c3e.1296594961.git.jan.kiszka@web.de (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka Feb. 1, 2011, 9:15 p.m. UTC
None
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index ab6e40e..ceb3a83 100644
--- a/cpus.c
+++ b/cpus.c
@@ -99,6 +99,14 @@  void cpu_synchronize_all_post_init(void)
     }
 }
 
+void cpu_stop_current(void)
+{
+    if (cpu_single_env) {
+        cpu_single_env->stopped = 1;
+        cpu_exit(cpu_single_env);
+    }
+}
+
 int cpu_is_stopped(CPUState *env)
 {
     return !vm_running || env->stopped;
@@ -863,10 +871,7 @@  void vm_stop(int reason)
          * FIXME: should not return to device code in case
          * vm_stop() has been requested.
          */
-        if (cpu_single_env) {
-            cpu_exit(cpu_single_env);
-            cpu_single_env->stop = 1;
-        }
+        cpu_stop_current();
         return;
     }
     do_vm_stop(reason);
diff --git a/cpus.h b/cpus.h
index bf4d9bb..4cadb64 100644
--- a/cpus.h
+++ b/cpus.h
@@ -6,6 +6,7 @@  int qemu_init_main_loop(void);
 void qemu_main_loop_start(void);
 void resume_all_vcpus(void);
 void pause_all_vcpus(void);
+void cpu_stop_current(void);
 
 /* vl.c */
 extern int smp_cores;
diff --git a/vl.c b/vl.c
index 33f844f..db24a05 100644
--- a/vl.c
+++ b/vl.c
@@ -1278,6 +1278,7 @@  void qemu_system_reset_request(void)
     } else {
         reset_requested = 1;
     }
+    cpu_stop_current();
     qemu_notify_event();
 }