subr_uio.c (d241a0e67ff3a44947931bf8c841d9786c59efd7) | subr_uio.c (89f6b8632cc94bca2738b4fcc26e1189ef4f5dde) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 31 unchanged lines hidden (view full) --- 40#include "opt_zero.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/limits.h> 46#include <sys/lock.h> 47#include <sys/mman.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 31 unchanged lines hidden (view full) --- 40#include "opt_zero.h" 41 42#include <sys/param.h> 43#include <sys/systm.h> 44#include <sys/kernel.h> 45#include <sys/limits.h> 46#include <sys/lock.h> 47#include <sys/mman.h> |
48#include <sys/mutex.h> | |
49#include <sys/proc.h> 50#include <sys/resourcevar.h> | 48#include <sys/proc.h> 49#include <sys/resourcevar.h> |
50#include <sys/rwlock.h> |
|
51#include <sys/sched.h> 52#include <sys/sysctl.h> 53#include <sys/vnode.h> 54 55#include <vm/vm.h> 56#include <vm/vm_param.h> 57#include <vm/vm_extern.h> 58#include <vm/vm_page.h> --- 40 unchanged lines hidden (view full) --- 99 KASSERT(kern_pg->queue == PQ_NONE && kern_pg->wire_count == 1, 100 ("vm_pgmoveco: kern_pg is not correctly wired")); 101 102 if ((vm_map_lookup(&map, uaddr, 103 VM_PROT_WRITE, &entry, &uobject, 104 &upindex, &prot, &wired)) != KERN_SUCCESS) { 105 return(EFAULT); 106 } | 51#include <sys/sched.h> 52#include <sys/sysctl.h> 53#include <sys/vnode.h> 54 55#include <vm/vm.h> 56#include <vm/vm_param.h> 57#include <vm/vm_extern.h> 58#include <vm/vm_page.h> --- 40 unchanged lines hidden (view full) --- 99 KASSERT(kern_pg->queue == PQ_NONE && kern_pg->wire_count == 1, 100 ("vm_pgmoveco: kern_pg is not correctly wired")); 101 102 if ((vm_map_lookup(&map, uaddr, 103 VM_PROT_WRITE, &entry, &uobject, 104 &upindex, &prot, &wired)) != KERN_SUCCESS) { 105 return(EFAULT); 106 } |
107 VM_OBJECT_LOCK(uobject); | 107 VM_OBJECT_WLOCK(uobject); |
108retry: 109 if ((user_pg = vm_page_lookup(uobject, upindex)) != NULL) { 110 if (vm_page_sleep_if_busy(user_pg, TRUE, "vm_pgmoveco")) 111 goto retry; 112 vm_page_lock(user_pg); 113 pmap_remove_all(user_pg); 114 vm_page_free(user_pg); 115 vm_page_unlock(user_pg); 116 } else { 117 /* 118 * Even if a physical page does not exist in the 119 * object chain's first object, a physical page from a 120 * backing object may be mapped read only. 121 */ 122 if (uobject->backing_object != NULL) 123 pmap_remove(map->pmap, uaddr, uaddr + PAGE_SIZE); 124 } 125 vm_page_insert(kern_pg, uobject, upindex); 126 vm_page_dirty(kern_pg); | 108retry: 109 if ((user_pg = vm_page_lookup(uobject, upindex)) != NULL) { 110 if (vm_page_sleep_if_busy(user_pg, TRUE, "vm_pgmoveco")) 111 goto retry; 112 vm_page_lock(user_pg); 113 pmap_remove_all(user_pg); 114 vm_page_free(user_pg); 115 vm_page_unlock(user_pg); 116 } else { 117 /* 118 * Even if a physical page does not exist in the 119 * object chain's first object, a physical page from a 120 * backing object may be mapped read only. 121 */ 122 if (uobject->backing_object != NULL) 123 pmap_remove(map->pmap, uaddr, uaddr + PAGE_SIZE); 124 } 125 vm_page_insert(kern_pg, uobject, upindex); 126 vm_page_dirty(kern_pg); |
127 VM_OBJECT_UNLOCK(uobject); | 127 VM_OBJECT_WUNLOCK(uobject); |
128 vm_map_lookup_done(map, entry); 129 return(KERN_SUCCESS); 130} 131#endif /* SOCKET_SEND_COW */ 132 133int 134copyin_nofault(const void *udaddr, void *kaddr, size_t len) 135{ --- 470 unchanged lines hidden --- | 128 vm_map_lookup_done(map, entry); 129 return(KERN_SUCCESS); 130} 131#endif /* SOCKET_SEND_COW */ 132 133int 134copyin_nofault(const void *udaddr, void *kaddr, size_t len) 135{ --- 470 unchanged lines hidden --- |