xref: /haiku/headers/private/system/vm_defs.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
6  * Distributed under the terms of the NewOS License.
7  */
8 #ifndef _SYSTEM_VM_DEFS_H
9 #define _SYSTEM_VM_DEFS_H
10 
11 #include <OS.h>
12 
13 
14 // additional protection flags
15 // Note: the VM probably won't support all combinations - it will try
16 // its best, but create_area() will fail if it has to.
17 // Of course, the exact behaviour will be documented somewhere...
18 
19 #define B_KERNEL_EXECUTE_AREA	0x40
20 #define B_KERNEL_STACK_AREA		0x80
21 
22 #define B_USER_PROTECTION \
23 	(B_READ_AREA | B_WRITE_AREA | B_EXECUTE_AREA | B_STACK_AREA)
24 #define B_KERNEL_PROTECTION \
25 	(B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_KERNEL_EXECUTE_AREA \
26 	| B_KERNEL_STACK_AREA)
27 
28 // TODO: These aren't really a protection flags, but since the "protection"
29 //	field is the only flag field, we currently use it for this.
30 //	A cleaner approach would be appreciated - maybe just an official generic
31 //	flags region in the protection field.
32 #define B_OVERCOMMITTING_AREA	0x1000
33 #define B_SHARED_AREA			0x2000
34 /* 0x4000 was B_KERNEL_AREA until hrev52545 */
35 
36 #define B_USER_AREA_FLAGS		(B_USER_PROTECTION | B_OVERCOMMITTING_AREA)
37 #define B_KERNEL_AREA_FLAGS \
38 	(B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA | B_SHARED_AREA)
39 
40 // mapping argument for several internal VM functions
41 enum {
42 	REGION_NO_PRIVATE_MAP = 0,
43 	REGION_PRIVATE_MAP
44 };
45 
46 enum {
47 	// TODO: these are here only temporarily - it's a private
48 	// addition to the BeOS create_area() lock flags
49 	B_ALREADY_WIRED	= 7,
50 };
51 
52 #define MEMORY_TYPE_SHIFT		28
53 
54 
55 #endif	/* _SYSTEM_VM_DEFS_H */
56