xref: /xnu-10002.41.9/osfmk/man/memory_object_init.html (revision 699cd48037512bf4380799317ca44ca453c82f57)
1*699cd480SApple OSS Distributions<h2>memory_object_init</h2>
2*699cd480SApple OSS Distributions<hr>
3*699cd480SApple OSS Distributions<p>
4*699cd480SApple OSS Distributions<strong>Server Interface</strong> - Initializes a memory object.
5*699cd480SApple OSS Distributions<h3>SYNOPSIS</h3>
6*699cd480SApple OSS Distributions<pre>
7*699cd480SApple OSS Distributions<strong>kern_return_t   memory_object_init</strong>
8*699cd480SApple OSS Distributions		<strong>(memory_object_t</strong>                <var>memory_object</var>,
9*699cd480SApple OSS Distributions		 <strong>memory_object_control_t       </strong><var>memory_control</var>,
10*699cd480SApple OSS Distributions		 <strong>vm_size_t</strong>            <var>memory_object_page_size</var><strong>);</strong>
11*699cd480SApple OSS Distributions
12*699cd480SApple OSS Distributions
13*699cd480SApple OSS Distributions<strong>kern_return_t   seqnos_memory_object_init</strong>
14*699cd480SApple OSS Distributions		<strong>(memory_object_t</strong>                <var>memory_object</var>,
15*699cd480SApple OSS Distributions		 <strong>mach_port_seqno_t</strong>                      <var>seqno</var>,
16*699cd480SApple OSS Distributions		 <strong>memory_object_control_t</strong>       <var>memory_control</var>,
17*699cd480SApple OSS Distributions		 <strong>vm_size_t</strong>            <var>memory_object_page_size</var><strong>);</strong>
18*699cd480SApple OSS Distributions</pre>
19*699cd480SApple OSS Distributions<h3>PARAMETERS</h3>
20*699cd480SApple OSS Distributions<dl>
21*699cd480SApple OSS Distributions<dt> <var>memory_object</var>
22*699cd480SApple OSS Distributions<dd>
23*699cd480SApple OSS Distributions[in abstract-memory-object port] The abstract memory object port that represents the memory object data, as supplied to the kernel in a vm_map call.
24*699cd480SApple OSS Distributions<p>
25*699cd480SApple OSS Distributions<dt> <var>seqno</var>
26*699cd480SApple OSS Distributions<dd>
27*699cd480SApple OSS Distributions[in scalar] The sequence number of this message relative to the abstract memory object port.
28*699cd480SApple OSS Distributions<p>
29*699cd480SApple OSS Distributions<dt> <var>memory_control</var>
30*699cd480SApple OSS Distributions<dd>
31*699cd480SApple OSS Distributions[in memory-cache-control port] The memory cache control port to be used by the memory manager. If the memory object has been supplied to more than one kernel, this parameter identifies the kernel that is making the call.
32*699cd480SApple OSS Distributions<p>
33*699cd480SApple OSS Distributions<dt> <var>memory_object_page_size</var>
34*699cd480SApple OSS Distributions<dd>
35*699cd480SApple OSS Distributions[in scalar] The page size used by the kernel. All calls involving this kernel must use data sizes that are integral multiples of this page size.
36*699cd480SApple OSS Distributions</dl>
37*699cd480SApple OSS Distributions<h3>DESCRIPTION</h3>
38*699cd480SApple OSS Distributions<p>
39*699cd480SApple OSS DistributionsA <strong>memory_object_init</strong> function is called as the result
40*699cd480SApple OSS Distributionsof a kernel message notifying a memory manager that the kernel has
41*699cd480SApple OSS Distributionsbeen asked to map the specified memory object into a task's virtual
42*699cd480SApple OSS Distributionsaddress space.  When asked to map a memory object for the first time,
43*699cd480SApple OSS Distributionsthe kernel responds by making a <strong>memory_object_init</strong>
44*699cd480SApple OSS Distributionscall on the abstract memory object. This call is provided as a
45*699cd480SApple OSS Distributionsconvenience to the memory manager, to allow it to initialize data
46*699cd480SApple OSS Distributionsstructures and prepare to receive other requests.
47*699cd480SApple OSS Distributions<p>
48*699cd480SApple OSS DistributionsIn addition to the
49*699cd480SApple OSS Distributionsabstract memory object port itself, the call provides
50*699cd480SApple OSS Distributionsa memory cache control port that the memory manager can use to
51*699cd480SApple OSS Distributionscontrol use of its data by the kernel. The memory manager gets send
52*699cd480SApple OSS Distributionsrights for this port.
53*699cd480SApple OSS Distributions<p>
54*699cd480SApple OSS DistributionsThe kernel holds send rights for the abstract memory object port, and
55*699cd480SApple OSS Distributionsboth send and receive rights for the memory cache control port.
56*699cd480SApple OSS DistributionsThe call also supplies the virtual page size to be used for
57*699cd480SApple OSS Distributionsthe memory mapping. The memory manager can use this size to detect
58*699cd480SApple OSS Distributionsmappings that use different data structures at initialization time, or
59*699cd480SApple OSS Distributionsto allocate buffers for use in reading data.
60*699cd480SApple OSS Distributions<p>
61*699cd480SApple OSS DistributionsIf a memory object is
62*699cd480SApple OSS Distributionsmapped into the address space of more than one task on different hosts
63*699cd480SApple OSS Distributions(with independent kernels), the memory manager will receive a
64*699cd480SApple OSS Distributions<strong>memory_object_init</strong> call from each kernel, containing
65*699cd480SApple OSS Distributionsa unique set of control and name ports. Note that each kernel may also
66*699cd480SApple OSS Distributionsuse a different page size.
67*699cd480SApple OSS Distributions<h3>RETURN VALUES</h3>
68*699cd480SApple OSS Distributions<p>
69*699cd480SApple OSS Distributions
70*699cd480SApple OSS DistributionsAny return value other than <strong>KERN_SUCCESS</strong>
71*699cd480SApple OSS Distributionsor <strong>MIG_NO_REPLY</strong>will cause
72*699cd480SApple OSS Distributions<strong>mach_msg_server</strong> to remove the memory cache control reference.
73*699cd480SApple OSS Distributions<h3>RELATED INFORMATION</h3>
74*699cd480SApple OSS Distributions<p>
75*699cd480SApple OSS DistributionsFunctions:
76*699cd480SApple OSS Distributions<a href="memory_object_terminate.html"><strong>memory_object_terminate</strong></a>.
77