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