.\" .\" $OpenBSD: vm_map_copy.9,v 1.3 2000/10/12 18:06:04 aaron Exp $ .\" .\" Mach Operating System .\" Copyright (c) 1991,1990 Carnegie Mellon University .\" All Rights Reserved. .\" .\" Permission to use, copy, modify and distribute this software and its .\" documentation is hereby granted, provided that both the copyright .\" notice and this permission notice appear in all copies of the .\" software, derivative works or modified versions, and any portions .\" thereof, and that both notices appear in supporting documentation. .\" .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" .\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. .\" .\" Carnegie Mellon requests users of this software to return to .\" .\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU .\" School of Computer Science .\" Carnegie Mellon University .\" Pittsburgh PA 15213-3890 .\" .\" any improvements or extensions that they make and grant Carnegie Mellon .\" the rights to redistribute these changes. .\" .TH vm_map_copy 9 9/19/93 .CM 4 .SH NAME .nf vm_map_copy \- copies memory to a destination address .SH SYNOPSIS .nf .ft B #include .nf .ft B void vm_map_copy (dst_map, src_map, dst_addr, len, sc_addr, dst_alloc, src_destroy) vm_map_t src_map, dst_map; vm_offset_t src_addr, dst_addr; vm_size_t len; boolean_t dst_alloc, src_destroy; .fi .ft P .SH ARGUMENTS .TP 15 .B dst_map Virtual memory map to be affected. .TP 15 .B src_map Virtual memory map to copy from. .TP 15 .B dst_addr Address in \fBdst_map\fR of the start of the destination range. .TP 15 .B len Number of bytes to copy. .TP 15 .B src_addr Address in \fBsrc_map\fR of the start of the source range. .TP 15 .B dst_alloc Allocate space for destination if none exists. .TP 15 .B src_destroy Destroy the source after copy completion. .SH DESCRIPTION \fBvm_map_copy\fR causes the source memory range to be copied to the destination address. The source and destination memory ranges may overlap. The destination address range must already be allocated and writable; the source range must be readable. \fBvm_map_copy\fR is equivalent to vm_read followed by vm_write. .SH DIAGNOSTICS .TP 25 KERN_SUCCESS Memory copied. .TP 25 KERN_PROTECTION_FAILURE Either the destination region was not writable, or the source region was not readable. .TP 25 KERN_INVALID_ADDRESS Illegal or non-allocated address specified or insufficient memory allocated at one of the addresses. .SH BUGS The current implementation requires that \fBsrc_addr\fR, \fBlen\fR, and \fBdst_addr\fR all be page-aligned. Otherwise, KERN_INVALID_ARGUMENT is returned. .SH SEE ALSO vm_map_protect(9),