xref: /xnu-8792.81.2/osfmk/man/memory_object_data_supply.html (revision 19c3b8c28c31cb8130e034cfb5df6bf9ba342d90)
1*19c3b8c2SApple OSS Distributions<h2>memory_object_data_supply</h2>
2*19c3b8c2SApple OSS Distributions<hr>
3*19c3b8c2SApple OSS Distributions<p>
4*19c3b8c2SApple OSS Distributions<strong>Function</strong> - Provide kernel with data previously requested by the kernel's Memory Management facility.
5*19c3b8c2SApple OSS Distributions<h3>SYNOPSIS</h3>
6*19c3b8c2SApple OSS Distributions<pre>
7*19c3b8c2SApple OSS Distributions<strong>kern_return_t   memory_object_data_supply</strong>
8*19c3b8c2SApple OSS Distributions                <strong>(mem_object_control_port_t</strong>       <var>memory_control</var>,
9*19c3b8c2SApple OSS Distributions                 <strong>vm_offset_t</strong>                             <var>offset</var>,
10*19c3b8c2SApple OSS Distributions                 <strong>pointer_t</strong>                                 <var>data</var>,
11*19c3b8c2SApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>              <var>data_count</var>,
12*19c3b8c2SApple OSS Distributions                 <strong>boolean_t</strong>                           <var>deallocate</var>,
13*19c3b8c2SApple OSS Distributions                 <strong>vm_prot_t</strong>                           <var>lock_value</var>,
14*19c3b8c2SApple OSS Distributions                 <strong>boolean_t</strong>                             <var>precious</var>,
15*19c3b8c2SApple OSS Distributions                 <strong>mach_port_t</strong>                         <var>reply_port</var><strong>);</strong>
16*19c3b8c2SApple OSS Distributions</pre>
17*19c3b8c2SApple OSS Distributions<h3>PARAMETERS</h3>
18*19c3b8c2SApple OSS Distributions<dl>
19*19c3b8c2SApple OSS Distributions<dt> <var>memory_control</var>
20*19c3b8c2SApple OSS Distributions<dd>
21*19c3b8c2SApple OSS Distributions[in memory-cache-control send right]
22*19c3b8c2SApple OSS DistributionsThe memory cache control port
23*19c3b8c2SApple OSS Distributionsto be used by the memory manager for cache management requests.
24*19c3b8c2SApple OSS DistributionsThis port is provided by the kernel in a <strong>memory_object_init</strong>
25*19c3b8c2SApple OSS Distributions     or <strong>memory_object_create</strong> call.
26*19c3b8c2SApple OSS Distributions<p>
27*19c3b8c2SApple OSS Distributions<p>
28*19c3b8c2SApple OSS Distributions<dt> <var>offset</var>
29*19c3b8c2SApple OSS Distributions<dd>
30*19c3b8c2SApple OSS Distributions[in scalar]
31*19c3b8c2SApple OSS DistributionsThe offset within the memory object, in bytes.
32*19c3b8c2SApple OSS Distributions<p>
33*19c3b8c2SApple OSS Distributions<p>
34*19c3b8c2SApple OSS Distributions<dt> <var>data</var>
35*19c3b8c2SApple OSS Distributions<dd>
36*19c3b8c2SApple OSS Distributions[pointer to page aligned in array of bytes]
37*19c3b8c2SApple OSS DistributionsThe address of the data
38*19c3b8c2SApple OSS Distributionsbeing provided to the kernel.
39*19c3b8c2SApple OSS Distributions<p>
40*19c3b8c2SApple OSS Distributions<p>
41*19c3b8c2SApple OSS Distributions<dt> <var>data_count</var>
42*19c3b8c2SApple OSS Distributions<dd>
43*19c3b8c2SApple OSS Distributions[in scalar]
44*19c3b8c2SApple OSS DistributionsThe amount of data to be provided.  The number must be an
45*19c3b8c2SApple OSS Distributionsintegral number of memory object pages.
46*19c3b8c2SApple OSS Distributions<p>
47*19c3b8c2SApple OSS Distributions<p>
48*19c3b8c2SApple OSS Distributions<dt> <var>deallocate</var>
49*19c3b8c2SApple OSS Distributions<dd>
50*19c3b8c2SApple OSS Distributions[in scalar]
51*19c3b8c2SApple OSS DistributionsIf <strong>TRUE</strong>, the pages to be copied (starting at data) will be
52*19c3b8c2SApple OSS Distributionsdeallocated from the memory manager's address space as a result of
53*19c3b8c2SApple OSS Distributionsbeing copied into the message, allowing the pages to be moved into the
54*19c3b8c2SApple OSS Distributionskernel instead of being physically copied.
55*19c3b8c2SApple OSS Distributions<p>
56*19c3b8c2SApple OSS Distributions<p>
57*19c3b8c2SApple OSS Distributions<dt> <var>lock_value</var>
58*19c3b8c2SApple OSS Distributions<dd>
59*19c3b8c2SApple OSS Distributions[in scalar]
60*19c3b8c2SApple OSS DistributionsOne or more forms of access <var>not</var> permitted for the specified
61*19c3b8c2SApple OSS Distributionsdata.  Valid values are:
62*19c3b8c2SApple OSS Distributions<dl>
63*19c3b8c2SApple OSS Distributions<p>
64*19c3b8c2SApple OSS Distributions<p>
65*19c3b8c2SApple OSS Distributions<dt> <strong>VM_PROT_NONE</strong>
66*19c3b8c2SApple OSS Distributions<dd>
67*19c3b8c2SApple OSS DistributionsProhibits no access (that is, all forms of access are permitted).
68*19c3b8c2SApple OSS Distributions<p>
69*19c3b8c2SApple OSS Distributions<p>
70*19c3b8c2SApple OSS Distributions<dt> <strong>VM_PROT_READ</strong>
71*19c3b8c2SApple OSS Distributions<dd>
72*19c3b8c2SApple OSS DistributionsProhibits read access.
73*19c3b8c2SApple OSS Distributions<p>
74*19c3b8c2SApple OSS Distributions<p>
75*19c3b8c2SApple OSS Distributions<dt> <strong>VM_PROT_WRITE</strong>
76*19c3b8c2SApple OSS Distributions<dd>
77*19c3b8c2SApple OSS DistributionsProhibits write access.
78*19c3b8c2SApple OSS Distributions<p>
79*19c3b8c2SApple OSS Distributions<p>
80*19c3b8c2SApple OSS Distributions<dt> <strong>VM_PROT_EXECUTE</strong>
81*19c3b8c2SApple OSS Distributions<dd>
82*19c3b8c2SApple OSS DistributionsProhibits execute access.
83*19c3b8c2SApple OSS Distributions<p>
84*19c3b8c2SApple OSS Distributions<p>
85*19c3b8c2SApple OSS Distributions<dt> <strong>VM_PROT_ALL</strong>
86*19c3b8c2SApple OSS Distributions<dd>
87*19c3b8c2SApple OSS DistributionsProhibits all forms of access.
88*19c3b8c2SApple OSS Distributions</dl>
89*19c3b8c2SApple OSS Distributions<p>
90*19c3b8c2SApple OSS Distributions<p>
91*19c3b8c2SApple OSS Distributions<dt> <var>precious</var>
92*19c3b8c2SApple OSS Distributions<dd>
93*19c3b8c2SApple OSS Distributions[in scalar]
94*19c3b8c2SApple OSS DistributionsIf <strong>TRUE</strong>, the pages being supplied are "precious," that is,
95*19c3b8c2SApple OSS Distributionsthe memory manager is not (necessarily) retaining its own copy.  These
96*19c3b8c2SApple OSS Distributionspages must be returned to the manager when evicted from memory,
97*19c3b8c2SApple OSS Distributionseven if not modified.
98*19c3b8c2SApple OSS Distributions<p>
99*19c3b8c2SApple OSS Distributions<p>
100*19c3b8c2SApple OSS Distributions<dt> <var>reply_port</var>
101*19c3b8c2SApple OSS Distributions<dd>
102*19c3b8c2SApple OSS Distributions[in reply receive (to be converted to send) right]
103*19c3b8c2SApple OSS DistributionsA port to which the
104*19c3b8c2SApple OSS Distributionskernel should send a <strong>memory_object_supply_completed</strong> to indicate
105*19c3b8c2SApple OSS Distributionsthe status of the accepted data.  <strong>MACH_PORT_NULL</strong> is allowed.  The
106*19c3b8c2SApple OSS Distributionsreply message indicates which pages have been accepted.
107*19c3b8c2SApple OSS Distributions</dl>
108*19c3b8c2SApple OSS Distributions<h3>DESCRIPTION</h3>
109*19c3b8c2SApple OSS Distributions<p>
110*19c3b8c2SApple OSS DistributionsThe <strong>memory_object_data_supply</strong> function supplies the
111*19c3b8c2SApple OSS Distributionskernel with a range of
112*19c3b8c2SApple OSS Distributionsdata for the specified memory object.  A memory manager can only provide data
113*19c3b8c2SApple OSS Distributionsthat was requested by a <strong>memory_object_data_request</strong>
114*19c3b8c2SApple OSS Distributionscall from the kernel.
115*19c3b8c2SApple OSS Distributions<h3>NOTES</h3>
116*19c3b8c2SApple OSS Distributions<p>
117*19c3b8c2SApple OSS DistributionsThe kernel accepts only integral numbers of pages.  It discards
118*19c3b8c2SApple OSS Distributionsany partial pages
119*19c3b8c2SApple OSS Distributionswithout notification.
120*19c3b8c2SApple OSS Distributions<h3>CAUTIONS</h3>
121*19c3b8c2SApple OSS Distributions<p>
122*19c3b8c2SApple OSS DistributionsA memory manager must be careful that it not attempt to provide data that has
123*19c3b8c2SApple OSS Distributionsnot been explicitly requested.  In particular, a memory manager
124*19c3b8c2SApple OSS Distributionsmust ensure that
125*19c3b8c2SApple OSS Distributionsit does not provide writable data again before it receives back modifications
126*19c3b8c2SApple OSS Distributionsfrom the kernel.  This may require that the memory manager remember which
127*19c3b8c2SApple OSS Distributionspages it has provided, or that it exercise other cache control functions (via
128*19c3b8c2SApple OSS Distributions<strong>memory_object_lock_request</strong>) before proceeding.  The kernel prohibits the
129*19c3b8c2SApple OSS Distributionsoverwriting of live data pages and will not accept pages it has not requested.
130*19c3b8c2SApple OSS Distributions<h3>RETURN VALUES</h3>
131*19c3b8c2SApple OSS Distributions<p>
132*19c3b8c2SApple OSS DistributionsOnly generic errors apply.
133*19c3b8c2SApple OSS Distributions<h3>RELATED INFORMATION</h3>
134*19c3b8c2SApple OSS Distributions<p>
135*19c3b8c2SApple OSS DistributionsFunctions:
136*19c3b8c2SApple OSS Distributions<a href="memory_object_data_error.html"><strong>memory_object_data_error</strong></a>,
137*19c3b8c2SApple OSS Distributions<a href="memory_object_data_request.html"><strong>memory_object_data_request</strong></a>,
138*19c3b8c2SApple OSS Distributions<a href="MO_data_unavailable.html"><strong>memory_object_data_unavailable</strong></a>,
139*19c3b8c2SApple OSS Distributions<a href="memory_object_lock_request.html"><strong>memory_object_lock_request</strong></a>,
140*19c3b8c2SApple OSS Distributions<a href="MO_supply_completed.html"><strong>memory_object_supply_completed</strong></a>.
141