Disable preemption while swapping pmap.

This commit is contained in:
ad 2008-04-27 11:39:46 +00:00
parent 1f8aca087d
commit 7d6bc631b9
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_glue.c,v 1.125 2008/04/24 15:35:31 ad Exp $ */
/* $NetBSD: uvm_glue.c,v 1.126 2008/04/27 11:39:46 ad Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.125 2008/04/24 15:35:31 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.126 2008/04/27 11:39:46 ad Exp $");
#include "opt_coredump.h"
#include "opt_kgdb.h"
@ -401,9 +401,11 @@ uvm_proc_exit(struct proc *p)
/*
* borrow proc0's address space.
*/
kpreempt_disable();
pmap_deactivate(l);
p->p_vmspace = proc0.p_vmspace;
pmap_activate(l);
kpreempt_enable();
uvmspace_free(ovm);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_map.c,v 1.253 2008/04/26 13:44:00 yamt Exp $ */
/* $NetBSD: uvm_map.c,v 1.254 2008/04/27 11:39:47 ad Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.253 2008/04/26 13:44:00 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.254 2008/04/27 11:39:47 ad Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@ -3986,9 +3986,11 @@ uvmspace_unshare(struct lwp *l)
/* make a new vmspace, still holding old one */
nvm = uvmspace_fork(ovm);
kpreempt_disable();
pmap_deactivate(l); /* unbind old vmspace */
p->p_vmspace = nvm;
pmap_activate(l); /* switch to new vmspace */
kpreempt_enable();
uvmspace_free(ovm); /* drop reference to old vmspace */
}
@ -4065,9 +4067,11 @@ uvmspace_exec(struct lwp *l, vaddr_t start, vaddr_t end)
* install new vmspace and drop our ref to the old one.
*/
kpreempt_disable();
pmap_deactivate(l);
p->p_vmspace = nvm;
pmap_activate(l);
kpreempt_enable();
uvmspace_free(ovm);
}