aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorAlfred Perlstein <alfred@FreeBSD.org>2001-05-19 01:28:09 +0000
committerAlfred Perlstein <alfred@FreeBSD.org>2001-05-19 01:28:09 +0000
commit2395531439bb140427dff4dfd6d67856f907c15e (patch)
tree7d51c8cab74aeec829658414e052238902ea14a0 /sys/kern/kern_exec.c
parent3620eb66f3ef16ff28810c74476f01e29c1562bf (diff)
downloadsrc-2395531439bb140427dff4dfd6d67856f907c15e.tar.gz
src-2395531439bb140427dff4dfd6d67856f907c15e.zip
Introduce a global lock for the vm subsystem (vm_mtx).
vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb
Notes
Notes: svn path=/head/; revision=76827
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 0b1b29e2517c..8f49538f038b 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -412,6 +412,7 @@ exec_map_first_page(imgp)
VOP_GETVOBJECT(imgp->vp, &object);
s = splvm();
+ mtx_lock(&vm_mtx);
ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
@@ -443,6 +444,7 @@ exec_map_first_page(imgp)
vm_page_free(ma[0]);
}
splx(s);
+ mtx_unlock(&vm_mtx);
return EIO;
}
}
@@ -454,6 +456,7 @@ exec_map_first_page(imgp)
pmap_kenter((vm_offset_t) imgp->image_header, VM_PAGE_TO_PHYS(ma[0]));
imgp->firstpage = ma[0];
+ mtx_unlock(&vm_mtx);
return 0;
}
@@ -461,9 +464,12 @@ void
exec_unmap_first_page(imgp)
struct image_params *imgp;
{
+
if (imgp->firstpage) {
+ mtx_lock(&vm_mtx);
pmap_kremove((vm_offset_t) imgp->image_header);
vm_page_unwire(imgp->firstpage, 1);
+ mtx_unlock(&vm_mtx);
imgp->firstpage = NULL;
}
}
@@ -482,6 +488,7 @@ exec_new_vmspace(imgp)
caddr_t stack_addr = (caddr_t) (USRSTACK - MAXSSIZ);
vm_map_t map = &vmspace->vm_map;
+ mtx_assert(&vm_mtx, MA_OWNED);
imgp->vmspace_destroyed = 1;
/*