]> git.saurik.com Git - apple/xnu.git/blob - osfmk/man/vm_copy.html
xnu-517.tar.gz
[apple/xnu.git] / osfmk / man / vm_copy.html
1 <h2>vm_copy</h2> <hr> <p> <strong>Function</strong> - Copy a region of virtual memory. <h3>SYNOPSIS</h3> <pre> <strong>kern_return_t vm_copy</strong> <strong>(vm_task_t</strong> <var>target_task</var>, <strong>vm_address_t</strong> <var>source_address</var>, <strong>vm_size_t</strong> <var>count</var>, <strong>vm_address_t</strong> <var>dest_address</var><strong>);</strong> </pre> <h3>PARAMETERS</h3> <dl> <p> <dt> <var>target_task</var> <dd> [in task send right] The port for the task whose memory is to be copied. <p> <dt> <var>source_address</var> <dd> [in scalar] The starting address for the source region. The address must be on a page boundary. <p> <dt> <var>count</var> <dd> [in scalar] The number of bytes in the source region. The number of bytes must convert to an integral number of virtual pages. <p> <dt> <var>dest_address</var> <dd> [in scalar] The starting address for the destination region. The address must be on a page boundary. </dl> <h3>DESCRIPTION</h3> <p> The <strong>vm_copy</strong> function copies a source region to a destination region within the same task's virtual memory. It is semantically equivalent to <strong>vm_read</strong> followed by <strong>vm_write</strong>. The destination region can overlap the source region. <p> The destination region must already be allocated. The source region must be readable, and the destination region must be writable. <h3>NOTES</h3> <p> This interface is machine word length specific because of the virtual address parameter. <h3>RETURN VALUES</h3> <dl> <p> <dt> <strong>KERN_PROTECTION_FAILURE</strong> <dd> The source region is protected against reading, or the destination region is protected against writing. <p> <dt> <strong>KERN_INVALID_ADDRESS</strong> <dd> An address is illegal or specifies a non-allocated region, or there is not enough memory following one of the addresses. </dl> <h3>RELATED INFORMATION</h3> <p> Functions: <a href="vm_protect.html"><strong>vm_protect</strong></a>, <a href="vm_read.html"><strong>vm_read</strong></a>, <a href="vm_write.html"><strong>vm_write</strong></a>, <a href="host_page_size.html"><strong>host_page_size</strong></a>.