30
30
#define ASSERT_LIST_INVARIANT (x )
31
31
#endif
32
32
33
+ #define ARM3_COLORS 1
34
+
33
35
/* GLOBALS ********************************************************************/
34
36
35
37
BOOLEAN MmDynamicPfn ;
@@ -133,11 +135,9 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
133
135
/* Get the page color */
134
136
OldBlink = MiGetPfnEntryIndex (Entry );
135
137
Color = OldBlink & MmSecondaryColorMask ;
136
- DPRINT1 ("Color: %lx\n" , Color );
137
138
138
139
/* Get the first page on the color list */
139
140
ColorTable = & MmFreePagesByColor [ListName ][Color ];
140
- DPRINT1 ("Color table: %p %lx\n" , ColorTable , ColorTable -> Flink );
141
141
142
142
/* Check if this was was actually the head */
143
143
OldFlink = ColorTable -> Flink ;
@@ -148,7 +148,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
148
148
if (ColorTable -> Flink != LIST_HEAD )
149
149
{
150
150
/* And make the previous link point to the head now */
151
- MiGetPfnEntry (ColorTable -> Flink )-> u4 .PteFrame = -1 ;
151
+ MiGetPfnEntry (ColorTable -> Flink )-> u4 .PteFrame = COLORED_LIST_HEAD ;
152
152
}
153
153
else
154
154
{
@@ -159,7 +159,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
159
159
else
160
160
{
161
161
/* This page shouldn't be pointing back to the head */
162
- ASSERT (Entry -> u4 .PteFrame != -1 );
162
+ ASSERT (Entry -> u4 .PteFrame != COLORED_LIST_HEAD );
163
163
164
164
/* Make the back link point to whoever the next page is */
165
165
Pfn1 = MiGetPfnEntry (Entry -> u4 .PteFrame );
@@ -170,7 +170,7 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
170
170
{
171
171
/* Make the back link point to the head */
172
172
Pfn1 = MiGetPfnEntry (Entry -> OriginalPte .u .Long );
173
- Pfn1 -> u4 .PteFrame = -1 ;
173
+ Pfn1 -> u4 .PteFrame = Entry -> u4 . PteFrame ;
174
174
}
175
175
else
176
176
{
@@ -182,6 +182,9 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
182
182
/* One less colored page */
183
183
ASSERT (ColorTable -> Count >= 1 );
184
184
ColorTable -> Count -- ;
185
+
186
+ /* ReactOS Hack */
187
+ Entry -> OriginalPte .u .Long = 0 ;
185
188
#endif
186
189
/* We are not on a list anymore */
187
190
Entry -> u1 .Flink = Entry -> u2 .Blink = 0 ;
@@ -284,8 +287,6 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex,
284
287
ASSERT (ColorTable -> Count >= 1 );
285
288
286
289
/* Set the forward link to whoever we were pointing to */
287
- DPRINT1 ("Has RMAP: %lx (link: %lx)\n" , Pfn1 -> u3 .e1 .ParityError , Pfn1 -> OriginalPte .u .Long );
288
- DPRINT1 ("Color table: %p %lx\n" , ColorTable , ColorTable -> Flink );
289
290
ColorTable -> Flink = Pfn1 -> OriginalPte .u .Long ;
290
291
291
292
/* Get the first page on the color list */
@@ -297,11 +298,14 @@ MiRemovePageByColor(IN PFN_NUMBER PageIndex,
297
298
else
298
299
{
299
300
/* The list is empty, so we are the first page */
300
- MiGetPfnEntry (ColorTable -> Flink )-> u4 .PteFrame = -1 ;
301
+ MiGetPfnEntry (ColorTable -> Flink )-> u4 .PteFrame = COLORED_LIST_HEAD ;
301
302
}
302
303
303
304
/* One less page */
304
305
ColorTable -> Count -- ;
306
+
307
+ /* ReactOS Hack */
308
+ Pfn1 -> OriginalPte .u .Long = 0 ;
305
309
#endif
306
310
/* See if we hit any thresholds */
307
311
if (MmAvailablePages == MmHighMemoryThreshold )
@@ -536,16 +540,13 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex)
536
540
#ifdef ARM3_COLORS
537
541
/* Get the page color */
538
542
Color = PageFrameIndex & MmSecondaryColorMask ;
539
- DPRINT1 ("Color: %lx\n" , Color );
540
543
541
544
/* Get the first page on the color list */
542
545
ColorTable = & MmFreePagesByColor [FreePageList ][Color ];
543
- DPRINT1 ("Color table: %p %lx\n" , ColorTable , ColorTable -> Flink );
544
- DPRINT1 ("Has RMAP: %lx (link: %lx)\n" , Pfn1 -> u3 .e1 .ParityError , Pfn1 -> OriginalPte .u .Long );
545
546
if (ColorTable -> Flink == LIST_HEAD )
546
547
{
547
548
/* The list is empty, so we are the first page */
548
- Pfn1 -> u4 .PteFrame = -1 ;
549
+ Pfn1 -> u4 .PteFrame = COLORED_LIST_HEAD ;
549
550
ColorTable -> Flink = PageFrameIndex ;
550
551
}
551
552
else
@@ -557,7 +558,6 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex)
557
558
Pfn1 -> u4 .PteFrame = MiGetPfnEntryIndex (Blink );
558
559
559
560
/* If there is an original pte, it should be an old link, NOT a ReactOS RMAP */
560
- DPRINT1 ("Has RMAP: %lx (link: %lx)\n" , Blink -> u3 .e1 .ParityError , Blink -> OriginalPte .u .Long );
561
561
ASSERT (Blink -> u3 .e1 .ParityError == FALSE);
562
562
Blink -> OriginalPte .u .Long = PageFrameIndex ;
563
563
}
@@ -663,7 +663,6 @@ MiInsertPageInList(IN PMMPFNLIST ListHead,
663
663
664
664
/* Get the page color */
665
665
Color = PageFrameIndex & MmSecondaryColorMask ;
666
- DPRINT1 ("Color: %lx\n" , Color );
667
666
668
667
/* Get the list for this color */
669
668
ColorHead = & MmFreePagesByColor [ZeroedPageList ][Color ];
@@ -676,7 +675,7 @@ MiInsertPageInList(IN PMMPFNLIST ListHead,
676
675
677
676
/* Make this page point back to the list, and point forwards to the old head */
678
677
Pfn1 -> OriginalPte .u .Long = Flink ;
679
- Pfn1 -> u4 .PteFrame = -1 ;
678
+ Pfn1 -> u4 .PteFrame = COLORED_LIST_HEAD ;
680
679
681
680
/* Set the new head */
682
681
ColorHead -> Flink = PageFrameIndex ;
@@ -849,7 +848,7 @@ MiDecrementShareCount(IN PMMPFN Pfn1,
849
848
* ways we shouldn't be seeing RMAP entries at this point
850
849
*/
851
850
ASSERT (Pfn1 -> OriginalPte .u .Soft .Prototype == 0 );
852
- ASSERT (Pfn1 -> OriginalPte . u . Long == 0 );
851
+ ASSERT (Pfn1 -> u3 . e1 . ParityError == FALSE );
853
852
854
853
/* Mark the page temporarily as valid, we're going to make it free soon */
855
854
Pfn1 -> u3 .e1 .PageLocation = ActiveAndValid ;
0 commit comments