[THEMES]
[reactos.git] / reactos / include / ndk / amd64 / mmtypes.h
1 /*++ NDK Version: 0095
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 mmtypes.h (AMD64)
8
9 Abstract:
10
11 AMD64 Type definitions for the Memory Manager
12
13 Author:
14
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
16 Timo Kreuzer (timo.kreuzer@reactos.com) 15-Aug-2008
17
18 --*/
19
20 #ifndef _AMD64_MMTYPES_H
21 #define _AMD64_MMTYPES_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 //
28 // Dependencies
29 //
30
31 //
32 // Page-related Macros
33 //
34 #define PAGE_SIZE 0x1000
35 #define PAGE_SHIFT 12L
36 #define MM_ALLOCATION_GRANULARITY 0x10000
37 #define MM_ALLOCATION_GRANULARITY_SHIFT 16L
38
39 //
40 // Address of the shared user page
41 //
42 #define MM_SHARED_USER_DATA_VA 0x7FFE0000ULL
43
44 //
45 // Sanity checks for Paging Macros
46 //
47 #ifdef C_ASSERT
48 C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT));
49 C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT));
50 C_ASSERT(MM_ALLOCATION_GRANULARITY &&
51 !(MM_ALLOCATION_GRANULARITY & (MM_ALLOCATION_GRANULARITY - 1)));
52 C_ASSERT(MM_ALLOCATION_GRANULARITY >= PAGE_SIZE);
53 #endif
54
55 //
56 // Page Table Entry Definitions
57 //
58 typedef struct _HARDWARE_PTE
59 {
60 ULONG64 Valid:1;
61 ULONG64 Write:1;
62 ULONG64 Owner:1;
63 ULONG64 WriteThrough:1;
64 ULONG64 CacheDisable:1;
65 ULONG64 Accessed:1;
66 ULONG64 Dirty:1;
67 ULONG64 LargePage:1;
68 ULONG64 Global:1;
69 ULONG64 CopyOnWrite:1;
70 ULONG64 Prototype:1;
71 ULONG64 reserved0:1;
72 ULONG64 PageFrameNumber:28;
73 ULONG64 reserved1:12;
74 ULONG64 SoftwareWsIndex:11;
75 ULONG64 NoExecute:1;
76 } HARDWARE_PTE, *PHARDWARE_PTE;
77
78 typedef struct _MMPTE_SOFTWARE
79 {
80 ULONG64 Valid:1;
81 ULONG64 PageFileLow:4;
82 ULONG64 Protection:5;
83 ULONG64 Prototype:1;
84 ULONG64 Transition:1;
85 ULONG64 UsedPageTableEntries:10;
86 ULONG64 Reserved:10;
87 ULONG64 PageFileHigh:32;
88 } MMPTE_SOFTWARE, *PMMPTE_SOFTWARE;
89
90 typedef struct _MMPTE_TRANSITION
91 {
92 ULONG64 Valid:1;
93 ULONG64 Write:1;
94 ULONG64 Owner:1;
95 ULONG64 WriteThrough:1;
96 ULONG64 CacheDisable:1;
97 ULONG64 Protection:5;
98 ULONG64 Prototype:1;
99 ULONG64 Transition:1;
100 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
101 ULONG64 PageFrameNumber:36;
102 ULONG64 Unused:16;
103 #else
104 ULONG64 PageFrameNumber:28;
105 ULONG64 Unused:24;
106 #endif
107 } MMPTE_TRANSITION;
108
109 typedef struct _MMPTE_PROTOTYPE
110 {
111 ULONG64 Valid:1;
112 ULONG64 Unused0:7;
113 ULONG64 ReadOnly:1;
114 ULONG64 Unused1:1;
115 ULONG64 Prototype:1;
116 ULONG64 Protection:5;
117 LONG64 ProtoAddress:48;
118 } MMPTE_PROTOTYPE;
119
120 typedef struct _MMPTE_SUBSECTION
121 {
122 ULONG64 Valid:1;
123 ULONG64 Unused0:4;
124 ULONG64 Protection:5;
125 ULONG64 Prototype:1;
126 ULONG64 Unused1:5;
127 LONG64 SubsectionAddress:48;
128 } MMPTE_SUBSECTION;
129
130 typedef struct _MMPTE_LIST
131 {
132 ULONG64 Valid:1;
133 ULONG64 OneEntry:1;
134 ULONG64 filler0:3;
135 ULONG64 Protection:5;
136 ULONG64 Prototype:1;
137 ULONG64 Transition:1;
138 ULONG64 filler1:20;
139 ULONG64 NextEntry:32;
140 } MMPTE_LIST;
141
142 typedef struct _MMPTE_HARDWARE
143 {
144 ULONG64 Valid:1;
145 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
146 ULONG64 Dirty1:1;
147 #else
148 #ifdef CONFIG_SMP
149 ULONG64 Writable:1;
150 #else
151 ULONG64 Write:1;
152 #endif
153 #endif
154 ULONG64 Owner:1;
155 ULONG64 WriteThrough:1;
156 ULONG64 CacheDisable:1;
157 ULONG64 Accessed:1;
158 ULONG64 Dirty:1;
159 ULONG64 LargePage:1;
160 ULONG64 Global:1;
161 ULONG64 CopyOnWrite:1;
162 ULONG64 Prototype:1;
163 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
164 ULONG64 Write:1;
165 ULONG64 PageFrameNumber:36;
166 ULONG64 reserved1:4;
167 #else
168 #ifdef CONFIG_SMP
169 ULONG64 Write:1;
170 #else
171 ULONG64 reserved0:1;
172 #endif
173 ULONG64 PageFrameNumber:28;
174 ULONG64 reserved1:12;
175 #endif
176 ULONG64 SoftwareWsIndex:11;
177 ULONG64 NoExecute:1;
178 } MMPTE_HARDWARE, *PMMPTE_HARDWARE;
179
180 typedef struct _MMPTE_HARDWARE_LARGEPAGE
181 {
182 ULONG64 Valid:1;
183 ULONG64 Write:1;
184 ULONG64 Owner:1;
185 ULONG64 WriteThrough:1;
186 ULONG64 CacheDisable:1;
187 ULONG64 Accessed:1;
188 ULONG64 Dirty:1;
189 ULONG64 LargePage:1;
190 ULONG64 Global:1;
191 ULONG64 CopyOnWrite:1;
192 ULONG64 Prototype:1;
193 ULONG64 reserved0:1;
194 ULONG64 PAT:1;
195 ULONG64 reserved1:8;
196 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
197 ULONG64 PageFrameNumber:27;
198 ULONG64 reserved2:16;
199 #else
200 ULONG64 PageFrameNumber:19;
201 ULONG64 reserved2:24;
202 #endif
203 } MMPTE_HARDWARE_LARGEPAGE, *PMMPTE_HARDWARE_LARGEPAGE;
204
205 #ifdef __cplusplus
206 }; // extern "C"
207 #endif
208
209 #endif // !AMD64_MMTYPES_H