Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode make sure the sigio signal handler runs on...
details: https://anonhg.NetBSD.org/src/rev/e9a51191bb16
branches: trunk
changeset: 772260:e9a51191bb16
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Dec 26 22:04:35 2011 +0000
description:
make sure the sigio signal handler runs on the alternate signal stack,
fixes random SIGILLs seen recently
diffstat:
sys/arch/usermode/include/intr.h | 5 +++--
sys/arch/usermode/usermode/intr.c | 14 ++++----------
sys/arch/usermode/usermode/trap.c | 20 +++++++++++---------
3 files changed, 18 insertions(+), 21 deletions(-)
diffs (117 lines):
diff -r 9684141d8c52 -r e9a51191bb16 sys/arch/usermode/include/intr.h
--- a/sys/arch/usermode/include/intr.h Mon Dec 26 21:51:53 2011 +0000
+++ b/sys/arch/usermode/include/intr.h Mon Dec 26 22:04:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.5 2011/12/26 12:29:39 jmcneill Exp $ */
+/* $NetBSD: intr.h,v 1.6 2011/12/26 22:04:35 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,8 +30,9 @@
#define _ARCH_USERMODE_INCLUDE_INTR_H
#include <machine/intrdefs.h>
+#include <sys/siginfo.h>
-void sigio_intr_init(void);
+void sigio_signal_handler(int, siginfo_t *, void *);
void * sigio_intr_establish(int (*)(void *), void *);
void splinit(void);
diff -r 9684141d8c52 -r e9a51191bb16 sys/arch/usermode/usermode/intr.c
--- a/sys/arch/usermode/usermode/intr.c Mon Dec 26 21:51:53 2011 +0000
+++ b/sys/arch/usermode/usermode/intr.c Mon Dec 26 22:04:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.10 2011/12/26 12:29:39 jmcneill Exp $ */
+/* $NetBSD: intr.c,v 1.11 2011/12/26 22:04:35 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.10 2011/12/26 12:29:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.11 2011/12/26 22:04:35 jmcneill Exp $");
#include <sys/types.h>
@@ -144,8 +144,8 @@
#endif
}
-static void
-sigio_signal_handler(int sig)
+void
+sigio_signal_handler(int sig, siginfo_t *info, void *ctx)
{
struct intr_handler *sih;
unsigned int n;
@@ -157,12 +157,6 @@
}
}
-void
-sigio_intr_init(void)
-{
- thunk_signal(SIGIO, sigio_signal_handler);
-}
-
void *
sigio_intr_establish(int (*func)(void *), void *arg)
{
diff -r 9684141d8c52 -r e9a51191bb16 sys/arch/usermode/usermode/trap.c
--- a/sys/arch/usermode/usermode/trap.c Mon Dec 26 21:51:53 2011 +0000
+++ b/sys/arch/usermode/usermode/trap.c Mon Dec 26 22:04:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.47 2011/12/26 12:29:39 jmcneill Exp $ */
+/* $NetBSD: trap.c,v 1.48 2011/12/26 22:04:35 jmcneill Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <reinoud%netbsd.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.47 2011/12/26 12:29:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.48 2011/12/26 22:04:35 jmcneill Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -76,27 +76,29 @@
sigstk.ss_size = SIGSTKSZ;
sigstk.ss_flags = 0;
if (thunk_sigaltstack(&sigstk, 0) < 0)
- panic("can't set alternate stacksize : %d",
+ panic("can't set alternate stacksize: %d",
thunk_geterrno());
sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
sa.sa_sigaction = mem_access_handler;
thunk_sigemptyset(&sa.sa_mask);
-// thunk_sigaddset(&sa.sa_mask, SIGALRM);
if (thunk_sigaction(SIGSEGV, &sa, NULL) == -1)
- panic("couldn't register SIGSEGV handler : %d",
+ panic("couldn't register SIGSEGV handler: %d",
thunk_geterrno());
if (thunk_sigaction(SIGBUS, &sa, NULL) == -1)
- panic("couldn't register SIGBUS handler : %d", thunk_geterrno());
+ panic("couldn't register SIGBUS handler: %d", thunk_geterrno());
sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
sa.sa_sigaction = illegal_instruction_handler;
thunk_sigemptyset(&sa.sa_mask);
-// thunk_sigaddset(&sa.sa_mask, SIGALRM);
if (thunk_sigaction(SIGILL, &sa, NULL) == -1)
- panic("couldn't register SIGILL handler : %d", thunk_geterrno());
+ panic("couldn't register SIGILL handler: %d", thunk_geterrno());
- sigio_intr_init();
+ sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
+ sa.sa_sigaction = sigio_signal_handler;
+ thunk_sigemptyset(&sa.sa_mask);
+ if (thunk_sigaction(SIGIO, &sa, NULL) == -1)
+ panic("couldn't register SIGIO handler: %d", thunk_geterrno());
}
Home |
Main Index |
Thread Index |
Old Index