FreeBSD/Linux Kernel Cross Reference
sys/man/vm_map.man
1 .\"
2 .\" Mach Operating System
3 .\" Copyright (c) 1991,1990 Carnegie Mellon University
4 .\" All Rights Reserved.
5 .\"
6 .\" Permission to use, copy, modify and distribute this software and its
7 .\" documentation is hereby granted, provided that both the copyright
8 .\" notice and this permission notice appear in all copies of the
9 .\" software, derivative works or modified versions, and any portions
10 .\" thereof, and that both notices appear in supporting documentation.
11 .\"
12 .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 .\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 .\"
16 .\" Carnegie Mellon requests users of this software to return to
17 .\"
18 .\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 .\" School of Computer Science
20 .\" Carnegie Mellon University
21 .\" Pittsburgh PA 15213-3890
22 .\"
23 .\" any improvements or extensions that they make and grant Carnegie Mellon
24 .\" the rights to redistribute these changes.
25 .\"
26 .\"
27 .\" HISTORY
28 .\" $Log: vm_map.man,v $
29 .\" Revision 2.5 93/03/18 15:16:50 mrt
30 .\" corrected types
31 .\" [93/03/12 16:55:28 lli]
32 .\"
33 .\" Revision 2.4 91/05/14 17:15:56 mrt
34 .\" Correcting copyright
35 .\"
36 .\" Revision 2.3 91/02/14 14:16:22 mrt
37 .\" Changed to new Mach copyright
38 .\" [91/02/12 18:17:21 mrt]
39 .\"
40 .\" Revision 2.2 90/08/07 18:47:44 rpd
41 .\" Created.
42 .\"
43 .TH vm_map 2 10/24/88
44 .CM 4
45 .SH NAME
46 .nf
47 vm_map \- maps a memory object at specified address
48 .SH SYNOPSIS
49 .nf
50 .ft B
51 #include <mach.h>
52
53 .nf
54 .ft B
55 kern_return_t vm_map(target_task, address, size, mask, anywhere,
56 memory_object, offset, copy,
57 cur_protection, max_protection,
58 inheritance)
59 mach_port_t target_task;
60 vm_address_t *address; /* in/out */
61 vm_size_t size;
62 vm_address_t mask;
63 boolean_t anywhere;
64 mach_port_t memory_object;
65 vm_offset_t offset;
66 boolean_t copy;
67 vm_prot_t cur_protection;
68 vm_prot_t max_protection;
69 vm_inherit_t inheritance;
70
71
72
73 .fi
74 .ft P
75 .SH DESCRIPTION
76
77 .B vm_map
78 maps a region of virtual memory at the
79 specified address, for which data is to be supplied by the given memory
80 object, starting at the given offset within that object.
81 In addition to the arguments used in
82 .B vm_allocate
83 , the
84 .B vm_map
85 call allows the specification of an address alignment parameter,
86 and of the initial protection and inheritance values.
87 [See the descriptions of
88 .B vm_allocate
89 ,
90 .B vm_protect
91 , and
92 .B vm_inherit
93 .]
94
95 If the memory object in question is not currently in use, the kernel will perform a
96 .B memory_object_init
97 call at this time.
98 If the copy parameter is asserted, the specified region of the memory
99 object will be copied to this address space; changes made to this object
100 by other tasks will not be visible in this mapping, and changes made in
101 this mapping will not be visible to others (or returned to the memory object).
102
103 The
104 .B vm_map
105 call returns once the mapping is established. Completion
106 of the call does not require any action on the part of the memory manager.
107
108 Warning: Only memory objects that are provided by bona fide
109 .B memory managers
110 should be used in the
111 .B vm_map
112 call. A memory manager must
113 implement the memory object interface described elsewhere in this manual.
114 If other ports are used, a thread that accesses the mapped virtual memory
115 may become permanently hung or may receive a memory exception.
116
117 .SH ARGUMENTS
118 .TP 15
119 .B
120 target_task
121 Task to be affected.
122 .TP 15
123 .B
124 address
125 Starting address. If the anywhere option is used, this
126 address is ignored.
127 The address actually allocated will be returned in
128 .B address
129 .
130 .TP 15
131 .B
132 size
133 Number of bytes to allocate (rounded by the system in a
134 machine dependent way).
135 .TP 15
136 .B
137 mask
138 Alignment restriction. Bits asserted in this mask must not
139 be asserted in the address returned.
140 .TP 15
141 .B
142 anywhere
143 If set, the kernel should find and allocate any region of
144 the specified
145 size, and return the address of the resulting region in
146 .B address
147 .
148 .TP 15
149 .B
150 memory_object
151 Port that represents the memory object: used
152 by user tasks in
153 .B vm_map
154 ; used by the make requests for data or other management actions.
155 If this port is
156 .B MEMORY_OBJECT_NULL
157 , then zero-filled memory
158 is allocated instead.
159 .TP 15
160 .B
161 offset
162 An offset within a memory object, in bytes. This must be
163 page aligned.
164 .TP 15
165 .B
166 copy
167 If set, the range of the memory object should be copied to the
168 target task, rather than mapped read-write.
169
170 .SH DIAGNOSTICS
171 .TP 25
172 .B KERN_SUCCESS
173 The object is mapped.
174 .TP 25
175 .B KERN_NO_SPACE
176 No unused region of the task's virtual address space that
177 meets the address, size, and alignment criteria could be found.
178 .TP 25
179 .B KERN_INVALID_ARGUMENT
180 An illegal argument was provided.
181
182 .SH SEE ALSO
183 .B memory_object_server, vm_allocate
184
Cache object: 6708691fae58db386c71abd77c216d3c
|