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 #define B_EXECUTE_AREA 0x04 19 #define B_STACK_AREA 0x08 20 // "stack" protection is not available on most platforms - it's used 21 // to only commit memory as needed, and have guard pages at the 22 // bottom of the stack. 23 // "execute" protection is currently ignored, but nevertheless, you 24 // should use it if you require to execute code in that area. 25 26 #define B_KERNEL_EXECUTE_AREA 0x40 27 #define B_KERNEL_STACK_AREA 0x80 28 29 #define B_USER_PROTECTION \ 30 (B_READ_AREA | B_WRITE_AREA | B_EXECUTE_AREA | B_STACK_AREA) 31 #define B_KERNEL_PROTECTION \ 32 (B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_KERNEL_EXECUTE_AREA \ 33 | B_KERNEL_STACK_AREA) 34 35 // TODO: These aren't really a protection flags, but since the "protection" 36 // field is the only flag field, we currently use it for this. 37 // A cleaner approach would be appreciated - maybe just an official generic 38 // flags region in the protection field. 39 #define B_OVERCOMMITTING_AREA 0x1000 40 #define B_SHARED_AREA 0x2000 41 #define B_KERNEL_AREA 0x4000 42 // Usable from userland according to its protection flags, but the area 43 // itself is not deletable, resizable, etc from userland. 44 45 #define B_USER_AREA_FLAGS (B_USER_PROTECTION) 46 #define B_KERNEL_AREA_FLAGS \ 47 (B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA | B_OVERCOMMITTING_AREA \ 48 | B_SHARED_AREA) 49 50 // mapping argument for several internal VM functions 51 enum { 52 REGION_NO_PRIVATE_MAP = 0, 53 REGION_PRIVATE_MAP 54 }; 55 56 enum { 57 // ToDo: these are here only temporarily - it's a private 58 // addition to the BeOS create_area() lock flags 59 B_ALREADY_WIRED = 6, 60 }; 61 62 #define MEMORY_TYPE_SHIFT 28 63 64 65 #endif /* _SYSTEM_VM_DEFS_H */ 66