summaryrefslogtreecommitdiffstats
path: root/sys/uvm/uvm_io.c
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2005-11-04 21:47:57 +0000
committermiod <miod@openbsd.org>2005-11-04 21:47:57 +0000
commite00eec33ee88d5f75fa27a505e34fb1af5be01b2 (patch)
treed5a09ebcf1687ae064b8c70cb4400c367983aded /sys/uvm/uvm_io.c
parent- add a SYNOPSIS (diff)
downloadwireguard-openbsd-e00eec33ee88d5f75fa27a505e34fb1af5be01b2.tar.xz
wireguard-openbsd-e00eec33ee88d5f75fa27a505e34fb1af5be01b2.zip
Add an extra flags argument to uvm_io(), to specify whether we want to fix
the protection of the memory mapping we're doing I/O on, or if we want to leave them as they are. This should only be necessary for breakpoint insertion in code, so we'll only use it for ptrace requests. Initially from art@ after discussion with kettenis@ millert@ and I, tested by many.
Diffstat (limited to 'sys/uvm/uvm_io.c')
-rw-r--r--sys/uvm/uvm_io.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/uvm/uvm_io.c b/sys/uvm/uvm_io.c
index 25702be8d4b..f9fb928f4bb 100644
--- a/sys/uvm/uvm_io.c
+++ b/sys/uvm/uvm_io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_io.c,v 1.15 2005/05/24 21:11:47 tedu Exp $ */
+/* $OpenBSD: uvm_io.c,v 1.16 2005/11/04 21:48:07 miod Exp $ */
/* $NetBSD: uvm_io.c,v 1.12 2000/06/27 17:29:23 mrg Exp $ */
/*
@@ -60,14 +60,12 @@
*/
int
-uvm_io(map, uio)
- vm_map_t map;
- struct uio *uio;
+uvm_io(vm_map_t map, struct uio *uio, int flags)
{
vaddr_t baseva, endva, pageoffset, kva;
vsize_t chunksz, togo, sz;
vm_map_entry_t dead_entries;
- int error;
+ int error, extractflags;
/*
* step 0: sanity checks and set up for copy loop. start with a
@@ -95,6 +93,10 @@ uvm_io(map, uio)
chunksz = min(round_page(togo + pageoffset), MAXBSIZE);
error = 0;
+ extractflags = UVM_EXTRACT_QREF | UVM_EXTRACT_CONTIG;
+ if (flags & UVM_IO_FIXPROT)
+ extractflags |= UVM_EXTRACT_FIXPROT;
+
/*
* step 1: main loop... while we've got data to move
*/
@@ -106,8 +108,7 @@ uvm_io(map, uio)
*/
error = uvm_map_extract(map, baseva, chunksz, kernel_map, &kva,
- UVM_EXTRACT_QREF | UVM_EXTRACT_CONTIG |
- UVM_EXTRACT_FIXPROT);
+ extractflags);
if (error) {
/* retry with a smaller chunk... */