aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-24 18:03:11 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-24 18:03:11 +0000
commitd9f75a4eb449c96dd47731a4d6f1619f3c23b5e7 (patch)
tree22c64ca0a8c20130aeca278967aec186212a3b6f
parent96248fd89093579dd7257bda3357a28d3c848bba (diff)
qemu: create helper for event notification (Marcelo Tosatti)
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7236 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--hw/mac_dbdma.c4
-rw-r--r--qemu-common.h3
-rw-r--r--vl.c43
3 files changed, 25 insertions, 25 deletions
diff --git a/hw/mac_dbdma.c b/hw/mac_dbdma.c
index b8e4b128d4..e863980d9c 100644
--- a/hw/mac_dbdma.c
+++ b/hw/mac_dbdma.c
@@ -651,9 +651,7 @@ void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,
void DBDMA_schedule(void)
{
- CPUState *env = cpu_single_env;
- if (env)
- cpu_exit(env);
+ qemu_notify_event();
}
static void
diff --git a/qemu-common.h b/qemu-common.h
index c10043db7b..ee963c11de 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -186,6 +186,9 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id);
/* Force QEMU to stop what it's doing and service IO */
void qemu_service_io(void);
+/* Force QEMU to process pending events */
+void qemu_notify_event(void);
+
typedef struct QEMUIOVector {
struct iovec *iov;
int niov;
diff --git a/vl.c b/vl.c
index 05e760cfd5..437f41af37 100644
--- a/vl.c
+++ b/vl.c
@@ -1193,9 +1193,8 @@ void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)
qemu_rearm_alarm_timer(alarm_timer);
}
/* Interrupt execution to force deadline recalculation. */
- if (use_icount && cpu_single_env) {
- cpu_exit(cpu_single_env);
- }
+ if (use_icount)
+ qemu_notify_event();
}
}
@@ -1370,6 +1369,7 @@ static void host_alarm_handler(int host_signum)
#endif
}
event_pending = 1;
+ qemu_notify_event();
}
}
@@ -3406,15 +3406,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
void qemu_service_io(void)
{
- CPUState *env = cpu_single_env;
- if (env) {
- cpu_exit(env);
-#ifdef CONFIG_KQEMU
- if (env->kqemu_enabled) {
- kqemu_cpu_interrupt(env);
- }
-#endif
- }
+ qemu_notify_event();
}
/***********************************************************/
@@ -3482,15 +3474,12 @@ void qemu_bh_schedule_idle(QEMUBH *bh)
void qemu_bh_schedule(QEMUBH *bh)
{
- CPUState *env = cpu_single_env;
if (bh->scheduled)
return;
bh->scheduled = 1;
bh->idle = 0;
/* stop the currently executing CPU to execute the BH ASAP */
- if (env) {
- cpu_exit(env);
- }
+ qemu_notify_event();
}
void qemu_bh_cancel(QEMUBH *bh)
@@ -3701,22 +3690,32 @@ void qemu_system_reset_request(void)
} else {
reset_requested = 1;
}
- if (cpu_single_env)
- cpu_exit(cpu_single_env);
+ qemu_notify_event();
}
void qemu_system_shutdown_request(void)
{
shutdown_requested = 1;
- if (cpu_single_env)
- cpu_exit(cpu_single_env);
+ qemu_notify_event();
}
void qemu_system_powerdown_request(void)
{
powerdown_requested = 1;
- if (cpu_single_env)
- cpu_exit(cpu_single_env);
+ qemu_notify_event();
+}
+
+void qemu_notify_event(void)
+{
+ CPUState *env = cpu_single_env;
+
+ if (env) {
+ cpu_exit(env);
+#ifdef USE_KQEMU
+ if (env->kqemu_enabled)
+ kqemu_cpu_interrupt(env);
+#endif
+ }
}
#ifdef _WIN32