Sync with trunk (r47116), hopefully without breaking anything.
[reactos.git] / ntoskrnl / mm / arm / page.c
1 /*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: ntoskrnl/mm/arm/page.c
5 * PURPOSE: Old-school Page Management
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14
15 /* GLOBALS ********************************************************************/
16
17 ULONG MmGlobalKernelPageDirectory[4096];
18 MMPDE HyperTemplatePde;
19
20 /* PRIVATE FUNCTIONS **********************************************************/
21
22 VOID
23 NTAPI
24 MiFlushTlb(IN PMMPTE PointerPte,
25 IN PVOID Address)
26 {
27 UNIMPLEMENTED;
28 while (TRUE);
29 }
30
31 BOOLEAN
32 NTAPI
33 MmCreateProcessAddressSpace(IN ULONG MinWs,
34 IN PEPROCESS Process,
35 IN PULONG DirectoryTableBase)
36 {
37 UNIMPLEMENTED;
38 while (TRUE);
39 return FALSE;
40 }
41
42 VOID
43 NTAPI
44 MmUpdatePageDir(IN PEPROCESS Process,
45 IN PVOID Address,
46 IN ULONG Size)
47 {
48 /* Nothing to do */
49 return;
50 }
51
52 NTSTATUS
53 NTAPI
54 Mmi386ReleaseMmInfo(IN PEPROCESS Process)
55 {
56 UNIMPLEMENTED;
57 while (TRUE);
58 return 0;
59 }
60
61 NTSTATUS
62 NTAPI
63 MmInitializeHandBuiltProcess(IN PEPROCESS Process,
64 IN PULONG DirectoryTableBase)
65 {
66 UNIMPLEMENTED;
67 while (TRUE);
68 return STATUS_SUCCESS;
69 }
70
71 PULONG
72 NTAPI
73 MmGetPageDirectory(VOID)
74 {
75 /* Return the TTB */
76 return (PULONG)KeArmTranslationTableRegisterGet().AsUlong;
77 }
78
79 VOID
80 NTAPI
81 MmDisableVirtualMapping(IN PEPROCESS Process,
82 IN PVOID Address,
83 OUT PBOOLEAN WasDirty,
84 OUT PPFN_TYPE Page)
85 {
86 UNIMPLEMENTED;
87 while (TRUE);
88 }
89
90 VOID
91 NTAPI
92 MmEnableVirtualMapping(IN PEPROCESS Process,
93 IN PVOID Address)
94 {
95 UNIMPLEMENTED;
96 while (TRUE);
97 }
98
99 NTSTATUS
100 NTAPI
101 MmCreateVirtualMappingUnsafe(IN PEPROCESS Process,
102 IN PVOID Address,
103 IN ULONG Protection,
104 IN PPFN_TYPE Pages,
105 IN ULONG PageCount)
106 {
107 UNIMPLEMENTED;
108 while (TRUE);
109 return STATUS_SUCCESS;
110 }
111
112 NTSTATUS
113 NTAPI
114 MmCreateVirtualMapping(IN PEPROCESS Process,
115 IN PVOID Address,
116 IN ULONG Protection,
117 IN PPFN_TYPE Pages,
118 IN ULONG PageCount)
119 {
120 UNIMPLEMENTED;
121 while (TRUE);
122 return STATUS_SUCCESS;
123 }
124
125 VOID
126 NTAPI
127 MmRawDeleteVirtualMapping(IN PVOID Address)
128 {
129 UNIMPLEMENTED;
130 while (TRUE);
131 }
132
133 VOID
134 NTAPI
135 MmDeleteVirtualMapping(IN PEPROCESS Process,
136 IN PVOID Address,
137 IN BOOLEAN FreePage,
138 OUT PBOOLEAN WasDirty,
139 OUT PPFN_TYPE Page)
140 {
141 UNIMPLEMENTED;
142 while (TRUE);
143 }
144
145 VOID
146 NTAPI
147 MmDeletePageFileMapping(IN PEPROCESS Process,
148 IN PVOID Address,
149 IN SWAPENTRY *SwapEntry)
150 {
151 UNIMPLEMENTED;
152 while (TRUE);
153 }
154
155 NTSTATUS
156 NTAPI
157 MmCreatePageFileMapping(IN PEPROCESS Process,
158 IN PVOID Address,
159 IN SWAPENTRY SwapEntry)
160 {
161 UNIMPLEMENTED;
162 while (TRUE);
163 return 0;
164 }
165
166 PFN_TYPE
167 NTAPI
168 MmGetPfnForProcess(IN PEPROCESS Process,
169 IN PVOID Address)
170 {
171 UNIMPLEMENTED;
172 while (TRUE);
173 return 0;
174 }
175
176 BOOLEAN
177 NTAPI
178 MmIsDirtyPage(IN PEPROCESS Process,
179 IN PVOID Address)
180 {
181 UNIMPLEMENTED;
182 while (TRUE);
183 return 0;
184 }
185
186 VOID
187 NTAPI
188 MmSetCleanPage(IN PEPROCESS Process,
189 IN PVOID Address)
190 {
191 UNIMPLEMENTED;
192 while (TRUE);
193 }
194
195 VOID
196 NTAPI
197 MmSetDirtyPage(IN PEPROCESS Process,
198 IN PVOID Address)
199 {
200 UNIMPLEMENTED;
201 while (TRUE);
202 }
203
204 BOOLEAN
205 NTAPI
206 MmIsPagePresent(IN PEPROCESS Process,
207 IN PVOID Address)
208 {
209 UNIMPLEMENTED;
210 while (TRUE);
211 return FALSE;
212 }
213
214 BOOLEAN
215 NTAPI
216 MmIsPageSwapEntry(IN PEPROCESS Process,
217 IN PVOID Address)
218 {
219 UNIMPLEMENTED;
220 while (TRUE);
221 return FALSE;
222 }
223
224 ULONG
225 NTAPI
226 MmGetPageProtect(IN PEPROCESS Process,
227 IN PVOID Address)
228 {
229 /* We don't enforce any protection on the pages -- they are all RWX */
230 return PAGE_READWRITE;
231 }
232
233 VOID
234 NTAPI
235 MmSetPageProtect(IN PEPROCESS Process,
236 IN PVOID Address,
237 IN ULONG Protection)
238 {
239 /* We don't enforce any protection on the pages -- they are all RWX */
240 return;
241 }
242
243 VOID
244 NTAPI
245 MmInitGlobalKernelPageDirectory(VOID)
246 {
247 ULONG i;
248 PULONG CurrentPageDirectory = (PULONG)PDE_BASE;
249 extern MMPTE HyperTemplatePte;
250
251 /* Setup PTE template */
252 HyperTemplatePte.u.Long = 0;
253 HyperTemplatePte.u.Hard.Valid = 1;
254 HyperTemplatePte.u.Hard.Access = 1;
255
256 /* Setup PDE template */
257 HyperTemplatePde.u.Long = 0;
258 HyperTemplatePde.u.Hard.Valid = 1;
259
260 /* Loop the 2GB of address space which belong to the kernel */
261 for (i = MiGetPdeOffset(MmSystemRangeStart); i < 2048; i++)
262 {
263 /* Check if we have an entry for this already */
264 if ((i != MiGetPdeOffset(PTE_BASE)) &&
265 (i != MiGetPdeOffset(HYPER_SPACE)) &&
266 (!MmGlobalKernelPageDirectory[i]) &&
267 (CurrentPageDirectory[i]))
268 {
269 /* We don't, link it in our global page directory */
270 MmGlobalKernelPageDirectory[i] = CurrentPageDirectory[i];
271 }
272 }
273 }
274
275 /* PUBLIC FUNCTIONS ***********************************************************/
276
277 /*
278 * @implemented
279 */
280 PHYSICAL_ADDRESS
281 NTAPI
282 MmGetPhysicalAddress(IN PVOID Address)
283 {
284 PHYSICAL_ADDRESS PhysicalAddress;
285 PhysicalAddress.QuadPart = 0;
286
287 UNIMPLEMENTED;
288 while (TRUE);
289
290 return PhysicalAddress;
291 }