summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_fault.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-07-24 19:47:56 +0000
committeralc <alc@FreeBSD.org>2002-07-24 19:47:56 +0000
commit17db4f92a12aafffaa956b8ccb10568cbf3a2505 (patch)
tree3ea548d1e022c87c68cd0d9442a3baf5089799e4 /sys/vm/vm_fault.c
parented0d6e9ce4073b4becf39b3475f4689b9f5cb401 (diff)
downloadFreeBSD-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/vm_fault.c')
-rw-r--r--sys/vm/vm_fault.c57
1 files changed, 8 insertions, 49 deletions
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:
*
OpenPOWER on IntegriCloud