xref: /NextBSD/sys/sys/mach/vm_prot.h (revision 33da5adc555b3bc29986eeadca03829e4ad06b1e)
1 /*
2  * Copyright 1991-1998 by Open Software Foundation, Inc.
3  *              All Rights Reserved
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both the copyright notice and this permission notice appear in
9  * supporting documentation.
10  *
11  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13  * FOR A PARTICULAR PURPOSE.
14  *
15  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 /*
22  * MkLinux
23  */
24 /* CMU_HIST */
25 /*
26  * Revision 2.4.3.1  92/03/03  16:22:41  jeffreyh
27  * 	[David L. Black 92/02/22  17:03:43  dlb@osf.org]
28  * 	   Add no change protection value for memory_object_lock_request.
29  *
30  * Revision 2.4  91/05/14  17:03:00  mrt
31  * 	Correcting copyright
32  *
33  * Revision 2.3  91/02/05  17:37:38  mrt
34  * 	Changed to new Mach copyright
35  * 	[91/02/01  17:22:39  mrt]
36  *
37  * Revision 2.2  90/01/22  23:05:57  af
38  * 	Removed execute permission from default protection.
39  * 	On the only machine that cares for execute permission (mips)
40  * 	this is an expensive liability: it requires keeping
41  * 	Icache consistent memory that never contains code.
42  * 	[89/12/15            af]
43  *
44  * Revision 2.1  89/08/03  16:06:47  rwd
45  * Created.
46  *
47  * Revision 2.3  89/02/25  18:42:29  gm0w
48  * 	Changes for cleanup.
49  *
50  *  6-Jun-85  Avadis Tevanian (avie) at Carnegie-Mellon University
51  *	Created.
52  *
53  */
54 /* CMU_ENDHIST */
55 /*
56  * Mach Operating System
57  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
58  * All Rights Reserved.
59  *
60  * Permission to use, copy, modify and distribute this software and its
61  * documentation is hereby granted, provided that both the copyright
62  * notice and this permission notice appear in all copies of the
63  * software, derivative works or modified versions, and any portions
64  * thereof, and that both notices appear in supporting documentation.
65  *
66  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
67  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
68  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
69  *
70  * Carnegie Mellon requests users of this software to return to
71  *
72  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
73  *  School of Computer Science
74  *  Carnegie Mellon University
75  *  Pittsburgh PA 15213-3890
76  *
77  * any improvements or extensions that they make and grant Carnegie Mellon
78  * the rights to redistribute these changes.
79  */
80 /*
81  */
82 /*
83  *	File:	mach/vm_prot.h
84  *	Author:	Avadis Tevanian, Jr., Michael Wayne Young
85  *
86  *	Virtual memory protection definitions.
87  *
88  */
89 
90 #ifndef	VM_PROT_H_
91 #define	VM_PROT_H_
92 #include <vm/vm.h>
93 #include <vm/vm_param.h>
94 /*
95  *	Types defined:
96  *
97  *	vm_prot_t		VM protection values.
98  */
99 
100 /*
101  *	Protection values, defined as bits within the vm_prot_t type
102  */
103 
104 #define	VM_PROT_NONE	((vm_prot_t) 0x00)
105 
106 #define VM_PROT_READ	((vm_prot_t) 0x01)	/* read permission */
107 #define VM_PROT_WRITE	((vm_prot_t) 0x02)	/* write permission */
108 #define VM_PROT_EXECUTE	((vm_prot_t) 0x04)	/* execute permission */
109 
110 /*
111  *	The default protection for newly-created virtual memory
112  */
113 
114 
115 /*
116  *	The maximum privileges possible, for parameter checking.
117  */
118 
119 #define VM_PROT_ALL	(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
120 
121 /*
122  *	An invalid protection value.
123  *	Used only by memory_object_lock_request to indicate no change
124  *	to page locks.  Using -1 here is a bad idea because it
125  *	looks like VM_PROT_ALL and then some.
126  */
127 #define VM_PROT_NO_CHANGE	((vm_prot_t) 0x08)
128 
129 /*
130  *	Another invalid protection value.
131  *	Used only by memory_object_data_request upon an object
132  *	which has specified a copy_call copy strategy. It is used
133  *	when the kernel wants a page belonging to a copy of the
134  *	object, and is only asking the object as a result of
135  *	following a shadow chain. This solves the race between pages
136  *	being pushed up by the memory manager and the kernel
137  *	walking down the shadow chain.
138  */
139 #define VM_PROT_WANTS_COPY	((vm_prot_t) 0x10)
140 
141 #define VM_PROT_IS_MASK          ((vm_prot_t) 0x40)
142 
143 #endif	/* VM_PROT_H_ */
144