]> git.saurik.com Git - apple/xnu.git/blame - osfmk/man/vm_copy.html
xnu-1504.3.12.tar.gz
[apple/xnu.git] / osfmk / man / vm_copy.html
CommitLineData
13fec989
A
1<h2>vm_copy</h2>
2<hr>
3<p>
4<strong>Function</strong> - Copy a region of virtual memory.
5<h3>SYNOPSIS</h3>
6<pre>
7<strong>kern_return_t vm_copy</strong>
8 <strong>(vm_task_t</strong> <var>target_task</var>,
9 <strong>vm_address_t</strong> <var>source_address</var>,
10 <strong>vm_size_t</strong> <var>count</var>,
11 <strong>vm_address_t</strong> <var>dest_address</var><strong>);</strong>
12</pre>
13<h3>PARAMETERS</h3>
14<dl>
15<p>
16<dt> <var>target_task</var>
17<dd>
18[in task send right]
19The port for the task whose memory is to be copied.
20<p>
21<dt> <var>source_address</var>
22<dd>
23[in scalar]
24The starting address for the source region. The address must
25be on a page boundary.
26<p>
27<dt> <var>count</var>
28<dd>
29[in scalar]
30The number of bytes in the source region. The number of
31bytes must convert to an integral number of virtual pages.
32<p>
33<dt> <var>dest_address</var>
34<dd>
35[in scalar]
36The starting address for the destination region. The address
37must be on a page boundary.
38</dl>
39<h3>DESCRIPTION</h3>
40<p>
41The <strong>vm_copy</strong> function copies a source region to a destination
42region within the
43same task's virtual memory. It is semantically equivalent to
44<strong>vm_read</strong> followed
45by <strong>vm_write</strong>. The destination region can overlap the source region.
46<p>
47The destination region must already be allocated. The source region must be
48readable, and the destination region must be writable.
49<h3>NOTES</h3>
50<p>
51This interface is machine word length specific because of the virtual address
52parameter.
53<h3>RETURN VALUES</h3>
54<dl>
55<p>
56<dt> <strong>KERN_PROTECTION_FAILURE</strong>
57<dd>
58The source region is protected against reading, or the destination
59region is protected against writing.
60<p>
61<dt> <strong>KERN_INVALID_ADDRESS</strong>
62<dd>
63An address is illegal or specifies a non-allocated region, or there is not
64enough memory following one of the addresses.
65</dl>
66<h3>RELATED INFORMATION</h3>
67<p>
68Functions:
69<a href="vm_protect.html"><strong>vm_protect</strong></a>,
70<a href="vm_read.html"><strong>vm_read</strong></a>,
71<a href="vm_write.html"><strong>vm_write</strong></a>,
72<a href="host_page_size.html"><strong>host_page_size</strong></a>.