ReactOS  0.4.15-dev-2534-geba00d1
mmtypes.h
Go to the documentation of this file.
1 /*++ NDK Version: 0095
2 
3 Copyright (c) Alex Ionescu. All rights reserved.
4 
5 Header Name:
6 
7  mmtypes.h (X86)
8 
9 Abstract:
10 
11  i386 Type definitions for the Memory Manager
12 
13 Author:
14 
15  Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
16 
17 --*/
18 
19 #ifndef _I386_MMTYPES_H
20 #define _I386_MMTYPES_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 //
27 // Dependencies
28 //
29 
30 //
31 // Page-related Macros
32 //
33 #define PAGE_SIZE 0x1000
34 #define PAGE_SHIFT 12L
35 #define MM_ALLOCATION_GRANULARITY 0x10000
36 #define MM_ALLOCATION_GRANULARITY_SHIFT 16L
37 #define MM_PAGE_FRAME_NUMBER_SIZE 20
38 
39 //
40 // User space range limit
41 //
42 #define MI_HIGHEST_USER_ADDRESS (PVOID)0x7FFEFFFF
43 
44 //
45 // Address of the shared user page
46 //
47 #define MM_SHARED_USER_DATA_VA 0x7FFE0000
48 
49 //
50 // Sanity checks for Paging Macros
51 //
52 #ifdef C_ASSERT
53 C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT));
58 #endif
59 
60 //
61 // PAE SEG0 Base?
62 //
63 #define KSEG0_BASE_PAE 0xE0000000
64 
65 //
66 // Page Table Entry Definitions
67 //
68 #if !defined(_X86PAE_)
69 
70 typedef struct _HARDWARE_PTE_X86
71 {
86 
87 typedef struct _MMPTE_SOFTWARE
88 {
89  ULONG Valid:1;
91  ULONG Protection:5;
92  ULONG Prototype:1;
93  ULONG Transition:1;
96 
97 typedef struct _MMPTE_TRANSITION
98 {
99  ULONG Valid:1;
101  ULONG Owner:1;
104  ULONG Protection:5;
105  ULONG Prototype:1;
106  ULONG Transition:1;
109 
110 typedef struct _MMPTE_PROTOTYPE
111 {
112  ULONG Valid:1;
114  ULONG ReadOnly:1;
116  ULONG Prototype:1;
119 
120 typedef struct _MMPTE_SUBSECTION
121 {
122  ULONG Valid:1;
124  ULONG Protection:5;
125  ULONG Prototype:1;
127  ULONG WhichPool:1;
129 
130 typedef struct _MMPTE_LIST
131 {
132  ULONG Valid:1;
133  ULONG OneEntry:1;
134  ULONG filler0:8;
135  ULONG Prototype:1;
137  ULONG NextEntry:20;
138 } MMPTE_LIST;
139 
140 typedef struct _MMPTE_HARDWARE
141 {
142  ULONG Valid:1;
143 #ifndef CONFIG_SMP
145 #else
146  ULONG Writable:1;
147 #endif
148  ULONG Owner:1;
156  ULONG Prototype:1;
157 #ifndef CONFIG_SMP
159 #else
160  ULONG Write:1;
161 #endif
164 
165 #else
166 
167 typedef struct _HARDWARE_PTE_X86
168 {
169  union
170  {
171  struct
172  {
173  ULONGLONG Valid:1;
174  ULONGLONG Write:1;
175  ULONGLONG Owner:1;
179  ULONGLONG Dirty:1;
181  ULONGLONG Global:1;
184  ULONGLONG reserved0:1;
186  ULONGLONG reserved1:25;
187  ULONGLONG NoExecute:1;
188  };
189  struct
190  {
191  ULONG LowPart;
192  ULONG HighPart;
193  };
194  };
196 
197 typedef struct _MMPTE_SOFTWARE
198 {
199  ULONGLONG Valid:1;
204  ULONGLONG Unused:20;
207 
208 typedef struct _MMPTE_TRANSITION
209 {
210  ULONGLONG Valid:1;
211  ULONGLONG Write:1;
212  ULONGLONG Owner:1;
219  ULONGLONG Unused:26;
221 
222 typedef struct _MMPTE_PROTOTYPE
223 {
224  ULONGLONG Valid:1;
225  ULONGLONG Unused0:7;
227  ULONGLONG Unused1:1;
230  ULONGLONG Unused:16;
233 
234 typedef struct _MMPTE_SUBSECTION
235 {
236  ULONGLONG Valid:1;
237  ULONGLONG Unused0:4;
240  ULONGLONG Unused1:21;
243 
244 typedef struct _MMPTE_LIST
245 {
246  ULONGLONG Valid:1;
248  ULONGLONG filler0:8;
250  ULONGLONG filler1:21;
251  ULONGLONG NextEntry:32;
252 } MMPTE_LIST;
253 
254 typedef struct _MMPTE_HARDWARE
255 {
256  ULONGLONG Valid:1;
257 #ifndef CONFIG_SMP
258  ULONGLONG Write:1;
259 #else
261 #endif
262  ULONGLONG Owner:1;
266  ULONGLONG Dirty:1;
268  ULONGLONG Global:1;
271 #ifndef CONFIG_SMP
272  ULONGLONG reserved0:1;
273 #else
274  ULONGLONG Write:1;
275 #endif
277  ULONGLONG reserved1:26;
279 
280 #endif
281 
282 //
283 // Use the right PTE structure
284 //
285 #define HARDWARE_PTE HARDWARE_PTE_X86
286 #define PHARDWARE_PTE PHARDWARE_PTE_X86
287 
288 typedef struct _MMPTE
289 {
290  union
291  {
292 #if !defined(_X86PAE_)
294 #else
295  ULONGLONG Long;
296  struct
297  {
298  ULONG LowPart;
299  ULONG HighPart;
300  } HighLow;
301 #endif
309  } u;
310 } MMPTE, *PMMPTE,
311  MMPDE, *PMMPDE;
312 
313 #if !defined(_X86PAE_)
314 C_ASSERT(sizeof(MMPTE) == sizeof(ULONG));
315 #else
316 C_ASSERT(sizeof(MMPTE) == sizeof(ULONGLONG));
317 #endif
318 
319 #ifdef __cplusplus
320 }; // extern "C"
321 #endif
322 
323 #endif
#define PAGE_SHIFT
Definition: mmtypes.h:34
ULONG64 Unused0
Definition: mmtypes.h:129
ULONG64 Write
Definition: mmtypes.h:170
#define PAGE_SIZE
Definition: mmtypes.h:33
_Must_inspect_result_ typedef _In_ PVOID Unused
Definition: iotypes.h:1166
ULONG64 Unused0
Definition: mmtypes.h:118
ULONG64 Valid
Definition: mmtypes.h:117
ULONG64 CacheDisable
Definition: mmtypes.h:102
#define MM_ALLOCATION_GRANULARITY_SHIFT
Definition: mmtypes.h:36
ULONG Long
Definition: mmtypes.h:293
ULONG64 NextEntry
Definition: mmtypes.h:145
ULONG reserved
Definition: mmtypes.h:83
union _MMPTE::@2304 u
ULONG PageFrameNumber
Definition: mmtypes.h:84
ULONG filler1
Definition: mmtypes.h:136
ULONG ProtoAddressHigh
Definition: mmtypes.h:145
struct _MMPTE_TRANSITION MMPTE_TRANSITION
ULONG64 OneEntry
Definition: mmtypes.h:139
struct _HARDWARE_PTE_X86 HARDWARE_PTE_X86
ULONG WriteThrough
Definition: mmtypes.h:149
struct _MMPTE_HARDWARE * PMMPTE_HARDWARE
ULONG64 Protection
Definition: mmtypes.h:130
ULONG64 PageFrameNumber
Definition: mmtypes.h:107
HARDWARE_PTE Flush
Definition: mmtypes.h:216
ULONG64 Transition
Definition: mmtypes.h:105
ULONG64 Protection
Definition: mmtypes.h:122
ULONG Global
Definition: mmtypes.h:154
ULONG64 Valid
Definition: mmtypes.h:128
ULONG64 Global
Definition: mmtypes.h:166
ULONG LargePage
Definition: mmtypes.h:153
ULONG64 Dirty
Definition: mmtypes.h:164
struct _MMPTE_SUBSECTION MMPTE_SUBSECTION
#define MM_ALLOCATION_GRANULARITY
Definition: mmtypes.h:35
ULONG64 Owner
Definition: mmtypes.h:160
ULONG64 Valid
Definition: mmtypes.h:138
ULONG64 WriteThrough
Definition: mmtypes.h:161
ULONG64 filler0
Definition: mmtypes.h:140
struct _MMPTE * PMMPDE
struct _MMPTE MMPDE
ULONG64 Protection
Definition: mmtypes.h:88
ULONG64 Write
Definition: mmtypes.h:99
ULONG CacheDisable
Definition: mmtypes.h:103
ULONG64 filler1
Definition: mmtypes.h:144
ULONG CopyOnWrite
Definition: mmtypes.h:81
ULONG const BOOLEAN const _Out_ PBOOLEAN Writable
Definition: mmc.h:75
ULONG WriteThrough
Definition: mmtypes.h:75
MMPTE_TRANSITION Trans
Definition: mmtypes.h:220
MMPTE_LIST List
Definition: mmtypes.h:222
uint64_t ULONGLONG
Definition: typedefs.h:67
ULONG64 Prototype
Definition: mmtypes.h:131
ULONG64 Valid
Definition: mmtypes.h:150
ULONG CacheDisable
Definition: mmtypes.h:150
struct _MMPTE * PMMPTE
ULONG64 PageFileLow
Definition: mmtypes.h:87
ULONG64 CopyOnWrite
Definition: mmtypes.h:167
ULONG64 Prototype
Definition: mmtypes.h:104
ULONG64 CacheDisable
Definition: mmtypes.h:162
struct _MMPTE_SOFTWARE MMPTE_SOFTWARE
ULONG64 PageFileHigh
Definition: mmtypes.h:93
ULONG64 Prototype
Definition: mmtypes.h:89
ULONG64 Valid
Definition: mmtypes.h:86
ULONG LargePage
Definition: mmtypes.h:79
struct _MMPTE_LIST MMPTE_LIST
ULONG CopyOnWrite
Definition: mmtypes.h:155
ULONG_PTR Long
Definition: mmtypes.h:215
MMPTE_HARDWARE Hard
Definition: mmtypes.h:217
ULONG SubsectionAddressLow
Definition: mmtypes.h:151
ULONG64 Valid
Definition: mmtypes.h:98
ULONG Accessed
Definition: mmtypes.h:77
ULONG64 reserved1
Definition: mmtypes.h:172
ULONG64 WriteThrough
Definition: mmtypes.h:101
struct _MMPTE_PROTOTYPE MMPTE_PROTOTYPE
ULONG64 Transition
Definition: mmtypes.h:90
ULONG CacheDisable
Definition: mmtypes.h:76
ULONG SubsectionAddressHigh
Definition: mmtypes.h:154
C_ASSERT(sizeof(HARDWARE_PDE_ARMV6)==sizeof(ULONG))
MMPTE_SOFTWARE Soft
Definition: mmtypes.h:219
struct _MMPTE MMPTE
ULONG64 Unused1
Definition: mmtypes.h:120
ULONG WhichPool
Definition: mmtypes.h:115
ULONG64 Prototype
Definition: mmtypes.h:121
LONG64 ProtoAddress
Definition: mmtypes.h:123
ULONG64 ReadOnly
Definition: mmtypes.h:119
ULONG reserved
Definition: mmtypes.h:158
ULONG Prototype
Definition: mmtypes.h:82
unsigned int ULONG
Definition: retypes.h:1
ULONG ProtoAddressLow
Definition: mmtypes.h:142
ULONG64 LargePage
Definition: mmtypes.h:165
ULONG64 Unused1
Definition: mmtypes.h:132
ULONG64 PageFrameNumber
Definition: mmtypes.h:171
ULONG64 Unused
Definition: mmtypes.h:108
struct _MMPTE_HARDWARE MMPTE_HARDWARE
MMPTE_SUBSECTION Subsect
Definition: mmtypes.h:221
struct _HARDWARE_PTE_X86 * PHARDWARE_PTE_X86
ULONG64 Owner
Definition: mmtypes.h:100
ULONG64 Prototype
Definition: mmtypes.h:142
ULONG WriteThrough
Definition: mmtypes.h:102
ULONG64 Protection
Definition: mmtypes.h:103
MMPTE_PROTOTYPE Proto
Definition: mmtypes.h:218
ULONG64 Accessed
Definition: mmtypes.h:163
ULONG Accessed
Definition: mmtypes.h:151
LONG64 SubsectionAddress
Definition: mmtypes.h:133
ULONG64 Prototype
Definition: mmtypes.h:168