[ros-diffs] [sir_richard] 49774: [NTOS]: Fix incorrect assumptions that a PDE == PTE which have crept up throughout new ARM3 code. [NTOS]: Fix a couple more unportable directly "Hard" PTE field accesses, inste...

sir_richard at svn.reactos.org sir_richard at svn.reactos.org
Wed Nov 24 15:21:45 UTC 2010


Author: sir_richard
Date: Wed Nov 24 15:21:45 2010
New Revision: 49774

URL: http://svn.reactos.org/svn/reactos?rev=49774&view=rev
Log:
[NTOS]: Fix incorrect assumptions that a PDE == PTE which have crept up throughout new ARM3 code.
[NTOS]: Fix a couple more unportable directly "Hard" PTE field accesses, instead of using portable MI macros.
[NTOS]: Cleanup some of the pool code that had really messed up PDE vs PTE.
[NTOS]: Define the number of page directoty levels for ARM.
[NTOS]: Comment out some ARM3 code that won't be needed now that most of the x86 code is in C.
Fixes all but one build error.

Modified:
    trunk/reactos/ntoskrnl/include/internal/arm/mm.h
    trunk/reactos/ntoskrnl/include/internal/i386/mm.h
    trunk/reactos/ntoskrnl/include/internal/mm.h
    trunk/reactos/ntoskrnl/ke/arm/trapc.c
    trunk/reactos/ntoskrnl/mm/ARM3/arm/init.c
    trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
    trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
    trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
    trunk/reactos/ntoskrnl/mm/ARM3/pool.c
    trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
    trunk/reactos/ntoskrnl/mm/ARM3/section.c
    trunk/reactos/ntoskrnl/mm/amd64/init.c

Modified: trunk/reactos/ntoskrnl/include/internal/arm/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/arm/mm.h?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/arm/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/arm/mm.h [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -1,4 +1,6 @@
 #pragma once
+
+#define _MI_PAGING_LEVELS 2
 
 #define PDE_SHIFT 20
 
@@ -116,6 +118,7 @@
 #define MI_IS_PAGE_WRITEABLE(x)    ((x)->u.Hard.ReadOnly == 0)
 #define MI_IS_PAGE_COPY_ON_WRITE(x)FALSE
 #define MI_IS_PAGE_DIRTY(x)        TRUE
+#define MI_IS_PAGE_LARGE(x)        FALSE
 
 /* Easy accessing PFN in PTE */
 #define PFN_FROM_PTE(v) ((v)->u.Hard.PageFrameNumber)
@@ -131,6 +134,12 @@
                                              MI_HYPERSPACE_PTES * PAGE_SIZE)
 #define MI_ZERO_PTE                         (PMMPTE)(MI_MAPPING_RANGE_END + \
                                              PAGE_SIZE)
+#define MI_DUMMY_PTE                        (PMMPTE)(MI_MAPPING_RANGE_END + \
+                                             PAGE_SIZE)
+#define MI_VAD_BITMAP                       (PMMPTE)(MI_DUMMY_PTE + \
+                                             PAGE_SIZE)
+#define MI_WORKING_SET_LIST                 (PMMPTE)(MI_VAD_BITMAP + \
+                                             PAGE_SIZE)
 
 /* Retrives the PDE entry for the given VA */
 #define MiGetPdeAddress(x) ((PMMPDE)(PDE_BASE + (((ULONG)(x) >> 20) << 2)))
@@ -142,7 +151,8 @@
 
 /* Retrives the PDE offset for the given VA */
 #define MiGetPdeOffset(x) (((ULONG)(x)) >> 20)
-
+//#define MiGetPteOffset(x) (((ULONG)(x)) >> 12)
+    
 /* Convert a PTE into a corresponding address */
 #define MiPteToAddress(x) ((PVOID)((ULONG)(x) << 10))
 #define MiPdeToAddress(x) ((PVOID)((ULONG)(x) << 18))

Modified: trunk/reactos/ntoskrnl/include/internal/i386/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/i386/mm.h?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/i386/mm.h [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -55,6 +55,7 @@
 #define MI_PAGE_DISABLE_CACHE(x)   ((x)->u.Hard.CacheDisable = 1)
 #define MI_PAGE_WRITE_THROUGH(x)   ((x)->u.Hard.WriteThrough = 1)
 #define MI_PAGE_WRITE_COMBINED(x)  ((x)->u.Hard.WriteThrough = 0)
+#define MI_IS_PAGE_LARGE(x)        ((x)->u.Hard.Large == 1)
 #if !defined(CONFIG_SMP)
 #define MI_IS_PAGE_WRITEABLE(x)    ((x)->u.Hard.Write == 1)
 #else
@@ -80,18 +81,6 @@
 
 #define TEB_BASE                            0x7FFDE000
 
-#define MI_HYPERSPACE_PTES                  (256 - 1)
-#define MI_ZERO_PTES                        (32)
-#define MI_MAPPING_RANGE_START              (ULONG)HYPER_SPACE
-#define MI_MAPPING_RANGE_END                (MI_MAPPING_RANGE_START + \
-                                             MI_HYPERSPACE_PTES * PAGE_SIZE)
-#define MI_DUMMY_PTE                        (PMMPTE)(MI_MAPPING_RANGE_END + \
-                                             PAGE_SIZE)
-#define MI_VAD_BITMAP                       (PMMPTE)(MI_DUMMY_PTE + \
-                                             PAGE_SIZE)
-#define MI_WORKING_SET_LIST                 (PMMPTE)(MI_VAD_BITMAP + \
-                                             PAGE_SIZE)
-
 /* On x86, these two are the same */
 #define MMPDE MMPTE
 #define PMMPDE PMMPTE

Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/mm.h?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -486,7 +486,7 @@
     PRTL_BITMAP EndOfPagedPoolBitmap;
     PMMPTE FirstPteForPagedPool;
     PMMPTE LastPteForPagedPool;
-    PMMPTE NextPdeForPagedPoolExpansion;
+    PMMPDE NextPdeForPagedPoolExpansion;
     ULONG PagedPoolHint;
     SIZE_T PagedPoolCommit;
     SIZE_T AllocatedPagedPool;

Modified: trunk/reactos/ntoskrnl/ke/arm/trapc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc.c?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -15,6 +15,7 @@
 
 /* FUNCTIONS ******************************************************************/
 
+#if 0
 VOID
 KiIdleLoop(VOID)
 {
@@ -89,6 +90,7 @@
         }
     }
 }
+#endif
 
 VOID
 NTAPI
@@ -116,6 +118,7 @@
     while (TRUE);
 }
 
+#if 0
 BOOLEAN
 KiSwapContextInternal(IN PKTHREAD OldThread,
                       IN PKTHREAD NewThread)
@@ -220,6 +223,7 @@
     //
     return FALSE;
 }
+#endif
 
 VOID
 KiApcInterrupt(VOID)
@@ -262,6 +266,7 @@
     KiDeliverApc(PreviousMode, &ExceptionFrame, TrapFrame);
 }
 
+#if 0
 VOID
 KiDispatchInterrupt(VOID)
 {
@@ -343,6 +348,7 @@
         KiSwapContext(OldThread, NewThread);
     }
 }
+#endif
 
 VOID
 KiInterruptHandler(IN PKTRAP_FRAME TrapFrame,

Modified: trunk/reactos/ntoskrnl/mm/ARM3/arm/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/arm/init.c?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/arm/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/arm/init.c [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -42,7 +42,7 @@
 PVOID MiSystemViewStart;
 ULONG MmSystemViewSize;
 PFN_NUMBER MmSystemPageDirectory[PD_COUNT];
-PMMPTE MmSystemPagePtes;
+PMMPDE MmSystemPagePtes;
 ULONG MmNumberOfSystemPtes;
 ULONG MxPfnAllocation;
 RTL_BITMAP MiPfnBitMap;
@@ -61,7 +61,7 @@
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
-NTSTATUS
+BOOLEAN
 NTAPI
 MmArmInitSystem(IN ULONG Phase,
                 IN PLOADER_PARAMETER_BLOCK LoaderBlock)
@@ -71,7 +71,7 @@
     //
     DPRINT1("NEVER TELL ME THE ODDS!\n");
     while (TRUE);
-    return STATUS_SUCCESS;
+    return TRUE;
 }
 
 /* EOF */

Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -235,7 +235,7 @@
 #define MI_GET_NEXT_COLOR(x)                (MI_GET_PAGE_COLOR(++MmSystemPageColor))
 #define MI_GET_NEXT_PROCESS_COLOR(x)        (MI_GET_PAGE_COLOR(++(x)->NextPageColor))
 
-#ifdef _M_IX86
+#ifndef _M_AMD64
 //
 // Decodes a Prototype PTE into the underlying PTE
 //
@@ -462,7 +462,7 @@
 extern PMMPTE MiSessionBasePte;
 extern PMMPTE MiSessionLastPte;
 extern SIZE_T MmSizeOfPagedPoolInBytes;
-extern PMMPTE MmSystemPagePtes;
+extern PMMPDE MmSystemPagePtes;
 extern PVOID MmSystemCacheStart;
 extern PVOID MmSystemCacheEnd;
 extern MMSUPPORT MmSystemCacheWs;
@@ -607,7 +607,7 @@
     NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
 }
 
-#ifdef _M_IX86
+#ifndef _M_AMD64
 //
 // Builds a Prototype PTE for the address of the PTE
 //
@@ -675,6 +675,33 @@
     /* Write the invalid PTE */
     ASSERT(InvalidPte.u.Hard.Valid == 0);
     *PointerPte = InvalidPte;
+}
+
+//
+// Writes a valid PDE
+//
+VOID
+FORCEINLINE
+MI_WRITE_VALID_PDE(IN PMMPDE PointerPde,
+                   IN MMPDE TempPde)
+{
+    /* Write the valid PDE */
+    ASSERT(PointerPde->u.Hard.Valid == 0);
+    ASSERT(TempPde.u.Hard.Valid == 1);
+    *PointerPde = TempPde;
+}
+
+//
+// Writes an invalid PDE
+//
+VOID
+FORCEINLINE
+MI_WRITE_INVALID_PDE(IN PMMPDE PointerPde,
+                     IN MMPDE InvalidPde)
+{
+    /* Write the invalid PDE */
+    ASSERT(InvalidPde.u.Hard.Valid == 0);
+    *PointerPde = InvalidPde;
 }
 
 //

Modified: trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/mminit.c?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -161,7 +161,7 @@
 // address.
 //
 PFN_NUMBER MmSystemPageDirectory[PD_COUNT];
-PMMPTE MmSystemPagePtes;
+PMMPDE MmSystemPagePtes;
 #endif
 
 //
@@ -679,7 +679,7 @@
                 /* Yes we do, set it up */
                 Pfn1 = MiGetPfnEntry(PageFrameIndex);
                 Pfn1->u4.PteFrame = StartupPdIndex;
-                Pfn1->PteAddress = PointerPde;
+                Pfn1->PteAddress = (PMMPTE)PointerPde;
                 Pfn1->u2.ShareCount++;
                 Pfn1->u3.e2.ReferenceCount = 1;
                 Pfn1->u3.e1.PageLocation = ActiveAndValid;
@@ -771,7 +771,7 @@
         /* Make it a bogus page to catch errors */
         PointerPde = MiAddressToPde(0xFFFFFFFF);
         Pfn1->u4.PteFrame = PFN_FROM_PTE(PointerPde);
-        Pfn1->PteAddress = PointerPde;
+        Pfn1->PteAddress = (PMMPTE)PointerPde;
         Pfn1->u2.ShareCount++;
         Pfn1->u3.e2.ReferenceCount = 0xFFF0;
         Pfn1->u3.e1.PageLocation = ActiveAndValid;
@@ -1192,7 +1192,7 @@
 MiAddHalIoMappings(VOID)
 {
     PVOID BaseAddress;
-    PMMPTE PointerPde;
+    PMMPDE PointerPde;
     PMMPTE PointerPte;
     ULONG i, j, PdeCount;
     PFN_NUMBER PageFrameIndex;
@@ -1203,12 +1203,12 @@
 
     /* Check how many PDEs the heap has */
     PointerPde = MiAddressToPde(BaseAddress);
-    PdeCount = PDE_COUNT - ADDR_TO_PDE_OFFSET(BaseAddress);
+    PdeCount = PDE_COUNT - MiGetPdeOffset(BaseAddress);
     for (i = 0; i < PdeCount; i++)
     {
         /* Does the HAL own this mapping? */
         if ((PointerPde->u.Hard.Valid == 1) &&
-            (PointerPde->u.Hard.LargePage == 0))
+            (MI_IS_PAGE_LARGE(PointerPde) == FALSE))
         {
             /* Get the PTE for it and scan each page */
             PointerPte = MiAddressToPte(BaseAddress);
@@ -1556,8 +1556,10 @@
 INIT_FUNCTION
 MiBuildPagedPool(VOID)
 {
-    PMMPTE PointerPte, PointerPde;
+    PMMPTE PointerPte;
+    PMMPDE PointerPde;
     MMPTE TempPte = ValidKernelPte;
+    MMPDE TempPde = ValidKernelPde;
     PFN_NUMBER PageFrameIndex;
     KIRQL OldIrql;
     ULONG Size, BitMapSize;
@@ -1648,7 +1650,7 @@
 #endif
 
     RtlZeroMemory(PointerPde,
-                  (1 + MiAddressToPde(MmPagedPoolEnd) - PointerPde) * sizeof(MMPTE));
+                  (1 + MiAddressToPde(MmPagedPoolEnd) - PointerPde) * sizeof(MMPDE));
 
     //
     // Next, get the first and last PTE
@@ -1666,8 +1668,8 @@
     MI_SET_USAGE(MI_USAGE_PAGED_POOL);
     MI_SET_PROCESS2("Kernel");
     PageFrameIndex = MiRemoveZeroPage(0);
-    TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
-    MI_WRITE_VALID_PTE(PointerPde, TempPte);
+    TempPde.u.Hard.PageFrameNumber = PageFrameIndex;
+    MI_WRITE_VALID_PDE(PointerPde, TempPde);
 #if (_MI_PAGING_LEVELS >= 3)
     /* Use the PPE of MmPagedPoolStart that was setup above */
 //    Bla = PFN_FROM_PTE(PpeAddress(MmPagedPool...));
@@ -1678,8 +1680,8 @@
 
     /* Initialize the PFN entry for it */
     MiInitializePfnForOtherProcess(PageFrameIndex,
-                                   PointerPde,
-                                   MmSystemPageDirectory[(PointerPde - (PMMPTE)PDE_BASE) / PDE_COUNT]);
+                                   (PMMPTE)PointerPde,
+                                   MmSystemPageDirectory[(PointerPde - (PMMPDE)PDE_BASE) / PDE_COUNT]);
 #endif
 
     //

Modified: trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pagfault.c [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -325,7 +325,7 @@
     }
     
     /* Set it dirty if it's a writable page */
-    if (TempPte.u.Hard.Write) TempPte.u.Hard.Dirty = TRUE;
+    if (MI_IS_PAGE_WRITEABLE(&TempPte)) MI_MAKE_DIRTY_PAGE(&TempPte);
     
     /* Write it */
     MI_WRITE_VALID_PTE(PointerPte, TempPte);
@@ -899,7 +899,7 @@
         ASSERT(ProtectionCode != MM_NOACCESS);
 
         /* Make the PDE demand-zero */
-        MI_WRITE_INVALID_PTE(PointerPde, DemandZeroPde);
+        MI_WRITE_INVALID_PDE(PointerPde, DemandZeroPde);
 
         /* And go dispatch the fault on the PDE. This should handle the demand-zero */
 #if MI_TRACE_PFNS
@@ -907,7 +907,7 @@
 #endif
         Status = MiDispatchFault(TRUE,
                                  PointerPte,
-                                 PointerPde,
+                                 (PMMPTE)PointerPde,
                                  NULL,
                                  FALSE,
                                  PsGetCurrentProcess(),
@@ -1058,7 +1058,7 @@
         }
 
         /* Write the dirty bit for writeable pages */
-        if (TempPte.u.Hard.Write) TempPte.u.Hard.Dirty = TRUE;
+        if (MI_IS_PAGE_WRITEABLE(&TempPte)) MI_MAKE_DIRTY_PAGE(&TempPte);
 
         /* And now write down the PTE, making the address valid */
         MI_WRITE_VALID_PTE(PointerPte, TempPte);

Modified: trunk/reactos/ntoskrnl/mm/ARM3/pool.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pool.c?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pool.c [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -375,7 +375,7 @@
 MiAllocatePoolPages(IN POOL_TYPE PoolType,
                     IN SIZE_T SizeInBytes)
 {
-    PFN_NUMBER SizeInPages, PageFrameNumber;
+    PFN_NUMBER SizeInPages, PageFrameNumber, PageTableCount;
     ULONG i;
     KIRQL OldIrql;
     PLIST_ENTRY NextEntry, NextHead, LastHead;
@@ -422,7 +422,7 @@
             // Check if there is enougn paged pool expansion space left
             //
             if (MmPagedPoolInfo.NextPdeForPagedPoolExpansion >
-                MiAddressToPte(MmPagedPoolInfo.LastPteForPagedPool))
+                (PMMPDE)MiAddressToPte(MmPagedPoolInfo.LastPteForPagedPool))
             {
                 //
                 // Out of memory!
@@ -436,23 +436,23 @@
             // Check if we'll have to expand past the last PTE we have available
             //            
             if (((i - 1) + MmPagedPoolInfo.NextPdeForPagedPoolExpansion) >
-                 MiAddressToPte(MmPagedPoolInfo.LastPteForPagedPool))
+                 (PMMPDE)MiAddressToPte(MmPagedPoolInfo.LastPteForPagedPool))
             {
                 //
                 // We can only support this much then
                 //
-                SizeInPages = MiAddressToPte(MmPagedPoolInfo.LastPteForPagedPool) - 
-                              MmPagedPoolInfo.NextPdeForPagedPoolExpansion +
-                              1;
-                ASSERT(SizeInPages < i);
-                i = SizeInPages;
+                PageTableCount = (PMMPDE)MiAddressToPte(MmPagedPoolInfo.LastPteForPagedPool) - 
+                                         MmPagedPoolInfo.NextPdeForPagedPoolExpansion +
+                                         1;
+                ASSERT(PageTableCount < i);
+                i = PageTableCount;
             }
             else
             {
                 //
                 // Otherwise, there is plenty of space left for this expansion
                 //
-                SizeInPages = i;
+                PageTableCount = i;
             }
             
             //
@@ -464,7 +464,7 @@
             // Get the first PTE in expansion space
             //
             PointerPde = MmPagedPoolInfo.NextPdeForPagedPoolExpansion;
-            BaseVa = MiPteToAddress(PointerPde);
+            BaseVa = MiPdeToAddress(PointerPde);
             BaseVaStart = BaseVa;
             
             //
@@ -494,11 +494,11 @@
                                             
                 /* Initialize the PFN */
                 MiInitializePfnForOtherProcess(PageFrameNumber,
-                                               PointerPde,
+                                               (PMMPTE)PointerPde,
                                                MmSystemPageDirectory[(PointerPde - MiAddressToPde(NULL)) / PDE_COUNT]);
                              
                 /* Write the actual PDE now */
-                MI_WRITE_VALID_PTE(PointerPde, TempPde);
+                MI_WRITE_VALID_PDE(PointerPde, TempPde);
 #endif                
                 //
                 // Move on to the next expansion address
@@ -517,26 +517,25 @@
             // These pages are now available, clear their availablity bits
             //
             EndAllocation = (MmPagedPoolInfo.NextPdeForPagedPoolExpansion -
-                             MiAddressToPte(MmPagedPoolInfo.FirstPteForPagedPool)) *
+                             (PMMPDE)MiAddressToPte(MmPagedPoolInfo.FirstPteForPagedPool)) *
                              PTE_COUNT;
             RtlClearBits(MmPagedPoolInfo.PagedPoolAllocationMap,
                          EndAllocation,
-                         SizeInPages * PTE_COUNT);
+                         PageTableCount * PTE_COUNT);
                         
             //
             // Update the next expansion location
             //
-            MmPagedPoolInfo.NextPdeForPagedPoolExpansion += SizeInPages;
+            MmPagedPoolInfo.NextPdeForPagedPoolExpansion += PageTableCount;
             
             //
             // Zero out the newly available memory
             //
-            RtlZeroMemory(BaseVaStart, SizeInPages * PAGE_SIZE);
+            RtlZeroMemory(BaseVaStart, PageTableCount * PAGE_SIZE);
             
             //
             // Now try consuming the pages again
             //
-            SizeInPages = BYTES_TO_PAGES(SizeInBytes);
             i = RtlFindClearBitsAndSet(MmPagedPoolInfo.PagedPoolAllocationMap,
                                        SizeInPages,
                                        0);

Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -971,7 +971,7 @@
     /* Do the same for hyperspace */
     PointerPde = MiAddressToPde(HYPER_SPACE);
     PageFrameNumber = PFN_FROM_PTE(PointerPde);
-    MiInitializePfn(PageFrameNumber, PointerPde, TRUE);
+    MiInitializePfn(PageFrameNumber, (PMMPTE)PointerPde, TRUE);
     
     /* Setup the PFN for the PTE for the working set */
     PointerPte = MiAddressToPte(MI_WORKING_SET_LIST);
@@ -1195,7 +1195,7 @@
                                 HyperIndex);
 
     /* Set it dirty and map it */
-    PdePte.u.Hard.Dirty = TRUE;
+    MI_MAKE_DIRTY_PAGE(&PdePte);
     MI_WRITE_VALID_PTE(PointerPte, PdePte);
 
     /* Now get hyperspace's page table */
@@ -1228,7 +1228,7 @@
                                 PdeIndex);
 
     /* Set it dirty and map it */
-    PdePte.u.Hard.Dirty = TRUE;
+    MI_MAKE_DIRTY_PAGE(&PdePte);
     MI_WRITE_VALID_PTE(PointerPte, PdePte);
 
     /* Now get the page directory (which we'll double map, so call it a page table */

Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -347,17 +347,17 @@
 
             /* Initialize its PFN entry, with the parent system page directory page table */
             MiInitializePfnForOtherProcess(PageFrameIndex,
-                                           PointerPde,
+                                           (PMMPTE)PointerPde,
                                            MmSystemPageDirectory[(PointerPde - MiAddressToPde(NULL)) / PDE_COUNT]);
 
             /* Make the system PDE entry valid */
-            MI_WRITE_VALID_PTE(SystemMapPde, TempPde);
+            MI_WRITE_VALID_PDE(SystemMapPde, TempPde);
             
             /* The system PDE entry might be the PDE itself, so check for this */
             if (PointerPde->u.Hard.Valid == 0)
             {
                 /* It's different, so make the real PDE valid too */
-                MI_WRITE_VALID_PTE(PointerPde, TempPde);
+                MI_WRITE_VALID_PDE(PointerPde, TempPde);
             }
         }
 

Modified: trunk/reactos/ntoskrnl/mm/amd64/init.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/amd64/init.c?rev=49774&r1=49773&r2=49774&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/amd64/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/amd64/init.c [iso-8859-1] Wed Nov 24 15:21:45 2010
@@ -752,9 +752,7 @@
     /* Save the first and last paged pool PTE */
     MmPagedPoolInfo.FirstPteForPagedPool = MiAddressToPte(MmPagedPoolStart);
     MmPagedPoolInfo.LastPteForPagedPool = MiAddressToPte(MmPagedPoolEnd);
-
-    MmPagedPoolInfo.NextPdeForPagedPoolExpansion = 
-        MiAddressToPde(MmPagedPoolStart) + 1;
+    MmPagedPoolInfo.NextPdeForPagedPoolExpansion = MiAddressToPde(MmPagedPoolStart) + 1;
 
     // We keep track of each page via a bit, so check how big the bitmap will
     // have to be (make sure to align our page count such that it fits nicely




More information about the Ros-diffs mailing list