ReactOS  0.4.15-dev-316-g938df97
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:26;
187  };
188  struct
189  {
190  ULONG LowPart;
191  ULONG HighPart;
192  };
193  };
195 
196 typedef struct _MMPTE_SOFTWARE
197 {
198  ULONGLONG Valid:1;
203  ULONGLONG Unused:20;
206 
207 typedef struct _MMPTE_TRANSITION
208 {
209  ULONGLONG Valid:1;
210  ULONGLONG Write:1;
211  ULONGLONG Owner:1;
218  ULONGLONG Unused:26;
220 
221 typedef struct _MMPTE_PROTOTYPE
222 {
223  ULONGLONG Valid:1;
224  ULONGLONG Unused0:7;
226  ULONGLONG Unused1:1;
229  ULONGLONG Unused:16;
232 
233 typedef struct _MMPTE_SUBSECTION
234 {
235  ULONGLONG Valid:1;
236  ULONGLONG Unused0:4;
239  ULONGLONG Unused1:21;
242 
243 typedef struct _MMPTE_LIST
244 {
245  ULONGLONG Valid:1;
247  ULONGLONG filler0:8;
249  ULONGLONG filler1:21;
250  ULONGLONG NextEntry:32;
251 } MMPTE_LIST;
252 
253 typedef struct _MMPTE_HARDWARE
254 {
255  ULONGLONG Valid:1;
256 #ifndef CONFIG_SMP
257  ULONGLONG Write:1;
258 #else
259  ULONGLONG Writable:1;
260 #endif
261  ULONGLONG Owner:1;
265  ULONGLONG Dirty:1;
267  ULONGLONG Global:1;
270 #ifndef CONFIG_SMP
271  ULONGLONG reserved0:1;
272 #else
273  ULONGLONG Write:1;
274 #endif
276  ULONGLONG reserved1:26;
278 
279 #endif
280 
281 //
282 // Use the right PTE structure
283 //
284 #define HARDWARE_PTE HARDWARE_PTE_X86
285 #define PHARDWARE_PTE PHARDWARE_PTE_X86
286 
287 typedef struct _MMPTE
288 {
289  union
290  {
291 #if !defined(_X86PAE_)
293 #else
294  ULONGLONG Long;
295  struct
296  {
297  ULONG LowPart;
298  ULONG HighPart;
299  } HighLow;
300 #endif
308  } u;
309 } MMPTE, *PMMPTE,
310  MMPDE, *PMMPDE;
311 
312 #if !defined(_X86PAE_)
313 C_ASSERT(sizeof(MMPTE) == sizeof(ULONG));
314 #else
315 C_ASSERT(sizeof(MMPTE) == sizeof(ULONGLONG));
316 #endif
317 
318 #ifdef __cplusplus
319 }; // extern "C"
320 #endif
321 
322 #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:1129
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:292
ULONG64 NextEntry
Definition: mmtypes.h:145
ULONG reserved
Definition: mmtypes.h:83
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 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:66
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
union _MMPTE::@2280 u
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