xref: /reactos/ntoskrnl/mm/ARM3/largepag.c (revision c2c66aff)
1 /*
2  * PROJECT:         ReactOS Kernel
3  * LICENSE:         BSD - See COPYING.ARM in the top level directory
4  * FILE:            ntoskrnl/mm/ARM3/largepag.c
5  * PURPOSE:         ARM Memory Manager Large Page Support
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 
20 LIST_ENTRY MmProcessList;
21 PMMPTE MiLargePageHyperPte;
22 ULONG MiLargePageRangeIndex;
23 MI_LARGE_PAGE_RANGES MiLargePageRanges[64];
24 WCHAR MmLargePageDriverBuffer[512] = {0};
25 ULONG MmLargePageDriverBufferLength = -1;
26 LIST_ENTRY MiLargePageDriverList;
27 BOOLEAN MiLargePageAllDrivers;
28 
29 /* FUNCTIONS ******************************************************************/
30 
31 VOID
32 NTAPI
33 INIT_FUNCTION
34 MiInitializeLargePageSupport(VOID)
35 {
36 #if _MI_PAGING_LEVELS > 2
37     DPRINT1("MiInitializeLargePageSupport: PAE/x64 Not Implemented\n");
38     //ASSERT(FALSE);
39 #else
40     /* Initialize the large-page hyperspace PTE used for initial mapping */
41     MiLargePageHyperPte = MiReserveSystemPtes(1, SystemPteSpace);
42     ASSERT(MiLargePageHyperPte);
43     MiLargePageHyperPte->u.Long = 0;
44 
45     /* Initialize the process tracking list, and insert the system process */
46     InitializeListHead(&MmProcessList);
47     InsertTailList(&MmProcessList, &PsGetCurrentProcess()->MmProcessLinks);
48 #endif
49 }
50 
51 VOID
52 NTAPI
53 INIT_FUNCTION
54 MiSyncCachedRanges(VOID)
55 {
56     ULONG i;
57 
58     /* Scan every range */
59     for (i = 0; i < MiLargePageRangeIndex; i++)
60     {
61         UNIMPLEMENTED_DBGBREAK("No support for large pages\n");
62     }
63 }
64 
65 VOID
66 NTAPI
67 INIT_FUNCTION
68 MiInitializeDriverLargePageList(VOID)
69 {
70     PWCHAR p, pp;
71 
72     /* Initialize the list */
73     InitializeListHead(&MiLargePageDriverList);
74 
75     /* Bail out if there's nothing */
76     if (MmLargePageDriverBufferLength == 0xFFFFFFFF) return;
77 
78     /* Loop from start to finish */
79     p = MmLargePageDriverBuffer;
80     pp = MmLargePageDriverBuffer + (MmLargePageDriverBufferLength / sizeof(WCHAR));
81     while (p < pp)
82     {
83         /* Skip whitespaces */
84         if ((*p == L' ') || (*p == L'\n') || (*p == L'\r') || (*p == L'\t'))
85         {
86             /* Skip the character */
87             p++;
88             continue;
89         }
90 
91         /* A star means everything */
92         if (*p == L'*')
93         {
94             /* No need to keep going */
95             MiLargePageAllDrivers = TRUE;
96             break;
97         }
98 
99         DPRINT1("Large page drivers not supported\n");
100         ASSERT(FALSE);
101     }
102 }
103 
104 /* EOF */
105