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