[CMAKE]: Ignore "build" directory.
[reactos.git] / include / xdk / mmtypes.h
1 /******************************************************************************
2 * Memory manager Types *
3 ******************************************************************************/
4 $if (_WDMDDK_)
5
6 #if (NTDDI_VERSION >= NTDDI_WIN2K)
7 typedef ULONG NODE_REQUIREMENT;
8 #define MM_ANY_NODE_OK 0x80000000
9 #endif
10
11 #define MM_DONT_ZERO_ALLOCATION 0x00000001
12 #define MM_ALLOCATE_FROM_LOCAL_NODE_ONLY 0x00000002
13 #define MM_ALLOCATE_FULLY_REQUIRED 0x00000004
14 #define MM_ALLOCATE_NO_WAIT 0x00000008
15 #define MM_ALLOCATE_PREFER_CONTIGUOUS 0x00000010
16 #define MM_ALLOCATE_REQUIRE_CONTIGUOUS_CHUNKS 0x00000020
17
18 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
19 #define MDL_PAGES_LOCKED 0x0002
20 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
21 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
22 #define MDL_PARTIAL 0x0010
23 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
24 #define MDL_IO_PAGE_READ 0x0040
25 #define MDL_WRITE_OPERATION 0x0080
26 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
27 #define MDL_FREE_EXTRA_PTES 0x0200
28 #define MDL_DESCRIBES_AWE 0x0400
29 #define MDL_IO_SPACE 0x0800
30 #define MDL_NETWORK_HEADER 0x1000
31 #define MDL_MAPPING_CAN_FAIL 0x2000
32 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
33 #define MDL_INTERNAL 0x8000
34
35 #define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
36 MDL_PAGES_LOCKED | \
37 MDL_SOURCE_IS_NONPAGED_POOL | \
38 MDL_PARTIAL_HAS_BEEN_MAPPED | \
39 MDL_PARENT_MAPPED_SYSTEM_VA | \
40 MDL_SYSTEM_VA | \
41 MDL_IO_SPACE)
42
43 #define FLUSH_MULTIPLE_MAXIMUM 32
44
45 /* Section access rights */
46 #define SECTION_QUERY 0x0001
47 #define SECTION_MAP_WRITE 0x0002
48 #define SECTION_MAP_READ 0x0004
49 #define SECTION_MAP_EXECUTE 0x0008
50 #define SECTION_EXTEND_SIZE 0x0010
51 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
52
53 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY| \
54 SECTION_MAP_WRITE | \
55 SECTION_MAP_READ | \
56 SECTION_MAP_EXECUTE | \
57 SECTION_EXTEND_SIZE)
58
59 #define SESSION_QUERY_ACCESS 0x0001
60 #define SESSION_MODIFY_ACCESS 0x0002
61
62 #define SESSION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
63 SESSION_QUERY_ACCESS | \
64 SESSION_MODIFY_ACCESS)
65
66 #define SEGMENT_ALL_ACCESS SECTION_ALL_ACCESS
67
68 #define PAGE_NOACCESS 0x01
69 #define PAGE_READONLY 0x02
70 #define PAGE_READWRITE 0x04
71 #define PAGE_WRITECOPY 0x08
72 #define PAGE_EXECUTE 0x10
73 #define PAGE_EXECUTE_READ 0x20
74 #define PAGE_EXECUTE_READWRITE 0x40
75 #define PAGE_EXECUTE_WRITECOPY 0x80
76 #define PAGE_GUARD 0x100
77 #define PAGE_NOCACHE 0x200
78 #define PAGE_WRITECOMBINE 0x400
79
80 #define MEM_COMMIT 0x1000
81 #define MEM_RESERVE 0x2000
82 #define MEM_DECOMMIT 0x4000
83 #define MEM_RELEASE 0x8000
84 #define MEM_FREE 0x10000
85 #define MEM_PRIVATE 0x20000
86 #define MEM_MAPPED 0x40000
87 #define MEM_RESET 0x80000
88 #define MEM_TOP_DOWN 0x100000
89 #define MEM_LARGE_PAGES 0x20000000
90 #define MEM_4MB_PAGES 0x80000000
91
92 #define SEC_RESERVE 0x4000000
93 #define SEC_COMMIT 0x8000000
94 #define SEC_LARGE_PAGES 0x80000000
95
96 /* Section map options */
97 typedef enum _SECTION_INHERIT {
98 ViewShare = 1,
99 ViewUnmap = 2
100 } SECTION_INHERIT;
101
102 typedef ULONG PFN_COUNT;
103 typedef LONG_PTR SPFN_NUMBER, *PSPFN_NUMBER;
104 typedef ULONG_PTR PFN_NUMBER, *PPFN_NUMBER;
105
106 typedef struct _MDL {
107 struct _MDL *Next;
108 CSHORT Size;
109 CSHORT MdlFlags;
110 struct _EPROCESS *Process;
111 PVOID MappedSystemVa;
112 PVOID StartVa;
113 ULONG ByteCount;
114 ULONG ByteOffset;
115 } MDL, *PMDL;
116 typedef MDL *PMDLX;
117
118 typedef enum _MEMORY_CACHING_TYPE_ORIG {
119 MmFrameBufferCached = 2
120 } MEMORY_CACHING_TYPE_ORIG;
121
122 typedef enum _MEMORY_CACHING_TYPE {
123 MmNonCached = FALSE,
124 MmCached = TRUE,
125 MmWriteCombined = MmFrameBufferCached,
126 MmHardwareCoherentCached,
127 MmNonCachedUnordered,
128 MmUSWCCached,
129 MmMaximumCacheType
130 } MEMORY_CACHING_TYPE;
131
132 typedef enum _MM_PAGE_PRIORITY {
133 LowPagePriority,
134 NormalPagePriority = 16,
135 HighPagePriority = 32
136 } MM_PAGE_PRIORITY;
137
138 typedef enum _MM_SYSTEM_SIZE {
139 MmSmallSystem,
140 MmMediumSystem,
141 MmLargeSystem
142 } MM_SYSTEMSIZE;
143
144 extern NTKERNELAPI BOOLEAN Mm64BitPhysicalAddress;
145 extern PVOID MmBadPointer;
146
147 $endif (_WDMDDK_)
148 $if (_NTDDK_)
149
150 typedef struct _PHYSICAL_MEMORY_RANGE {
151 PHYSICAL_ADDRESS BaseAddress;
152 LARGE_INTEGER NumberOfBytes;
153 } PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
154
155 typedef NTSTATUS
156 (NTAPI *PMM_ROTATE_COPY_CALLBACK_FUNCTION)(
157 IN PMDL DestinationMdl,
158 IN PMDL SourceMdl,
159 IN PVOID Context);
160
161 typedef enum _MM_ROTATE_DIRECTION {
162 MmToFrameBuffer,
163 MmToFrameBufferNoCopy,
164 MmToRegularMemory,
165 MmToRegularMemoryNoCopy,
166 MmMaximumRotateDirection
167 } MM_ROTATE_DIRECTION, *PMM_ROTATE_DIRECTION;
168
169 $endif (_NTDDK_)
170 $if (_NTIFS_)
171 typedef enum _MMFLUSH_TYPE {
172 MmFlushForDelete,
173 MmFlushForWrite
174 } MMFLUSH_TYPE;
175
176 typedef struct _READ_LIST {
177 PFILE_OBJECT FileObject;
178 ULONG NumberOfEntries;
179 LOGICAL IsImage;
180 FILE_SEGMENT_ELEMENT List[ANYSIZE_ARRAY];
181 } READ_LIST, *PREAD_LIST;
182
183 #if (NTDDI_VERSION >= NTDDI_WINXP)
184
185 typedef union _MM_PREFETCH_FLAGS {
186 struct {
187 ULONG Priority : SYSTEM_PAGE_PRIORITY_BITS;
188 ULONG RepurposePriority : SYSTEM_PAGE_PRIORITY_BITS;
189 } Flags;
190 ULONG AllFlags;
191 } MM_PREFETCH_FLAGS, *PMM_PREFETCH_FLAGS;
192
193 #define MM_PREFETCH_FLAGS_MASK ((1 << (2*SYSTEM_PAGE_PRIORITY_BITS)) - 1)
194
195 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
196
197 #define HEAP_NO_SERIALIZE 0x00000001
198 #define HEAP_GROWABLE 0x00000002
199 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
200 #define HEAP_ZERO_MEMORY 0x00000008
201 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
202 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
203 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
204 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
205
206 #define HEAP_CREATE_ALIGN_16 0x00010000
207 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
208 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
209
210 #define HEAP_SETTABLE_USER_VALUE 0x00000100
211 #define HEAP_SETTABLE_USER_FLAG1 0x00000200
212 #define HEAP_SETTABLE_USER_FLAG2 0x00000400
213 #define HEAP_SETTABLE_USER_FLAG3 0x00000800
214 #define HEAP_SETTABLE_USER_FLAGS 0x00000E00
215
216 #define HEAP_CLASS_0 0x00000000
217 #define HEAP_CLASS_1 0x00001000
218 #define HEAP_CLASS_2 0x00002000
219 #define HEAP_CLASS_3 0x00003000
220 #define HEAP_CLASS_4 0x00004000
221 #define HEAP_CLASS_5 0x00005000
222 #define HEAP_CLASS_6 0x00006000
223 #define HEAP_CLASS_7 0x00007000
224 #define HEAP_CLASS_8 0x00008000
225 #define HEAP_CLASS_MASK 0x0000F000
226
227 #define HEAP_MAXIMUM_TAG 0x0FFF
228 #define HEAP_GLOBAL_TAG 0x0800
229 #define HEAP_PSEUDO_TAG_FLAG 0x8000
230 #define HEAP_TAG_SHIFT 18
231 #define HEAP_TAG_MASK (HEAP_MAXIMUM_TAG << HEAP_TAG_SHIFT)
232
233 #define HEAP_CREATE_VALID_MASK (HEAP_NO_SERIALIZE | \
234 HEAP_GROWABLE | \
235 HEAP_GENERATE_EXCEPTIONS | \
236 HEAP_ZERO_MEMORY | \
237 HEAP_REALLOC_IN_PLACE_ONLY | \
238 HEAP_TAIL_CHECKING_ENABLED | \
239 HEAP_FREE_CHECKING_ENABLED | \
240 HEAP_DISABLE_COALESCE_ON_FREE | \
241 HEAP_CLASS_MASK | \
242 HEAP_CREATE_ALIGN_16 | \
243 HEAP_CREATE_ENABLE_TRACING | \
244 HEAP_CREATE_ENABLE_EXECUTE)
245 $endif (_NTIFS_)
246