]> git.saurik.com Git - apple/xnu.git/blob - osfmk/man/vm_copy.html
xnu-2422.1.72.tar.gz
[apple/xnu.git] / osfmk / man / vm_copy.html
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]
19 The port for the task whose memory is to be copied.
20 <p>
21 <dt> <var>source_address</var>
22 <dd>
23 [in scalar]
24 The starting address for the source region. The address must
25 be on a page boundary.
26 <p>
27 <dt> <var>count</var>
28 <dd>
29 [in scalar]
30 The number of bytes in the source region. The number of
31 bytes must convert to an integral number of virtual pages.
32 <p>
33 <dt> <var>dest_address</var>
34 <dd>
35 [in scalar]
36 The starting address for the destination region. The address
37 must be on a page boundary.
38 </dl>
39 <h3>DESCRIPTION</h3>
40 <p>
41 The <strong>vm_copy</strong> function copies a source region to a destination
42 region within the
43 same task's virtual memory. It is semantically equivalent to
44 <strong>vm_read</strong> followed
45 by <strong>vm_write</strong>. The destination region can overlap the source region.
46 <p>
47 The destination region must already be allocated. The source region must be
48 readable, and the destination region must be writable.
49 <h3>NOTES</h3>
50 <p>
51 This interface is machine word length specific because of the virtual address
52 parameter.
53 <h3>RETURN VALUES</h3>
54 <dl>
55 <p>
56 <dt> <strong>KERN_PROTECTION_FAILURE</strong>
57 <dd>
58 The source region is protected against reading, or the destination
59 region is protected against writing.
60 <p>
61 <dt> <strong>KERN_INVALID_ADDRESS</strong>
62 <dd>
63 An address is illegal or specifies a non-allocated region, or there is not
64 enough memory following one of the addresses.
65 </dl>
66 <h3>RELATED INFORMATION</h3>
67 <p>
68 Functions:
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>.