Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode/usermode Block SIGALRM on memory access an...
details: https://anonhg.NetBSD.org/src/rev/b420c6b44ef2
branches: trunk
changeset: 769266:b420c6b44ef2
user: reinoud <reinoud%NetBSD.org@localhost>
date: Mon Sep 05 11:10:36 2011 +0000
description:
Block SIGALRM on memory access and illegal instruction signal
diffstat:
sys/arch/usermode/usermode/trap.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (62 lines):
diff -r e1a097a5011b -r b420c6b44ef2 sys/arch/usermode/usermode/trap.c
--- a/sys/arch/usermode/usermode/trap.c Mon Sep 05 11:09:38 2011 +0000
+++ b/sys/arch/usermode/usermode/trap.c Mon Sep 05 11:10:36 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.23 2011/09/04 21:01:39 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.24 2011/09/05 11:10:36 reinoud 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.23 2011/09/04 21:01:39 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.24 2011/09/05 11:10:36 reinoud Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -73,6 +73,7 @@
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
sa.sa_sigaction = mem_access_handler;
+ thunk_sigaddset(&sa.sa_mask, SIGALRM);
if (thunk_sigaction(SIGSEGV, &sa, NULL) == -1)
panic("couldn't register SIGSEGV handler : %d",
thunk_geterrno());
@@ -82,6 +83,7 @@
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
sa.sa_sigaction = illegal_instruction_handler;
+ thunk_sigaddset(&sa.sa_mask, SIGALRM);
if (thunk_sigaction(SIGILL, &sa, NULL) == -1)
panic("couldn't register SIGILL handler : %d", thunk_geterrno());
@@ -113,7 +115,7 @@
vm_prot_t atype;
vaddr_t va;
void *onfault;
- int kmem, rv;
+ int kmem, lwp_errno, rv;
recurse++;
if (recurse > 1)
@@ -125,7 +127,7 @@
onfault = pcb->pcb_onfault;
vm = p->p_vmspace;
- pcb->pcb_errno = thunk_geterrno();
+ lwp_errno = pcb->pcb_errno = thunk_geterrno();
#if 0
va = (vaddr_t) info->si_addr;
printf("mem trap lwp = %p pid = %d lid = %d, va = %p\n",
@@ -216,7 +218,8 @@
/* XXX HOWTO see arm/arm/syscall.c illegal instruction signal */
}
- thunk_seterrno(pcb->pcb_errno);
+ thunk_seterrno(lwp_errno);
+ pcb->pcb_errno = lwp_errno;
}
if (recurse > 1)
printf("leaving trap recursion level %d\n", recurse);
Home |
Main Index |
Thread Index |
Old Index