From 45709939f27664c1ecedafbaab10e1b41c4e4e6f Mon Sep 17 00:00:00 2001 From: chs Date: Sun, 21 Mar 2010 00:10:14 +0000 Subject: [PATCH] assert that pcb_onfault is NULL in places where it should be. --- sys/arch/arm/arm32/fault.c | 5 +++-- sys/arch/powerpc/powerpc/trap.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sys/arch/arm/arm32/fault.c b/sys/arch/arm/arm32/fault.c index e288b4c89da1..b0f50a8a5098 100644 --- a/sys/arch/arm/arm32/fault.c +++ b/sys/arch/arm/arm32/fault.c @@ -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 -__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 #include @@ -868,6 +868,7 @@ prefetch_abort_handler(trapframe_t *tf) } #endif + KASSERT(pcb->pcb_onfault == NULL); error = uvm_fault(map, va, VM_PROT_READ); #ifdef KERN_SA diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index b2f6f808424a..1ce94e66ebd9 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -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 -__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 @@ trap(struct trapframe *frame) 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 @@ trap(struct trapframe *frame) 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 @@ trap(struct trapframe *frame) 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 @@ trap(struct trapframe *frame) */ 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 @@ trap(struct trapframe *frame) 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 @@ trap(struct trapframe *frame) 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;