4ce7c4e9a7470b80a2da2351e6af9fb3782d9b99
[reactos.git] / reactos / include / ndk / i386 / mmtypes.h
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
38 //
39 // Address of the shared user page
40 //
41 #define MM_SHARED_USER_DATA_VA 0x7FFE0000
42
43 //
44 // Sanity checks for Paging Macros
45 //
46 #ifdef C_ASSERT
47 C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT));
48 C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT));
49 C_ASSERT(MM_ALLOCATION_GRANULARITY &&
50 !(MM_ALLOCATION_GRANULARITY & (MM_ALLOCATION_GRANULARITY - 1)));
51 C_ASSERT(MM_ALLOCATION_GRANULARITY >= PAGE_SIZE);
52 #endif
53
54 //
55 // PAE SEG0 Base?
56 //
57 #define KSEG0_BASE_PAE 0xE0000000
58
59 //
60 // Page Table Entry Definitions
61 //
62 typedef struct _HARDWARE_PTE_X86
63 {
64 ULONG Valid:1;
65 ULONG Write:1;
66 ULONG Owner:1;
67 ULONG WriteThrough:1;
68 ULONG CacheDisable:1;
69 ULONG Accessed:1;
70 ULONG Dirty:1;
71 ULONG LargePage:1;
72 ULONG Global:1;
73 ULONG CopyOnWrite:1;
74 ULONG Prototype: 1;
75 ULONG reserved: 1;
76 ULONG PageFrameNumber:20;
77 } HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
78
79 typedef struct _MMPTE_SOFTWARE
80 {
81 ULONG Valid:1;
82 ULONG PageFileLow:4;
83 ULONG Protection:5;
84 ULONG Prototype:1;
85 ULONG Transition:1;
86 ULONG PageFileHigh:20;
87 } MMPTE_SOFTWARE;
88
89 typedef struct _MMPTE_TRANSITION
90 {
91 ULONG Valid:1;
92 ULONG Write:1;
93 ULONG Owner:1;
94 ULONG WriteThrough:1;
95 ULONG CacheDisable:1;
96 ULONG Protection:5;
97 ULONG Prototype:1;
98 ULONG Transition:1;
99 ULONG PageFrameNumber:20;
100 } MMPTE_TRANSITION;
101
102 typedef struct _MMPTE_PROTOTYPE
103 {
104 ULONG Valid:1;
105 ULONG ProtoAddressLow:7;
106 ULONG ReadOnly:1;
107 ULONG WhichPool:1;
108 ULONG Prototype:1;
109 ULONG ProtoAddressHigh:21;
110 } MMPTE_PROTOTYPE;
111
112 typedef struct _MMPTE_SUBSECTION
113 {
114 ULONG Valid:1;
115 ULONG SubsectionAddressLow:4;
116 ULONG Protection:5;
117 ULONG Prototype:1;
118 ULONG SubsectionAddressHigh:20;
119 ULONG WhichPool:1;
120 } MMPTE_SUBSECTION;
121
122 typedef struct _MMPTE_LIST
123 {
124 ULONG Valid:1;
125 ULONG OneEntry:1;
126 ULONG filler0:8;
127 ULONG Prototype:1;
128 ULONG filler1:1;
129 ULONG NextEntry:20;
130 } MMPTE_LIST;
131
132 #ifndef CONFIG_SMP
133
134 typedef struct _MMPTE_HARDWARE
135 {
136 ULONG Valid:1;
137 ULONG Write:1;
138 ULONG Owner:1;
139 ULONG WriteThrough:1;
140 ULONG CacheDisable:1;
141 ULONG Accessed:1;
142 ULONG Dirty:1;
143 ULONG LargePage:1;
144 ULONG Global:1;
145 ULONG CopyOnWrite:1;
146 ULONG Prototype:1;
147 ULONG reserved:1;
148 ULONG PageFrameNumber:20;
149 } MMPTE_HARDWARE, *PMMPTE_HARDWARE;
150
151 #else
152
153 typedef struct _MMPTE_HARDWARE
154 {
155 ULONG Valid:1;
156 ULONG Writable:1;
157 ULONG Owner:1;
158 ULONG WriteThrough:1;
159 ULONG CacheDisable:1;
160 ULONG Accessed:1;
161 ULONG Dirty:1;
162 ULONG LargePage:1;
163 ULONG Global:1;
164 ULONG CopyOnWrite:1;
165 ULONG Prototype:1;
166 ULONG Write:1;
167 ULONG PageFrameNumber:20;
168 } MMPTE_HARDWARE, *PMMPTE_HARDWARE;
169
170 #endif
171
172 //
173 // Use the right PTE structure
174 //
175 #define HARDWARE_PTE HARDWARE_PTE_X86
176 #define PHARDWARE_PTE PHARDWARE_PTE_X86
177
178 #ifdef __cplusplus
179 }; // extern "C"
180 #endif
181
182 #endif