xref: /xnu-10002.1.13/osfmk/man/vm_write.html (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
1*1031c584SApple OSS Distributions<h2>vm_write</h2>
2*1031c584SApple OSS Distributions<hr>
3*1031c584SApple OSS Distributions<p>
4*1031c584SApple OSS Distributions<strong>Function</strong> - Write data to the specified address in the target task's address space.
5*1031c584SApple OSS Distributions<h3>SYNOPSIS</h3>
6*1031c584SApple OSS Distributions<pre>
7*1031c584SApple OSS Distributions<strong>kern_return_t   vm_write</strong>
8*1031c584SApple OSS Distributions                <strong>(vm_task_t</strong>                          <var>target_task</var>,
9*1031c584SApple OSS Distributions                 <strong>vm_address_t</strong>                           <var>address</var>,
10*1031c584SApple OSS Distributions                 <strong>pointer_t</strong>                                 <var>data</var>,
11*1031c584SApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>              <var>data_count</var><strong>);</strong>
12*1031c584SApple OSS Distributions</pre>
13*1031c584SApple OSS Distributions<h3>PARAMETERS</h3>
14*1031c584SApple OSS Distributions<dl>
15*1031c584SApple OSS Distributions<p>
16*1031c584SApple OSS Distributions<dt> <var>target_task</var>
17*1031c584SApple OSS Distributions<dd>
18*1031c584SApple OSS Distributions[in task send right]
19*1031c584SApple OSS DistributionsThe port for the task whose memory is to be
20*1031c584SApple OSS Distributionswritten.
21*1031c584SApple OSS Distributions<p>
22*1031c584SApple OSS Distributions<dt> <var>address</var>
23*1031c584SApple OSS Distributions<dd>
24*1031c584SApple OSS Distributions[in scalar]
25*1031c584SApple OSS DistributionsThe address at which to start the write.
26*1031c584SApple OSS Distributions<p>
27*1031c584SApple OSS Distributions<dt> <var>data</var>
28*1031c584SApple OSS Distributions<dd>
29*1031c584SApple OSS Distributions[pointer to page aligned in array of bytes]
30*1031c584SApple OSS DistributionsAn array of data to be
31*1031c584SApple OSS Distributionswritten.
32*1031c584SApple OSS Distributions<p>
33*1031c584SApple OSS Distributions<dt> <var>data_count</var>
34*1031c584SApple OSS Distributions<dd>
35*1031c584SApple OSS Distributions[in scalar]
36*1031c584SApple OSS DistributionsThe number of bytes in the array.
37*1031c584SApple OSS Distributions</dl>
38*1031c584SApple OSS Distributions<h3>DESCRIPTION</h3>
39*1031c584SApple OSS Distributions<p>
40*1031c584SApple OSS DistributionsThe <strong>vm_write</strong> function writes an array of data to a
41*1031c584SApple OSS Distributionstask's virtual memory.  It
42*1031c584SApple OSS Distributionsallows one task to write to another task's memory.
43*1031c584SApple OSS Distributions<p>
44*1031c584SApple OSS DistributionsThe result of <strong>vm_write</strong> is as if <var>target_task</var> had directly
45*1031c584SApple OSS Distributionswritten into the set of
46*1031c584SApple OSS Distributionspages.  Hence, <var>target_task</var> must have write permission to the pages.
47*1031c584SApple OSS Distributions<h3>NOTES</h3>
48*1031c584SApple OSS Distributions<p>
49*1031c584SApple OSS DistributionsThis interface is machine word length specific because of the virtual address
50*1031c584SApple OSS Distributionsparameter.
51*1031c584SApple OSS Distributions<h3>RETURN VALUES</h3>
52*1031c584SApple OSS Distributions<dl>
53*1031c584SApple OSS Distributions<p>
54*1031c584SApple OSS Distributions<dt> <strong>KERN_PROTECTION_FAILURE</strong>
55*1031c584SApple OSS Distributions<dd>
56*1031c584SApple OSS DistributionsSpecified memory is valid, but does not permit writing.
57*1031c584SApple OSS Distributions<p>
58*1031c584SApple OSS Distributions<dt> <strong>KERN_INVALID_ADDRESS</strong>
59*1031c584SApple OSS Distributions<dd>
60*1031c584SApple OSS DistributionsThe address is illegal or specifies a non-allocated region.
61*1031c584SApple OSS Distributions</dl>
62*1031c584SApple OSS Distributions<h3>RELATED INFORMATION</h3>
63*1031c584SApple OSS Distributions<p>
64*1031c584SApple OSS DistributionsFunctions:
65*1031c584SApple OSS Distributions<a href="vm_copy.html"><strong>vm_copy</strong></a>,
66*1031c584SApple OSS Distributions<a href="vm_protect.html"><strong>vm_protect</strong></a>,
67*1031c584SApple OSS Distributions<a href="vm_read.html"><strong>vm_read</strong></a>,
68*1031c584SApple OSS Distributions<a href="host_page_size.html"><strong>host_page_size</strong></a>.
69