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