]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/vm_prot.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / mach / vm_prot.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 5 *
8ad349bb
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
1c79356b
A
29 */
30/*
31 * @OSF_COPYRIGHT@
32 */
1c79356b
A
33/*
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58/*
59 */
60/*
61 * File: mach/vm_prot.h
62 * Author: Avadis Tevanian, Jr., Michael Wayne Young
63 *
64 * Virtual memory protection definitions.
65 *
66 */
67
91447636
A
68#ifndef _MACH_VM_PROT_H_
69#define _MACH_VM_PROT_H_
1c79356b
A
70
71/*
72 * Types defined:
73 *
74 * vm_prot_t VM protection values.
75 */
76
77typedef int vm_prot_t;
78
79/*
80 * Protection values, defined as bits within the vm_prot_t type
81 */
82
83#define VM_PROT_NONE ((vm_prot_t) 0x00)
84
85#define VM_PROT_READ ((vm_prot_t) 0x01) /* read permission */
86#define VM_PROT_WRITE ((vm_prot_t) 0x02) /* write permission */
87#define VM_PROT_EXECUTE ((vm_prot_t) 0x04) /* execute permission */
88
89/*
90 * The default protection for newly-created virtual memory
91 */
92
93#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
94
95/*
96 * The maximum privileges possible, for parameter checking.
97 */
98
99#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
100
101/*
102 * An invalid protection value.
103 * Used only by memory_object_lock_request to indicate no change
104 * to page locks. Using -1 here is a bad idea because it
105 * looks like VM_PROT_ALL and then some.
106 */
91447636 107
1c79356b
A
108#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x08)
109
110/*
111 * When a caller finds that he cannot obtain write permission on a
112 * mapped entry, the following flag can be used. The entry will
113 * be made "needs copy" effectively copying the object (using COW),
114 * and write permission will be added to the maximum protections
115 * for the associated entry.
116 */
91447636 117
1c79356b
A
118#define VM_PROT_COPY ((vm_prot_t) 0x10)
119
120
121/*
122 * Another invalid protection value.
123 * Used only by memory_object_data_request upon an object
124 * which has specified a copy_call copy strategy. It is used
125 * when the kernel wants a page belonging to a copy of the
126 * object, and is only asking the object as a result of
127 * following a shadow chain. This solves the race between pages
128 * being pushed up by the memory manager and the kernel
129 * walking down the shadow chain.
130 */
91447636 131
1c79356b
A
132#define VM_PROT_WANTS_COPY ((vm_prot_t) 0x10)
133
91447636 134#endif /* _MACH_VM_PROT_H_ */