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
9 /* INCLUDES *******************************************************************/
15 /* GLOBALS ********************************************************************/
17 ULONG MmGlobalKernelPageDirectory
[4096];
18 MMPDE HyperTemplatePde
;
20 /* PRIVATE FUNCTIONS **********************************************************/
24 MiFlushTlb(IN PMMPTE PointerPte
,
33 MmCreateProcessAddressSpace(IN ULONG MinWs
,
35 IN PULONG DirectoryTableBase
)
44 MmUpdatePageDir(IN PEPROCESS Process
,
54 Mmi386ReleaseMmInfo(IN PEPROCESS Process
)
63 MmInitializeHandBuiltProcess(IN PEPROCESS Process
,
64 IN PULONG DirectoryTableBase
)
68 return STATUS_SUCCESS
;
73 MmGetPageDirectory(VOID
)
76 return (PULONG
)KeArmTranslationTableRegisterGet().AsUlong
;
81 MmDisableVirtualMapping(IN PEPROCESS Process
,
83 OUT PBOOLEAN WasDirty
,
92 MmEnableVirtualMapping(IN PEPROCESS Process
,
101 MmCreateVirtualMappingUnsafe(IN PEPROCESS Process
,
109 return STATUS_SUCCESS
;
114 MmCreateVirtualMapping(IN PEPROCESS Process
,
122 return STATUS_SUCCESS
;
127 MmRawDeleteVirtualMapping(IN PVOID Address
)
135 MmDeleteVirtualMapping(IN PEPROCESS Process
,
138 OUT PBOOLEAN WasDirty
,
147 MmDeletePageFileMapping(IN PEPROCESS Process
,
149 IN SWAPENTRY
*SwapEntry
)
157 MmCreatePageFileMapping(IN PEPROCESS Process
,
159 IN SWAPENTRY SwapEntry
)
168 MmGetPfnForProcess(IN PEPROCESS Process
,
178 MmIsDirtyPage(IN PEPROCESS Process
,
188 MmSetCleanPage(IN PEPROCESS Process
,
197 MmSetDirtyPage(IN PEPROCESS Process
,
206 MmIsPagePresent(IN PEPROCESS Process
,
216 MmIsPageSwapEntry(IN PEPROCESS Process
,
226 MmGetPageProtect(IN PEPROCESS Process
,
229 /* We don't enforce any protection on the pages -- they are all RWX */
230 return PAGE_READWRITE
;
235 MmSetPageProtect(IN PEPROCESS Process
,
239 /* We don't enforce any protection on the pages -- they are all RWX */
245 MmInitGlobalKernelPageDirectory(VOID
)
248 PULONG CurrentPageDirectory
= (PULONG
)PDE_BASE
;
249 extern MMPTE HyperTemplatePte
;
251 /* Setup PTE template */
252 HyperTemplatePte
.u
.Long
= 0;
253 HyperTemplatePte
.u
.Hard
.Valid
= 1;
254 HyperTemplatePte
.u
.Hard
.Access
= 1;
256 /* Setup PDE template */
257 HyperTemplatePde
.u
.Long
= 0;
258 HyperTemplatePde
.u
.Hard
.Valid
= 1;
260 /* Loop the 2GB of address space which belong to the kernel */
261 for (i
= MiGetPdeOffset(MmSystemRangeStart
); i
< 2048; i
++)
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
]))
269 /* We don't, link it in our global page directory */
270 MmGlobalKernelPageDirectory
[i
] = CurrentPageDirectory
[i
];
275 /* PUBLIC FUNCTIONS ***********************************************************/
282 MmGetPhysicalAddress(IN PVOID Address
)
284 PHYSICAL_ADDRESS PhysicalAddress
;
285 PhysicalAddress
.QuadPart
= 0;
290 return PhysicalAddress
;