[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 upstream 19/21] provide dummy signal init functio
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v4 upstream 19/21] provide dummy signal init functions for win32 |
Date: |
Sat, 12 Mar 2011 17:44:06 +0100 |
Signed-off-by: Paolo Bonzini <address@hidden>
---
cpus.c | 143 ++++++++++++++++++++++++++++++++-------------------------------
1 files changed, 73 insertions(+), 70 deletions(-)
diff --git a/cpus.c b/cpus.c
index 2b491a9..e0bcb5c 100644
--- a/cpus.c
+++ b/cpus.c
@@ -196,6 +196,16 @@ static void cpu_handle_debug_exception(CPUState *env)
#endif
}
+#ifdef CONFIG_IOTHREAD
+static void cpu_signal(int sig)
+{
+ if (cpu_single_env) {
+ cpu_exit(cpu_single_env);
+ }
+ exit_request = 1;
+}
+#endif
+
#ifdef CONFIG_LINUX
static void sigbus_reraise(void)
{
@@ -390,6 +400,61 @@ static int qemu_signal_init(void)
return 0;
}
+static void qemu_kvm_init_cpu_signals(CPUState *env)
+{
+ int r;
+ sigset_t set;
+ struct sigaction sigact;
+
+ memset(&sigact, 0, sizeof(sigact));
+ sigact.sa_handler = dummy_signal;
+ sigaction(SIG_IPI, &sigact, NULL);
+
+#ifdef CONFIG_IOTHREAD
+ pthread_sigmask(SIG_BLOCK, NULL, &set);
+ sigdelset(&set, SIG_IPI);
+ sigdelset(&set, SIGBUS);
+ r = kvm_set_signal_mask(env, &set);
+ if (r) {
+ fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
+ exit(1);
+ }
+#else
+ sigemptyset(&set);
+ sigaddset(&set, SIG_IPI);
+ sigaddset(&set, SIGIO);
+ sigaddset(&set, SIGALRM);
+ pthread_sigmask(SIG_BLOCK, &set, NULL);
+
+ pthread_sigmask(SIG_BLOCK, NULL, &set);
+ sigdelset(&set, SIGIO);
+ sigdelset(&set, SIGALRM);
+#endif
+ sigdelset(&set, SIG_IPI);
+ sigdelset(&set, SIGBUS);
+ r = kvm_set_signal_mask(env, &set);
+ if (r) {
+ fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
+ exit(1);
+ }
+}
+
+static void qemu_tcg_init_cpu_signals(void)
+{
+#ifdef CONFIG_IOTHREAD
+ sigset_t set;
+ struct sigaction sigact;
+
+ memset(&sigact, 0, sizeof(sigact));
+ sigact.sa_handler = cpu_signal;
+ sigaction(SIG_IPI, &sigact, NULL);
+
+ sigemptyset(&set);
+ sigaddset(&set, SIG_IPI);
+ pthread_sigmask(SIG_UNBLOCK, &set, NULL);
+#endif
+}
+
static void qemu_kvm_eat_signals(CPUState *env)
{
struct timespec ts = { 0, 0 };
@@ -470,39 +535,17 @@ static int qemu_signal_init(void)
return 0;
}
-#endif /* _WIN32 */
-
-#ifndef CONFIG_IOTHREAD
static void qemu_kvm_init_cpu_signals(CPUState *env)
{
-#ifndef _WIN32
- int r;
- sigset_t set;
- struct sigaction sigact;
-
- memset(&sigact, 0, sizeof(sigact));
- sigact.sa_handler = dummy_signal;
- sigaction(SIG_IPI, &sigact, NULL);
-
- sigemptyset(&set);
- sigaddset(&set, SIG_IPI);
- sigaddset(&set, SIGIO);
- sigaddset(&set, SIGALRM);
- pthread_sigmask(SIG_BLOCK, &set, NULL);
+ abort();
+}
- pthread_sigmask(SIG_BLOCK, NULL, &set);
- sigdelset(&set, SIG_IPI);
- sigdelset(&set, SIGBUS);
- sigdelset(&set, SIGIO);
- sigdelset(&set, SIGALRM);
- r = kvm_set_signal_mask(env, &set);
- if (r) {
- fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
- exit(1);
- }
-#endif
+static void qemu_tcg_init_cpu_signals(void)
+{
}
+#endif /* _WIN32 */
+#ifndef CONFIG_IOTHREAD
int qemu_init_main_loop(void)
{
int ret;
@@ -536,6 +579,8 @@ void qemu_init_vcpu(void *_env)
exit(1);
}
qemu_kvm_init_cpu_signals(env);
+ } else {
+ qemu_tcg_init_cpu_signals();
}
}
@@ -616,48 +661,6 @@ static QemuCond qemu_system_cond;
static QemuCond qemu_pause_cond;
static QemuCond qemu_work_cond;
-static void cpu_signal(int sig)
-{
- if (cpu_single_env) {
- cpu_exit(cpu_single_env);
- }
- exit_request = 1;
-}
-
-static void qemu_kvm_init_cpu_signals(CPUState *env)
-{
- int r;
- sigset_t set;
- struct sigaction sigact;
-
- memset(&sigact, 0, sizeof(sigact));
- sigact.sa_handler = dummy_signal;
- sigaction(SIG_IPI, &sigact, NULL);
-
- pthread_sigmask(SIG_BLOCK, NULL, &set);
- sigdelset(&set, SIG_IPI);
- sigdelset(&set, SIGBUS);
- r = kvm_set_signal_mask(env, &set);
- if (r) {
- fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
- exit(1);
- }
-}
-
-static void qemu_tcg_init_cpu_signals(void)
-{
- sigset_t set;
- struct sigaction sigact;
-
- memset(&sigact, 0, sizeof(sigact));
- sigact.sa_handler = cpu_signal;
- sigaction(SIG_IPI, &sigact, NULL);
-
- sigemptyset(&set);
- sigaddset(&set, SIG_IPI);
- pthread_sigmask(SIG_UNBLOCK, &set, NULL);
-}
-
int qemu_init_main_loop(void)
{
int ret;
--
1.7.4
- [Qemu-devel] [PATCH v4 upstream 10/21] always qemu_cpu_kick after unhalting a cpu, (continued)
- [Qemu-devel] [PATCH v4 upstream 10/21] always qemu_cpu_kick after unhalting a cpu, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 09/21] inline cpu_halted into sole caller, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 12/21] always signal pause_cond after stopping a VCPU, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 13/21] do not use timedwait on qemu_halt_cond, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 14/21] do not use timedwait on qemu_system_cond, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 15/21] do not use timedwait on qemu_pause_cond, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 17/21] iothread stops the vcpu thread via IPI, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 16/21] do not use timedwait on qemu_cpu_cond, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 18/21] merge all signal initialization with qemu_signalfd_init, rename, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 20/21] protect qemu_cpu_kick_self for Win32, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 19/21] provide dummy signal init functions for win32,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v4 upstream 21/21] add Win32 IPI service, Paolo Bonzini, 2011/03/12
- [Qemu-devel] [PATCH v4 upstream 11/21] exit round-robin vcpu loop if cpu->stopped is true, Paolo Bonzini, 2011/03/12
- [Qemu-devel] Re: [PATCH v4 upstream 00/21] Win32 iothread support, Blue Swirl, 2011/03/13