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