diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index c297c8ded746..a600d2a95f89 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.187 2003/09/12 23:20:26 christos Exp $ */ +/* $NetBSD: trap.c,v 1.188 2003/09/16 13:57:47 cl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.187 2003/09/12 23:20:26 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.188 2003/09/16 13:57:47 cl Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -543,6 +543,11 @@ copyfault: cr2 = rcr2(); KERNEL_PROC_LOCK(l); + if (l->l_flag & L_SA) { + KDASSERT(p != NULL && p->p_sa != NULL); + p->p_sa->sa_vp_faultaddr = (vaddr_t)cr2; + l->l_flag |= L_SA_PAGEFAULT; + } faultcommon: vm = p->p_vmspace; if (vm == NULL) @@ -605,6 +610,7 @@ copyfault: KERNEL_UNLOCK(); return; } + l->l_flag &= ~L_SA_PAGEFAULT; KERNEL_PROC_UNLOCK(l); goto out; } @@ -639,8 +645,10 @@ copyfault: (*p->p_emul->e_trapsignal)(l, &ksi); if (type == T_PAGEFLT) KERNEL_UNLOCK(); - else + else { + l->l_flag &= ~L_SA_PAGEFAULT; KERNEL_PROC_UNLOCK(l); + } break; }