xref: /haiku/headers/private/system/vm_defs.h (revision 4b7e219688450694efc9d1890f83f816758c16d3)
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 #define B_KERNEL_AREA			0x4000
35 	// Usable from userland according to its protection flags, but the area
36 	// itself is not deletable, resizable, etc from userland.
37 
38 #define B_USER_AREA_FLAGS		(B_USER_PROTECTION | B_OVERCOMMITTING_AREA)
39 #define B_KERNEL_AREA_FLAGS \
40 	(B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA | B_SHARED_AREA)
41 
42 // mapping argument for several internal VM functions
43 enum {
44 	REGION_NO_PRIVATE_MAP = 0,
45 	REGION_PRIVATE_MAP
46 };
47 
48 enum {
49 	// TODO: these are here only temporarily - it's a private
50 	// addition to the BeOS create_area() lock flags
51 	B_ALREADY_WIRED	= 7,
52 };
53 
54 #define MEMORY_TYPE_SHIFT		28
55 
56 
57 #endif	/* _SYSTEM_VM_DEFS_H */
58