Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch assert that pcb_onfault is NULL in places where it ...



details:   https://anonhg.NetBSD.org/src/rev/2e9116299df0
branches:  trunk
changeset: 753227:2e9116299df0
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Mar 21 00:10:14 2010 +0000

description:
assert that pcb_onfault is NULL in places where it should be.

diffstat:

 sys/arch/arm/arm32/fault.c      |   5 +++--
 sys/arch/powerpc/powerpc/trap.c |  14 ++++++++------
 2 files changed, 11 insertions(+), 8 deletions(-)

diffs (99 lines):

diff -r 4cc0ef0e3708 -r 2e9116299df0 sys/arch/arm/arm32/fault.c
--- a/sys/arch/arm/arm32/fault.c        Sun Mar 21 00:04:34 2010 +0000
+++ b/sys/arch/arm/arm32/fault.c        Sun Mar 21 00:10:14 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fault.c,v 1.75 2010/02/03 13:51:00 wiz Exp $   */
+/*     $NetBSD: fault.c,v 1.76 2010/03/21 00:10:14 chs Exp $   */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
 #include "opt_sa.h"
 
 #include <sys/types.h>
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.75 2010/02/03 13:51:00 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.76 2010/03/21 00:10:14 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -868,6 +868,7 @@
        }
 #endif
 
+       KASSERT(pcb->pcb_onfault == NULL);
        error = uvm_fault(map, va, VM_PROT_READ);
 
 #ifdef KERN_SA
diff -r 4cc0ef0e3708 -r 2e9116299df0 sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c   Sun Mar 21 00:04:34 2010 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c   Sun Mar 21 00:10:14 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.133 2010/02/25 23:31:48 matt Exp $  */
+/*     $NetBSD: trap.c,v 1.134 2010/03/21 00:10:14 chs Exp $   */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.133 2010/02/25 23:31:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.134 2010/03/21 00:10:14 chs Exp $");
 
 #include "opt_altivec.h"
 #include "opt_ddb.h"
@@ -84,7 +84,6 @@
        struct proc *p = l ? l->l_proc : NULL;
        struct pcb *pcb = curpcb;
        struct vm_map *map;
-       struct faultbuf *onfault;
        ksiginfo_t ksi;
        int type = frame->exc;
        int ftype, rv;
@@ -121,7 +120,9 @@
        case EXC_DSI: {
                struct faultbuf *fb;
                vaddr_t va = frame->dar;
+
                ci->ci_ev_kdsi.ev_count++;
+               fb = pcb->pcb_onfault;
 
                /*
                 * Only query UVM if no interrupts are active.
@@ -169,10 +170,9 @@
                        else
                                ftype = VM_PROT_READ;
 
-                       onfault = pcb->pcb_onfault;
                        pcb->pcb_onfault = NULL;
                        rv = uvm_fault(map, trunc_page(va), ftype);
-                       pcb->pcb_onfault = onfault;
+                       pcb->pcb_onfault = fb;
 
                        if (map != kernel_map) {
                                /*
@@ -193,7 +193,7 @@
                         */
                        rv = EFAULT;
                }
-               if ((fb = pcb->pcb_onfault) != NULL) {
+               if (fb != NULL) {
                        frame->srr0 = fb->fb_pc;
                        frame->fixreg[1] = fb->fb_sp;
                        frame->fixreg[2] = fb->fb_r2;
@@ -241,6 +241,7 @@
                        l->l_savp->savp_faultaddr = (vaddr_t)frame->dar;
                        l->l_pflag |= LP_SA_PAGEFAULT;
                }
+               KASSERT(pcb->pcb_onfault == NULL);
                rv = uvm_fault(map, trunc_page(frame->dar), ftype);
                if (rv == 0) {
                        /*
@@ -311,6 +312,7 @@
                        l->l_pflag |= LP_SA_PAGEFAULT;
                }
                ftype = VM_PROT_EXECUTE;
+               KASSERT(pcb->pcb_onfault == NULL);
                rv = uvm_fault(map, trunc_page(frame->srr0), ftype);
                if (rv == 0) {
                        l->l_pflag &= ~LP_SA_PAGEFAULT;



Home | Main Index | Thread Index | Old Index