ReactOS 0.4.16-dev-91-g764881a
page.c
Go to the documentation of this file.
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#define MODULE_INVOLVED_IN_ARM3
16#include <mm/ARM3/miarm.h>
17
18/* GLOBALS ********************************************************************/
19
20const
23{
24 //
25 // These are the base MM_ protection flags
26 //
27 0,
28 PTE_READONLY | PTE_ENABLE_CACHE,
29 PTE_EXECUTE | PTE_ENABLE_CACHE,
30 PTE_EXECUTE_READ | PTE_ENABLE_CACHE,
31 PTE_READWRITE | PTE_ENABLE_CACHE,
32 PTE_WRITECOPY | PTE_ENABLE_CACHE,
33 PTE_EXECUTE_READWRITE | PTE_ENABLE_CACHE,
34 PTE_EXECUTE_WRITECOPY | PTE_ENABLE_CACHE,
35 //
36 // These OR in the MM_NOCACHE flag
37 //
38 0,
39 PTE_READONLY | PTE_DISABLE_CACHE,
40 PTE_EXECUTE | PTE_DISABLE_CACHE,
41 PTE_EXECUTE_READ | PTE_DISABLE_CACHE,
42 PTE_READWRITE | PTE_DISABLE_CACHE,
43 PTE_WRITECOPY | PTE_DISABLE_CACHE,
44 PTE_EXECUTE_READWRITE | PTE_DISABLE_CACHE,
45 PTE_EXECUTE_WRITECOPY | PTE_DISABLE_CACHE,
46 //
47 // These OR in the MM_DECOMMIT flag, which doesn't seem supported on x86/64/ARM
48 //
49 0,
50 PTE_READONLY | PTE_ENABLE_CACHE,
51 PTE_EXECUTE | PTE_ENABLE_CACHE,
52 PTE_EXECUTE_READ | PTE_ENABLE_CACHE,
53 PTE_READWRITE | PTE_ENABLE_CACHE,
54 PTE_WRITECOPY | PTE_ENABLE_CACHE,
55 PTE_EXECUTE_READWRITE | PTE_ENABLE_CACHE,
56 PTE_EXECUTE_WRITECOPY | PTE_ENABLE_CACHE,
57 //
58 // These OR in the MM_NOACCESS flag, which seems to enable WriteCombining?
59 //
60 0,
61 PTE_READONLY | PTE_WRITECOMBINED_CACHE,
62 PTE_EXECUTE | PTE_WRITECOMBINED_CACHE,
63 PTE_EXECUTE_READ | PTE_WRITECOMBINED_CACHE,
64 PTE_READWRITE | PTE_WRITECOMBINED_CACHE,
65 PTE_WRITECOPY | PTE_WRITECOMBINED_CACHE,
66 PTE_EXECUTE_READWRITE | PTE_WRITECOMBINED_CACHE,
67 PTE_EXECUTE_WRITECOPY | PTE_WRITECOMBINED_CACHE,
68};
69
70const
72{
105};
106
108
109/* Template PTE and PDE for a kernel page */
111MMPTE ValidKernelPte = {.u.Hard.Valid = 1, .u.Hard.Sbo = 1};
112
113/* Template PDE for a demand-zero page */
116
117/* Template PTE for prototype page */
119
123
124/* PRIVATE FUNCTIONS **********************************************************/
125
126VOID
127NTAPI
130{
132}
133
135NTAPI
138 IN PULONG DirectoryTableBase)
139{
141 return FALSE;
142}
143
145NTAPI
148 IN ULONG Protection,
149 IN PPFN_NUMBER Pages,
150 IN ULONG PageCount)
151{
153 return STATUS_SUCCESS;
154}
155
157NTAPI
160 IN ULONG Protection,
161 IN PPFN_NUMBER Pages,
162 IN ULONG PageCount)
163{
165 return STATUS_SUCCESS;
166}
167
168VOID
169NTAPI
171{
173}
174
175VOID
176NTAPI
181{
183}
184
185VOID
186NTAPI
189 IN SWAPENTRY *SwapEntry)
190{
192}
193
195NTAPI
198 IN SWAPENTRY SwapEntry)
199{
202}
203
205NTAPI
208{
210 return 0;
211}
212
214NTAPI
217{
219 return FALSE;
220}
221
222VOID
223NTAPI
226{
228}
229
230VOID
231NTAPI
234{
236}
237
239NTAPI
242{
244 return FALSE;
245}
246
248NTAPI
251{
253 return FALSE;
254}
255
256ULONG
257NTAPI
260{
261 /* We don't enforce any protection on the pages -- they are all RWX */
262 return PAGE_READWRITE;
263}
264
265VOID
266NTAPI
269 IN ULONG Protection)
270{
271 /* We don't enforce any protection on the pages -- they are all RWX */
272 return;
273}
274
275VOID
276NTAPI
278{
279 ULONG i;
280 PULONG CurrentPageDirectory = (PULONG)PDE_BASE;
281
282 /* Loop the 2GB of address space which belong to the kernel */
283 for (i = MiGetPdeOffset(MmSystemRangeStart); i < 2048; i++)
284 {
285 /* Check if we have an entry for this already */
286 if ((i != MiGetPdeOffset(PTE_BASE)) &&
289 (CurrentPageDirectory[i]))
290 {
291 /* We don't, link it in our global page directory */
292 MmGlobalKernelPageDirectory[i] = CurrentPageDirectory[i];
293 }
294 }
295}
296
297VOID
298NTAPI
302 SWAPENTRY* SwapEntry)
303{
304 ASSERT(FALSE);
305}
306
308NTAPI
310{
311 ASSERT(FALSE);
312 return FALSE;
313}
314
315CODE_SEG("INIT")
316VOID
317NTAPI
319{
320 ASSERT(FALSE);
321}
322
#define CODE_SEG(...)
unsigned char BOOLEAN
#define PDE_BASE
Definition: winldr.c:21
LONG NTSTATUS
Definition: precomp.h:26
#define MM_READWRITE
Definition: bootanim.c:19
#define FALSE
Definition: types.h:117
#define PAGE_READONLY
Definition: compat.h:138
#define UNIMPLEMENTED_DBGBREAK(...)
Definition: debug.h:57
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MI_PTE_LOOKUP_NEEDED
Definition: miarm.h:241
#define PTE_BASE
Definition: mmx86.c:14
#define ASSERT(a)
Definition: mode.c:44
#define PAGE_WRITECOPY
Definition: nt_native.h:1305
#define PAGE_NOCACHE
Definition: nt_native.h:1311
#define PAGE_READWRITE
Definition: nt_native.h:1304
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1307
#define PAGE_EXECUTE
Definition: nt_native.h:1306
#define PAGE_EXECUTE_WRITECOPY
Definition: nt_native.h:1309
#define PAGE_NOACCESS
Definition: nt_native.h:1302
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
#define PAGE_GUARD
Definition: nt_native.h:1310
#define HYPER_SPACE
Definition: mm.h:14
#define MM_PTE_SOFTWARE_PROTECTION_BITS
Definition: mm.h:75
#define MiGetPdeOffset(x)
Definition: mm.h:195
#define MmSystemRangeStart
Definition: mm.h:32
#define MmSetDirtyPage(__P, __A)
Definition: mm.h:1252
_In_ PVOID _Out_opt_ BOOLEAN * WasDirty
Definition: mm.h:1304
#define MmSetCleanPage(__P, __A)
Definition: mm.h:1251
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
ULONG_PTR SWAPENTRY
Definition: mm.h:57
VOID NTAPI MmSetPageProtect(IN PEPROCESS Process, IN PVOID Address, IN ULONG Protection)
Definition: page.c:267
MMPTE ValidKernelPte
Definition: page.c:111
NTSTATUS NTAPI MmCreatePageFileMapping(IN PEPROCESS Process, IN PVOID Address, IN SWAPENTRY SwapEntry)
Definition: page.c:196
BOOLEAN NTAPI MmIsDisabledPage(PEPROCESS Process, PVOID Address)
Definition: page.c:309
ULONG NTAPI MmGetPageProtect(IN PEPROCESS Process, IN PVOID Address)
Definition: page.c:258
VOID NTAPI MmGetPageFileMapping(PEPROCESS Process, PVOID Address, SWAPENTRY *SwapEntry)
Definition: page.c:299
BOOLEAN NTAPI MmIsPagePresent(IN PEPROCESS Process, IN PVOID Address)
Definition: page.c:240
MMPTE ValidKernelPteLocal
Definition: page.c:120
NTSTATUS NTAPI MmCreateVirtualMapping(IN PEPROCESS Process, IN PVOID Address, IN ULONG Protection, IN PPFN_NUMBER Pages, IN ULONG PageCount)
Definition: page.c:158
VOID NTAPI MmDeletePageFileMapping(IN PEPROCESS Process, IN PVOID Address, IN SWAPENTRY *SwapEntry)
Definition: page.c:187
ULONG MmGlobalKernelPageDirectory[4096]
Definition: page.c:107
BOOLEAN NTAPI MmIsDirtyPage(IN PEPROCESS Process, IN PVOID Address)
Definition: page.c:215
MMPDE DemandZeroPde
Definition: page.c:114
BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, IN PEPROCESS Process, IN PULONG DirectoryTableBase)
Definition: page.c:136
MMPDE ValidKernelPdeLocal
Definition: page.c:121
const ULONG MmProtectToPteMask[32]
Definition: page.c:22
MMPTE MmDecommittedPte
Definition: page.c:122
VOID NTAPI MiInitializeSessionSpaceLayout(VOID)
Definition: page.c:318
PFN_NUMBER NTAPI MmGetPfnForProcess(IN PEPROCESS Process, IN PVOID Address)
Definition: page.c:206
const ULONG MmProtectToValue[32]
Definition: page.c:71
VOID NTAPI MiFlushTlb(IN PMMPTE PointerPte, IN PVOID Address)
Definition: page.c:128
MMPTE PrototypePte
Definition: page.c:118
MMPTE DemandZeroPte
Definition: page.c:115
BOOLEAN NTAPI MmIsPageSwapEntry(IN PEPROCESS Process, IN PVOID Address)
Definition: page.c:249
NTSTATUS NTAPI MmCreateVirtualMappingUnsafe(IN PEPROCESS Process, IN PVOID Address, IN ULONG Protection, IN PPFN_NUMBER Pages, IN ULONG PageCount)
Definition: page.c:146
VOID NTAPI MmRawDeleteVirtualMapping(IN PVOID Address)
Definition: page.c:170
VOID NTAPI MmDeleteVirtualMapping(IN PEPROCESS Process, IN PVOID Address, OUT PBOOLEAN WasDirty, OUT PPFN_NUMBER Page)
Definition: page.c:177
VOID NTAPI MmInitGlobalKernelPageDirectory(VOID)
Definition: page.c:277
MMPDE ValidKernelPde
Definition: page.c:110
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
static WCHAR Address[46]
Definition: ping.c:68
ULONG * PPFN_NUMBER
Definition: ke.h:9
ULONG PFN_NUMBER
Definition: ke.h:9
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG64 Valid
Definition: mmtypes.h:150
union _MMPTE::@2334 u
MMPTE_HARDWARE Hard
Definition: mmtypes.h:217
ULONG_PTR Long
Definition: mmtypes.h:215
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define PAGE_WRITECOMBINE
Definition: mmtypes.h:78