My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mman-common.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 #ifndef __ASM_GENERIC_MMAN_COMMON_H
24 #define __ASM_GENERIC_MMAN_COMMON_H
25 
26 /*
27  Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
28  Based on: asm-xxx/mman.h
29 */
30 
31 #define PROT_READ 0x1 /* page can be read */
32 #define PROT_WRITE 0x2 /* page can be written */
33 #define PROT_EXEC 0x4 /* page can be executed */
34 #define PROT_SEM 0x8 /* page may be used for atomic ops */
35 #define PROT_NONE 0x0 /* page can not be accessed */
36 #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
37 #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
38 
39 #define MAP_SHARED 0x01 /* Share changes */
40 #define MAP_PRIVATE 0x02 /* Changes are private */
41 #define MAP_TYPE 0x0f /* Mask for type of mapping */
42 #define MAP_FIXED 0x10 /* Interpret addr exactly */
43 #define MAP_ANONYMOUS 0x20 /* don't use a file */
44 #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
45 # define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */
46 #else
47 # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
48 #endif
49 
50 #define MS_ASYNC 1 /* sync memory asynchronously */
51 #define MS_INVALIDATE 2 /* invalidate the caches */
52 #define MS_SYNC 4 /* synchronous memory sync */
53 
54 #define MADV_NORMAL 0 /* no further special treatment */
55 #define MADV_RANDOM 1 /* expect random page references */
56 #define MADV_SEQUENTIAL 2 /* expect sequential page references */
57 #define MADV_WILLNEED 3 /* will need these pages */
58 #define MADV_DONTNEED 4 /* don't need these pages */
59 
60 /* common parameters: try to keep these consistent across architectures */
61 #define MADV_REMOVE 9 /* remove these pages & resources */
62 #define MADV_DONTFORK 10 /* don't inherit across fork */
63 #define MADV_DOFORK 11 /* do inherit across fork */
64 #define MADV_HWPOISON 100 /* poison a page for testing */
65 #define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */
66 
67 #define MADV_MERGEABLE 12 /* KSM may merge identical pages */
68 #define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
69 
70 #define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
71 #define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
72 
73 #define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
74  overrides the coredump filter bits */
75 #define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */
76 
77 /* compatibility flags */
78 #define MAP_FILE 0
79 
80 /*
81  * When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.
82  * This gives us 6 bits, which is enough until someone invents 128 bit address
83  * spaces.
84  *
85  * Assume these are all power of twos.
86  * When 0 use the default page size.
87  */
88 #define MAP_HUGE_SHIFT 26
89 #define MAP_HUGE_MASK 0x3f
90 
91 #endif /* __ASM_GENERIC_MMAN_COMMON_H */