summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2001-09-20 13:46:05 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2001-09-20 13:46:05 +0000
commit36bf37b83199471a56c46a588947ee91e89d8285 (patch)
tree4f67956d0e93c160c835cee17619316aa0916044 /sys/arch
parent65365bf16ca8b47f4ecff55133cc84c6ef500537 (diff)
Allow nesting of fault handlers by saving old onfault handler and
restoring it when the copying/copyout/badaddr functions finish.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc/powerpc/trap.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index a310741c766..5cad508fb23 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.32 2001/09/19 20:50:57 mickey Exp $ */
+/* $OpenBSD: trap.c,v 1.33 2001/09/20 13:46:04 drahn Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -497,9 +497,10 @@ badaddr(addr, len)
{
faultbuf env;
u_int32_t v;
+ register void *oldh = curpcb->pcb_onfault;
if (setfault(env)) {
- curpcb->pcb_onfault = 0;
+ curpcb->pcb_onfault = oldh;
return EFAULT;
}
switch(len) {
@@ -513,7 +514,7 @@ badaddr(addr, len)
v = *((volatile u_int8_t *)addr);
break;
}
- curpcb->pcb_onfault = 0;
+ curpcb->pcb_onfault = oldh;
return(0);
}
@@ -526,9 +527,10 @@ copyin(udaddr, kaddr, len)
void *p;
size_t l;
faultbuf env;
+ register void *oldh = curpcb->pcb_onfault;
if (setfault(env)) {
- curpcb->pcb_onfault = 0;
+ curpcb->pcb_onfault = oldh;
return EFAULT;
}
while (len > 0) {
@@ -542,7 +544,7 @@ copyin(udaddr, kaddr, len)
kaddr += l;
len -= l;
}
- curpcb->pcb_onfault = 0;
+ curpcb->pcb_onfault = oldh;
return 0;
}
@@ -555,9 +557,10 @@ copyout(kaddr, udaddr, len)
void *p;
size_t l;
faultbuf env;
+ register void *oldh = curpcb->pcb_onfault;
if (setfault(env)) {
- curpcb->pcb_onfault = 0;
+ curpcb->pcb_onfault = oldh;
return EFAULT;
}
while (len > 0) {
@@ -571,7 +574,7 @@ copyout(kaddr, udaddr, len)
kaddr += l;
len -= l;
}
- curpcb->pcb_onfault = 0;
+ curpcb->pcb_onfault = oldh;
return 0;
}