summaryrefslogtreecommitdiff
path: root/share/man/man9/vm_map_copy.9
blob: e429827cb62c8e2f1ccad4d808998015e4eb8845 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
.\" 
.\"	$OpenBSD: vm_map_copy.9,v 1.2 1998/09/06 22:23:21 aaron Exp $
.\"
.\" Mach Operating System
.\" Copyright (c) 1991,1990 Carnegie Mellon University
.\" All Rights Reserved.
.\" 
.\" Permission to use, copy, modify and distribute this software and its
.\" documentation is hereby granted, provided that both the copyright
.\" notice and this permission notice appear in all copies of the
.\" software, derivative works or modified versions, and any portions
.\" thereof, and that both notices appear in supporting documentation.
.\" 
.\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
.\" CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
.\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
.\" 
.\" Carnegie Mellon requests users of this software to return to
.\" 
.\"  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
.\"  School of Computer Science
.\"  Carnegie Mellon University
.\"  Pittsburgh PA 15213-3890
.\" 
.\" any improvements or extensions that they make and grant Carnegie Mellon
.\" the rights to redistribute these changes.
.\" 
.TH vm_map_copy 9 9/19/93
.CM 4
.SH NAME
.nf
vm_map_copy  \-  copies memory to a destination address
.SH SYNOPSIS
.nf
.ft B
#include <vm/vm_map.h>

.nf
.ft B
void vm_map_copy (dst_map, src_map, dst_addr, len, sc_addr, dst_alloc, src_destroy)
	vm_map_t	src_map, dst_map;
	vm_offset_t	src_addr, dst_addr;
	vm_size_t	len;
	boolean_t	dst_alloc, src_destroy;
.fi
.ft P
.SH ARGUMENTS
.TP 15
.B
dst_map
Virtual memory map to be affected.
.TP 15
.B
src_map
Virtual memory map to copy from.
.TP 15
.B
dst_addr
Address in \fBdst_map\fR
of the start of the destination range.
.TP 15
.B
len
Number of bytes to copy.
.TP 15
.B
src_addr
Address in \fBsrc_map\fR
of the start of the source range.
.TP 15
.B
dst_alloc
Allocate space for destination if none exists.
.TP 15
.B
src_destroy
Destroy the source after copy completion.
.SH DESCRIPTION
\fBvm_map_copy\fR causes the source memory range to be copied to
the destination address.  The source and destination memory ranges
may overlap.  The destination address range must already be allocated and
writable; the source range must be readable.

\fBvm_map_copy\fR is equivalent to vm_read followed by vm_write.
.SH DIAGNOSTICS
.TP 25
KERN_SUCCESS
Memory copied.
.TP 25
KERN_PROTECTION_FAILURE
Either the destination region was
not writable, or the source region was not readable.
.TP 25
KERN_INVALID_ADDRESS
Illegal or non-allocated address specified or 
insufficient memory allocated at one of the addresses.
.SH BUGS
The current implementation requires that \fBsrc_addr\fR,
\fBlen\fR, and \fBdst_addr\fR all be page-aligned.
Otherwise, KERN_INVALID_ARGUMENT is returned.
.SH SEE ALSO
vm_map_protect(9),