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