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