xref: /xnu-8792.81.2/osfmk/man/memory_object_create.html (revision 19c3b8c28c31cb8130e034cfb5df6bf9ba342d90)
1*19c3b8c2SApple OSS Distributions<h2>memory_object_create</h2>
2*19c3b8c2SApple OSS Distributions<hr>
3*19c3b8c2SApple OSS Distributions<p>
4*19c3b8c2SApple OSS Distributions<strong>Function</strong> - Request that the default pager handle management requests on the specified memory object.
5*19c3b8c2SApple OSS Distributions<h3>SYNOPSIS</h3>
6*19c3b8c2SApple OSS Distributions<pre>
7*19c3b8c2SApple OSS Distributions<strong>kern_return_t   memory_object_create</strong>
8*19c3b8c2SApple OSS Distributions                <strong>(memory_object_t</strong>                          <var>pager</var>,
9*19c3b8c2SApple OSS Distributions                 <strong>memory_object_t</strong>              <var>new_memory_object</var>,
10*19c3b8c2SApple OSS Distributions                 <strong>vm_size_t</strong>                      <var>new_object_size</var>,
11*19c3b8c2SApple OSS Distributions                 <strong>memory_object_control_t</strong>            <var>new_control</var>,
12*19c3b8c2SApple OSS Distributions                 <strong>vm_size_t</strong>                        <var>new_page_size</var><strong>);</strong>
13*19c3b8c2SApple OSS Distributions
14*19c3b8c2SApple OSS Distributions
15*19c3b8c2SApple OSS Distributions<strong>kern_return_t   seqnos_memory_object_create</strong>
16*19c3b8c2SApple OSS Distributions                <strong>(memory_object_t</strong>                          <var>pager</var>,
17*19c3b8c2SApple OSS Distributions                 <strong>mach_port_seqno_t</strong>                        <var>seqno</var>,
18*19c3b8c2SApple OSS Distributions                 <strong>memory_object_t</strong>              <var>new_memory_object</var>,
19*19c3b8c2SApple OSS Distributions                 <strong>vm_size_t</strong>                      <var>new_object_size</var>,
20*19c3b8c2SApple OSS Distributions                 <strong>memory_object_control_t</strong>            <var>new_control</var>,
21*19c3b8c2SApple OSS Distributions                 <strong>vm_size_t</strong>                        <var>new_page_size</var><strong>);</strong>
22*19c3b8c2SApple OSS Distributions</pre>
23*19c3b8c2SApple OSS Distributions<h3>PARAMETERS</h3>
24*19c3b8c2SApple OSS Distributions<dl>
25*19c3b8c2SApple OSS Distributions<p>
26*19c3b8c2SApple OSS Distributions<dt> <var>pager</var>
27*19c3b8c2SApple OSS Distributions<dd>
28*19c3b8c2SApple OSS Distributions[in default-pager (receive) right]
29*19c3b8c2SApple OSS DistributionsThe default memory manager service
30*19c3b8c2SApple OSS Distributionsport.
31*19c3b8c2SApple OSS Distributions<p>
32*19c3b8c2SApple OSS Distributions<dt> <var>seqno</var>
33*19c3b8c2SApple OSS Distributions<dd>
34*19c3b8c2SApple OSS Distributions[in scalar]
35*19c3b8c2SApple OSS DistributionsThe sequence number of this message relative to the pager
36*19c3b8c2SApple OSS Distributionsport.
37*19c3b8c2SApple OSS Distributions<p>
38*19c3b8c2SApple OSS Distributions<dt> <var>new_memory_object</var>
39*19c3b8c2SApple OSS Distributions<dd>
40*19c3b8c2SApple OSS Distributions[in abstract-memory-object receive right]
41*19c3b8c2SApple OSS DistributionsThe port representing the
42*19c3b8c2SApple OSS Distributionsnew abstract memory object created by the kernel.
43*19c3b8c2SApple OSS Distributions<p>
44*19c3b8c2SApple OSS Distributions<dt> <var>new_object_size</var>
45*19c3b8c2SApple OSS Distributions<dd>
46*19c3b8c2SApple OSS Distributions[in scalar]
47*19c3b8c2SApple OSS DistributionsThe expected size for the new object, in bytes.
48*19c3b8c2SApple OSS Distributions<p>
49*19c3b8c2SApple OSS Distributions<dt> <var>new_control</var>
50*19c3b8c2SApple OSS Distributions<dd>
51*19c3b8c2SApple OSS Distributions[in memory-cache-control send right]
52*19c3b8c2SApple OSS DistributionsThe memory cache control port
53*19c3b8c2SApple OSS Distributionsto be used by the memory manager when making cache management
54*19c3b8c2SApple OSS Distributionsrequests for the new object.
55*19c3b8c2SApple OSS Distributions<p>
56*19c3b8c2SApple OSS Distributions<dt> <var>new_page_size</var>
57*19c3b8c2SApple OSS Distributions<dd>
58*19c3b8c2SApple OSS Distributions[in scalar]
59*19c3b8c2SApple OSS DistributionsThe page size used by the kernel.  All calls involving this
60*19c3b8c2SApple OSS Distributionskernel must use data sizes that are integral multiples of this page size.
61*19c3b8c2SApple OSS Distributions</dl>
62*19c3b8c2SApple OSS Distributions<h3>DESCRIPTION</h3>
63*19c3b8c2SApple OSS Distributions<p>
64*19c3b8c2SApple OSS DistributionsA <strong>memory_object_create</strong> function is called as the result
65*19c3b8c2SApple OSS Distributionsof a message from the
66*19c3b8c2SApple OSS Distributionskernel requesting that the default memory manager accept responsibility
67*19c3b8c2SApple OSS Distributionsfor the
68*19c3b8c2SApple OSS Distributionsnew memory object created by the kernel.  The kernel makes this
69*19c3b8c2SApple OSS Distributionscall only to the
70*19c3b8c2SApple OSS Distributionssystem default memory manager.
71*19c3b8c2SApple OSS Distributions<p>
72*19c3b8c2SApple OSS DistributionsThe new memory object initially consists of zero-filled pages.  Only memory
73*19c3b8c2SApple OSS Distributionspages that are actually written are provided to the memory manager.  When
74*19c3b8c2SApple OSS Distributionsprocessing <strong>memory_object_data_request</strong> calls from the
75*19c3b8c2SApple OSS Distributionskernel, the default
76*19c3b8c2SApple OSS Distributionsmemory manager must use <strong>memory_object_data_unavailable</strong>
77*19c3b8c2SApple OSS Distributionsfor any pages that have not been written previously.
78*19c3b8c2SApple OSS Distributions<p>
79*19c3b8c2SApple OSS DistributionsThe kernel does not expect a reply to this call.  The kernel assumes that the
80*19c3b8c2SApple OSS Distributionsdefault memory manager will be ready to handle data requests to this object and
81*19c3b8c2SApple OSS Distributionsdoes not need the confirmation of a <strong>memory_object_change_attributes</strong> call.
82*19c3b8c2SApple OSS Distributions<h3>NOTES</h3>
83*19c3b8c2SApple OSS Distributions<p>
84*19c3b8c2SApple OSS DistributionsThe kernel requires memory objects to provide temporary backing storage for
85*19c3b8c2SApple OSS Distributionszero-filled memory created by <strong>vm_allocate</strong> calls, issued
86*19c3b8c2SApple OSS Distributionsby both user tasks and
87*19c3b8c2SApple OSS Distributionsthe kernel itself.  The kernel allocates an abstract memory object port to
88*19c3b8c2SApple OSS Distributionsrepresent the temporary backing storage and uses <strong>memory_object_create</strong>
89*19c3b8c2SApple OSS Distributionsto pass the
90*19c3b8c2SApple OSS Distributionsnew memory object to the default memory manager, which provides the storage.
91*19c3b8c2SApple OSS Distributions<p>
92*19c3b8c2SApple OSS DistributionsThe default memory manager is a trusted system component that is identified to
93*19c3b8c2SApple OSS Distributionsthe kernel at system initialization time.  The default memory manager can also
94*19c3b8c2SApple OSS Distributionsbe changed at run time using the <strong>host_default_memory_manager</strong> call.
95*19c3b8c2SApple OSS Distributions<p>
96*19c3b8c2SApple OSS DistributionsThe contents of a kernel-created (as opposed to a user-created) memory object
97*19c3b8c2SApple OSS Distributionscan be modified only in main memory.  The default memory manager must not
98*19c3b8c2SApple OSS Distributionschange the contents of a temporary memory object, or allow unrelated tasks to
99*19c3b8c2SApple OSS Distributionsaccess the memory object, control, or name port.
100*19c3b8c2SApple OSS Distributions<p>
101*19c3b8c2SApple OSS DistributionsThe kernel provides the size of a temporary memory object based on the
102*19c3b8c2SApple OSS Distributionsallocated size.  Since the object is not mapped by other tasks,
103*19c3b8c2SApple OSS Distributionsthe object will not grow
104*19c3b8c2SApple OSS Distributionsby explicit action.  However, the kernel may coalesce adjacent
105*19c3b8c2SApple OSS Distributionstemporary objects
106*19c3b8c2SApple OSS Distributionsin such a way that this object may appear to grow.  As such,
107*19c3b8c2SApple OSS Distributionsthe supplied object
108*19c3b8c2SApple OSS Distributionssize is merely a hint as to the maximum size.
109*19c3b8c2SApple OSS Distributions<h3>RETURN VALUES</h3>
110*19c3b8c2SApple OSS Distributions<p>
111*19c3b8c2SApple OSS DistributionsOnly generic errors apply.
112*19c3b8c2SApple OSS Distributions<h3>RELATED INFORMATION</h3>
113*19c3b8c2SApple OSS Distributions<p>
114*19c3b8c2SApple OSS DistributionsFunctions:
115*19c3b8c2SApple OSS Distributions<a href="DP_object_create.html"><strong>default_pager_object_create</strong></a>,
116*19c3b8c2SApple OSS Distributions<a href="MO_data_initialize.html"><strong>memory_object_data_initialize</strong></a>,
117*19c3b8c2SApple OSS Distributions<a href="MO_data_unavailable.html"><strong>memory_object_data_unavailable</strong></a>,
118*19c3b8c2SApple OSS Distributions<a href="MO_default_server.html"><strong>memory_object_default_server</strong></a>,
119*19c3b8c2SApple OSS Distributions<a href="SMO_default_server.html"><strong>seqnos_memory_object_default_server</strong></a>.
120