Deleted Added
full compact
sys_process.c (253939) sys_process.c (253953)
1/*-
2 * Copyright (c) 1994, Sean Eric Fagan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1994, Sean Eric Fagan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/sys_process.c 253939 2013-08-04 21:07:24Z attilio $");
33__FBSDID("$FreeBSD: head/sys/kern/sys_process.c 253953 2013-08-05 08:55:35Z attilio $");
34
35#include "opt_compat.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/lock.h>
40#include <sys/mutex.h>
41#include <sys/syscallsubr.h>

--- 216 unchanged lines hidden (view full) ---

258 /*
259 * If we are writing, then we request vm_fault() to create a private
260 * copy of each page. Since these copies will not be writeable by the
261 * process, we must explicity request that they be dirtied.
262 */
263 writing = uio->uio_rw == UIO_WRITE;
264 reqprot = writing ? VM_PROT_COPY | VM_PROT_READ : VM_PROT_READ;
265 fault_flags = writing ? VM_FAULT_DIRTY : VM_FAULT_NORMAL;
34
35#include "opt_compat.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/lock.h>
40#include <sys/mutex.h>
41#include <sys/syscallsubr.h>

--- 216 unchanged lines hidden (view full) ---

258 /*
259 * If we are writing, then we request vm_fault() to create a private
260 * copy of each page. Since these copies will not be writeable by the
261 * process, we must explicity request that they be dirtied.
262 */
263 writing = uio->uio_rw == UIO_WRITE;
264 reqprot = writing ? VM_PROT_COPY | VM_PROT_READ : VM_PROT_READ;
265 fault_flags = writing ? VM_FAULT_DIRTY : VM_FAULT_NORMAL;
266 fault_flags |= VM_FAULT_IOBUSY;
267
268 /*
269 * Only map in one page at a time. We don't have to, but it
270 * makes things easier. This way is trivial - right?
271 */
272 do {
273 vm_offset_t uva;
274 u_int len;

--- 8 unchanged lines hidden (view full) ---

283 page_offset = uva - pageno;
284
285 /*
286 * How many bytes to copy
287 */
288 len = min(PAGE_SIZE - page_offset, uio->uio_resid);
289
290 /*
266
267 /*
268 * Only map in one page at a time. We don't have to, but it
269 * makes things easier. This way is trivial - right?
270 */
271 do {
272 vm_offset_t uva;
273 u_int len;

--- 8 unchanged lines hidden (view full) ---

282 page_offset = uva - pageno;
283
284 /*
285 * How many bytes to copy
286 */
287 len = min(PAGE_SIZE - page_offset, uio->uio_resid);
288
289 /*
291 * Fault and busy the page on behalf of the process.
290 * Fault and hold the page on behalf of the process.
292 */
291 */
293 error = vm_fault_handle(map, pageno, reqprot, fault_flags, &m);
292 error = vm_fault_hold(map, pageno, reqprot, fault_flags, &m);
294 if (error != KERN_SUCCESS) {
295 if (error == KERN_RESOURCE_SHORTAGE)
296 error = ENOMEM;
297 else
298 error = EFAULT;
299 break;
300 }
301

--- 9 unchanged lines hidden (view full) ---

311 PAGE_SIZE, VM_PROT_EXECUTE))
312 vm_sync_icache(map, uva, len);
313 vm_map_unlock_read(map);
314 }
315
316 /*
317 * Release the page.
318 */
293 if (error != KERN_SUCCESS) {
294 if (error == KERN_RESOURCE_SHORTAGE)
295 error = ENOMEM;
296 else
297 error = EFAULT;
298 break;
299 }
300

--- 9 unchanged lines hidden (view full) ---

310 PAGE_SIZE, VM_PROT_EXECUTE))
311 vm_sync_icache(map, uva, len);
312 vm_map_unlock_read(map);
313 }
314
315 /*
316 * Release the page.
317 */
319 VM_OBJECT_WLOCK(m->object);
320 vm_page_io_finish(m);
321 VM_OBJECT_WUNLOCK(m->object);
318 vm_page_lock(m);
319 vm_page_unhold(m);
320 vm_page_unlock(m);
322
323 } while (error == 0 && uio->uio_resid > 0);
324
325 return (error);
326}
327
328static int
329ptrace_vm_entry(struct thread *td, struct proc *p, struct ptrace_vm_entry *pve)

--- 914 unchanged lines hidden ---
321
322 } while (error == 0 && uio->uio_resid > 0);
323
324 return (error);
325}
326
327static int
328ptrace_vm_entry(struct thread *td, struct proc *p, struct ptrace_vm_entry *pve)

--- 914 unchanged lines hidden ---