diff options
author | alc <alc@FreeBSD.org> | 2002-07-24 19:47:56 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-07-24 19:47:56 +0000 |
commit | 17db4f92a12aafffaa956b8ccb10568cbf3a2505 (patch) | |
tree | 3ea548d1e022c87c68cd0d9442a3baf5089799e4 /sys/vm | |
parent | ed0d6e9ce4073b4becf39b3475f4689b9f5cb401 (diff) | |
download | FreeBSD-src-17db4f92a12aafffaa956b8ccb10568cbf3a2505.zip FreeBSD-src-17db4f92a12aafffaa956b8ccb10568cbf3a2505.tar.gz |
o Merge vm_fault_wire() and vm_fault_user_wire() by adding a new parameter,
user_wire.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_extern.h | 3 | ||||
-rw-r--r-- | sys/vm/vm_fault.c | 57 | ||||
-rw-r--r-- | sys/vm/vm_map.c | 7 |
3 files changed, 11 insertions, 56 deletions
diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index 2a29fac..c259eb7 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -76,8 +76,7 @@ int useracc(caddr_t, int, int); int vm_fault(vm_map_t, vm_offset_t, vm_prot_t, int); void vm_fault_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t); void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t); -int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t); -int vm_fault_user_wire(vm_map_t, vm_offset_t, vm_offset_t); +int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); void vm_forkproc(struct thread *, struct proc *, struct thread *, int); void vm_waitproc(struct proc *); int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, void *, vm_ooffset_t); diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 93804c7..d8f1d60 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -919,69 +919,29 @@ readrest: * Wire down a range of virtual addresses in a map. */ int -vm_fault_wire(map, start, end) - vm_map_t map; - vm_offset_t start, end; -{ - - vm_offset_t va; - pmap_t pmap; - int rv; - - pmap = vm_map_pmap(map); - - /* - * Inform the physical mapping system that the range of addresses may - * not fault, so that page tables and such can be locked down as well. - */ - pmap_pageable(pmap, start, end, FALSE); - - /* - * We simulate a fault to get the page and enter it in the physical - * map. - */ - for (va = start; va < end; va += PAGE_SIZE) { - rv = vm_fault(map, va, VM_PROT_READ|VM_PROT_WRITE, - VM_FAULT_CHANGE_WIRING); - if (rv) { - if (va != start) - vm_fault_unwire(map, start, va); - return (rv); - } - } - return (KERN_SUCCESS); -} - -/* - * vm_fault_user_wire: - * - * Wire down a range of virtual addresses in a map. This - * is for user mode though, so we only ask for read access - * on currently read only sections. - */ -int -vm_fault_user_wire(map, start, end) +vm_fault_wire(map, start, end, user_wire) vm_map_t map; vm_offset_t start, end; + boolean_t user_wire; { vm_offset_t va; - pmap_t pmap; int rv; - pmap = vm_map_pmap(map); - /* * Inform the physical mapping system that the range of addresses may * not fault, so that page tables and such can be locked down as well. */ - pmap_pageable(pmap, start, end, FALSE); + pmap_pageable(map->pmap, start, end, FALSE); /* * We simulate a fault to get the page and enter it in the physical - * map. + * map. For user wiring, we only ask for read access on currently + * read-only sections. */ for (va = start; va < end; va += PAGE_SIZE) { - rv = vm_fault(map, va, VM_PROT_READ, VM_FAULT_USER_WIRE); + rv = vm_fault(map, va, + user_wire ? VM_PROT_READ : VM_PROT_READ | VM_PROT_WRITE, + user_wire ? VM_FAULT_USER_WIRE : VM_FAULT_CHANGE_WIRING); if (rv) { if (va != start) vm_fault_unwire(map, start, va); @@ -991,7 +951,6 @@ vm_fault_user_wire(map, start, end) return (KERN_SUCCESS); } - /* * vm_fault_unwire: * diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index ea1924f..eccc09b 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1707,11 +1707,8 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, * mark. */ vm_map_unlock(map); - if (user_wire) - rv = vm_fault_user_wire(map, saved_start, - saved_end); - else - rv = vm_fault_wire(map, saved_start, saved_end); + rv = vm_fault_wire(map, saved_start, saved_end, + user_wire); vm_map_lock(map); if (last_timestamp + 1 != map->timestamp) { /* |