summaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-03-15 12:26:12 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2011-03-15 14:36:25 -0300
commit1ab3c6c07382c4249854f811cd6182a0a88e25fb (patch)
tree4aac64508f31af1086b406bbd81d8ffe3b7ff890 /cpus.c
parent3c85e74fbf9e5a39d8d13ef91a5f3dd91f0bc8a8 (diff)
Implement qemu_kvm_eat_signals only for CONFIG_LINUX
qemu_kvm_eat_signals requires POSIX support with realtime extensions for sigtimedwait. Not all our target platforms provide this. Moreover, undefined sigbus_reraise was referenced on non-Linux as well. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/cpus.c b/cpus.c
index 077729c507..26e5bbaeff 100644
--- a/cpus.c
+++ b/cpus.c
@@ -245,11 +245,58 @@ static void qemu_init_sigbus(void)
prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0);
}
+static void qemu_kvm_eat_signals(CPUState *env)
+{
+ struct timespec ts = { 0, 0 };
+ siginfo_t siginfo;
+ sigset_t waitset;
+ sigset_t chkset;
+ int r;
+
+ sigemptyset(&waitset);
+ sigaddset(&waitset, SIG_IPI);
+ sigaddset(&waitset, SIGBUS);
+
+ do {
+ r = sigtimedwait(&waitset, &siginfo, &ts);
+ if (r == -1 && !(errno == EAGAIN || errno == EINTR)) {
+ perror("sigtimedwait");
+ exit(1);
+ }
+
+ switch (r) {
+ case SIGBUS:
+ if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) {
+ sigbus_reraise();
+ }
+ break;
+ default:
+ break;
+ }
+
+ r = sigpending(&chkset);
+ if (r == -1) {
+ perror("sigpending");
+ exit(1);
+ }
+ } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));
+
+#ifndef CONFIG_IOTHREAD
+ if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {
+ qemu_notify_event();
+ }
+#endif
+}
+
#else /* !CONFIG_LINUX */
static void qemu_init_sigbus(void)
{
}
+
+static void qemu_kvm_eat_signals(CPUState *env)
+{
+}
#endif /* !CONFIG_LINUX */
#ifndef _WIN32
@@ -455,49 +502,6 @@ static void qemu_tcg_init_cpu_signals(void)
#endif
}
-static void qemu_kvm_eat_signals(CPUState *env)
-{
- struct timespec ts = { 0, 0 };
- siginfo_t siginfo;
- sigset_t waitset;
- sigset_t chkset;
- int r;
-
- sigemptyset(&waitset);
- sigaddset(&waitset, SIG_IPI);
- sigaddset(&waitset, SIGBUS);
-
- do {
- r = sigtimedwait(&waitset, &siginfo, &ts);
- if (r == -1 && !(errno == EAGAIN || errno == EINTR)) {
- perror("sigtimedwait");
- exit(1);
- }
-
- switch (r) {
- case SIGBUS:
- if (kvm_on_sigbus_vcpu(env, siginfo.si_code, siginfo.si_addr)) {
- sigbus_reraise();
- }
- break;
- default:
- break;
- }
-
- r = sigpending(&chkset);
- if (r == -1) {
- perror("sigpending");
- exit(1);
- }
- } while (sigismember(&chkset, SIG_IPI) || sigismember(&chkset, SIGBUS));
-
-#ifndef CONFIG_IOTHREAD
- if (sigismember(&chkset, SIGIO) || sigismember(&chkset, SIGALRM)) {
- qemu_notify_event();
- }
-#endif
-}
-
#else /* _WIN32 */
HANDLE qemu_event_handle;
@@ -526,10 +530,6 @@ static void qemu_event_increment(void)
}
}
-static void qemu_kvm_eat_signals(CPUState *env)
-{
-}
-
static int qemu_signal_init(void)
{
return 0;