Author: ros-arm-bringup Date: Wed Jul 22 09:33:22 2009 New Revision: 42131
URL: http://svn.reactos.org/svn/reactos?rev=42131&view=rev Log: - Separe ARM3 Init into 3 defined phases: - 1: No PFN Database exists - 2: PFN Database exists - 3: ReactOS NP Pool exists (deprecated) - Cleanup ReactOS Mm init to work with this. - ARM3 Phase 1 Init now uses pages directly from the physical memory descriptor. - This similar to how "MmAllocEarlyPage" used to work. - A new function MxGetNextPage now does this. - MxGetNextPage can allocate more than just one page however (making it possible to get contiguous physical memory without going through the PFN-based MmAllocateContiguousMemory beast) - Also MxGetNextPage will bugcheck with INSTALL_MORE_MEMORY if it runs out of pages. - Renamed the physical memory descriptor variables to MxFreeDescriptor, MxOldFreeDescriptor instead of MiFreeDescriptor and MiOrgFreeDescriptor (based on NT symbols) - Nonpaged pool PDEs, PFN database PDEs, and initial nonpaged pool PTEs are now allocated through MxGetNextPage. - Fix an off by one error in the sizing of MxPfnAllocation. - The PFN database is now fully "owned" by ARM3 in terms of its PDE mappings and VA location at 0xB0000000. - ie. MmArmPfnDatabase is now MmPfnDatabase. - The actual PFN database entries and setup are still done by the ReactOS Mm. - Got rid of ARM nonpaged pool allocator test. - Repositioned ReactOS nonpaged pool (deprecated) after the boot image (used to be after the PFN database). - Paged pool follows.
Modified: trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c trunk/reactos/ntoskrnl/mm/ARM3/miarm.h trunk/reactos/ntoskrnl/mm/freelist.c trunk/reactos/ntoskrnl/mm/mminit.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/i386/init.... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/i386/init.c [iso-8859-1] Wed Jul 22 09:33:22 2009 @@ -1,8 +1,8 @@ /* * PROJECT: ReactOS Kernel * LICENSE: BSD - See COPYING.ARM in the top level directory - * FILE: ntoskrnl/mm/ARM3/init.c - * PURPOSE: ARM Memory Manager Initialization + * FILE: ntoskrnl/mm/ARM3/i386/init.c + * PURPOSE: ARM Memory Manager Initialization for x86 * PROGRAMMERS: ReactOS Portable Systems Group */
@@ -109,14 +109,25 @@ ULONG MxPfnAllocation;
// -// The ARM³ PFN Database -// -PMMPFN MmArmPfnDatabase; - -// // This structure describes the different pieces of RAM-backed address space // PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock; + +// +// Before we have a PFN database, memory comes straight from our physical memory +// blocks, which is nice because it's guaranteed contiguous and also because once +// we take a page from here, the system doesn't see it anymore. +// However, once the fun is over, those pages must be re-integrated back into +// PFN society life, and that requires us keeping a copy of the original layout +// so that we can parse it later. +// +PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor; +MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor; + +// +// This is where we keep track of the most basic physical layout markers +// +ULONG MmNumberOfPhysicalPages, MmHighestPhysicalPage, MmLowestPhysicalPage;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -141,6 +152,35 @@ MmGlobalKernelPageDirectory[Pde] = ((PULONG)PDE_BASE)[Pde]; Pde++; } +} + +PFN_NUMBER +NTAPI +MxGetNextPage(IN PFN_NUMBER PageCount) +{ + PFN_NUMBER Pfn; + + // + // Make sure we have enough pages + // + if (PageCount > MxFreeDescriptor->PageCount) + { + // + // Crash the system + // + KeBugCheckEx(INSTALL_MORE_MEMORY, + MmNumberOfPhysicalPages, + MxFreeDescriptor->PageCount, + MxOldFreeDescriptor.PageCount, + PageCount); + } + + // + // Use our highest usable free pages + // + Pfn = MxFreeDescriptor->BasePage + MxFreeDescriptor->PageCount - PageCount; + MxFreeDescriptor->PageCount -= PageCount; + return Pfn; }
PPHYSICAL_MEMORY_DESCRIPTOR @@ -284,8 +324,11 @@ MmArmInitSystem(IN ULONG Phase, IN PLOADER_PARAMETER_BLOCK LoaderBlock) { + PLIST_ENTRY NextEntry; + PMEMORY_ALLOCATION_DESCRIPTOR MdBlock; + ULONG FreePages = 0; PMEMORY_AREA MArea; - PHYSICAL_ADDRESS BoundaryAddressMultiple, Low, High; + PHYSICAL_ADDRESS BoundaryAddressMultiple; PFN_NUMBER PageFrameIndex; PMMPTE StartPde, EndPde, PointerPte, LastPte; MMPTE TempPde = HyperTemplatePte, TempPte = HyperTemplatePte; @@ -294,8 +337,7 @@ ULONG OldCount; BOOLEAN IncludeType[LoaderMaximum]; ULONG i; - BoundaryAddressMultiple.QuadPart = Low.QuadPart = 0; - High.QuadPart = -1; + BoundaryAddressMultiple.QuadPart = 0;
if (Phase == 0) { @@ -314,6 +356,95 @@ RtlZeroMemory(StartPde, (EndPde - StartPde) * sizeof(MMPTE));
// + // Loop the memory descriptors + // + NextEntry = LoaderBlock->MemoryDescriptorListHead.Flink; + while (NextEntry != &LoaderBlock->MemoryDescriptorListHead) + { + // + // Get the memory block + // + MdBlock = CONTAINING_RECORD(NextEntry, + MEMORY_ALLOCATION_DESCRIPTOR, + ListEntry); + + // + // Skip invisible memory + // + if ((MdBlock->MemoryType != LoaderFirmwarePermanent) && + (MdBlock->MemoryType != LoaderSpecialMemory) && + (MdBlock->MemoryType != LoaderHALCachedMemory) && + (MdBlock->MemoryType != LoaderBBTMemory)) + { + // + // Check if BURNMEM was used + // + if (MdBlock->MemoryType != LoaderBad) + { + // + // Count this in the total of pages + // + MmNumberOfPhysicalPages += MdBlock->PageCount; + } + + // + // Check if this is the new lowest page + // + if (MdBlock->BasePage < MmLowestPhysicalPage) + { + // + // Update the lowest page + // + MmLowestPhysicalPage = MdBlock->BasePage; + } + + // + // Check if this is the new highest page + // + PageFrameIndex = MdBlock->BasePage + MdBlock->PageCount; + if (PageFrameIndex > MmHighestPhysicalPage) + { + // + // Update the highest page + // + MmHighestPhysicalPage = PageFrameIndex - 1; + } + + // + // Check if this is free memory + // + if ((MdBlock->MemoryType == LoaderFree) || + (MdBlock->MemoryType == LoaderLoadedProgram) || + (MdBlock->MemoryType == LoaderFirmwareTemporary) || + (MdBlock->MemoryType == LoaderOsloaderStack)) + { + // + // Check if this is the largest memory descriptor + // + if (MdBlock->PageCount > FreePages) + { + // + // For now, it is + // + FreePages = MdBlock->PageCount; + MxFreeDescriptor = MdBlock; + } + } + } + + // + // Keep going + // + NextEntry = MdBlock->ListEntry.Flink; + } + + // + // Save original values of the free descriptor, since it'll be + // altered by early allocations + // + MxOldFreeDescriptor = *MxFreeDescriptor; + + // // Check if this is a machine with less than 19MB of RAM // if (MmNumberOfPhysicalPages < MI_MIN_PAGES_FOR_SYSPTE_TUNING) @@ -434,6 +565,16 @@ // MxPfnAllocation = (MmHighestPhysicalPage + 1) * sizeof(MMPFN); MxPfnAllocation >>= PAGE_SHIFT; + + // + // We have to add one to the count here, because in the process of + // shifting down to the page size, we actually ended up getting the + // lower aligned size (so say, 0x5FFFF bytes is now 0x5F pages). + // Later on, we'll shift this number back into bytes, which would cause + // us to end up with only 0x5F000 bytes -- when we actually want to have + // 0x60000 bytes. + // + MxPfnAllocation++;
// // Now calculate the nonpaged pool expansion VA region @@ -482,35 +623,23 @@ // with the old memory manager, so we'll create a "Shadow PFN Database" // instead, and arbitrarly start it at 0xB0000000. // - MmArmPfnDatabase = (PVOID)0xB0000000; - ASSERT(((ULONG_PTR)MmArmPfnDatabase & ((4 * 1024 * 1024) - 1)) == 0); + MmPfnDatabase = (PVOID)0xB0000000; + ASSERT(((ULONG_PTR)MmPfnDatabase & ((4 * 1024 * 1024) - 1)) == 0);
// // Non paged pool comes after the PFN database // - MmNonPagedPoolStart = (PVOID)((ULONG_PTR)MmArmPfnDatabase + + MmNonPagedPoolStart = (PVOID)((ULONG_PTR)MmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT));
// // Now we actually need to get these many physical pages. Nonpaged pool // is actually also physically contiguous (but not the expansion) // - PageFrameIndex = MmGetContinuousPages(MmSizeOfNonPagedPoolInBytes + - (MxPfnAllocation << PAGE_SHIFT), - Low, - High, - BoundaryAddressMultiple, - FALSE); + PageFrameIndex = MxGetNextPage(MxPfnAllocation + + (MmSizeOfNonPagedPoolInBytes >> PAGE_SHIFT)); ASSERT(PageFrameIndex != 0); - DPRINT1(" 0x%p - 0x%p\t%s\n", - MmArmPfnDatabase, - (ULONG_PTR)MmArmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT), - "Shadow PFN Database"); DPRINT("PFN DB PA PFN begins at: %lx\n", PageFrameIndex); - DPRINT1(" 0x%p - 0x%p\t%s\n", - MmNonPagedPoolStart, - (ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes, - "ARM Non Paged Pool"); DPRINT("NP PA PFN begins at: %lx\n", PageFrameIndex + MxPfnAllocation);
// @@ -529,7 +658,7 @@ // // Get a page // - TempPde.u.Hard.PageFrameNumber = MmAllocPage(MC_SYSTEM, 0); + TempPde.u.Hard.PageFrameNumber = MxGetNextPage(1); ASSERT(TempPde.u.Hard.Valid == 1); *StartPde = TempPde;
@@ -548,7 +677,7 @@ // // Now we need pages for the page tables which will map initial NP // - StartPde = MiAddressToPde(MmArmPfnDatabase); + StartPde = MiAddressToPde(MmPfnDatabase); EndPde = MiAddressToPde((PVOID)((ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes - 1)); while (StartPde <= EndPde) @@ -561,7 +690,7 @@ // // Get a page // - TempPde.u.Hard.PageFrameNumber = MmAllocPage(MC_SYSTEM, 0); + TempPde.u.Hard.PageFrameNumber = MxGetNextPage(1); ASSERT(TempPde.u.Hard.Valid == 1); *StartPde = TempPde;
@@ -581,12 +710,6 @@ // Now remember where the expansion starts // MmNonPagedPoolExpansionStart = NonPagedPoolExpansionVa; - DPRINT1(" 0x%p - 0x%p\t%s\n", - MmNonPagedSystemStart, MmNonPagedPoolExpansionStart, - "System PTE Space"); - DPRINT1(" 0x%p - 0x%p\t%s\n", - MmNonPagedPoolExpansionStart, MmNonPagedPoolEnd, - "Non Paged Pool Expansion PTE Space");
// // Last step is to actually map the nonpaged pool @@ -646,6 +769,13 @@ // Now go ahead and initialize the ARM pool // MiInitializeArmPool(); + } + else if (Phase == 1) // IN BETWEEN, THE PFN DATABASE IS NOW CREATED + { + // + // Initialize the nonpaged pool + // + InitializePool(NonPagedPool, 0);
// // We PDE-aligned the nonpaged system start VA, so haul some extra PTEs! @@ -707,36 +837,28 @@ // Sync us up with ReactOS Mm // MiSyncARM3WithROS(MmNonPagedSystemStart, (PVOID)((ULONG_PTR)MmNonPagedPoolEnd - 1)); - MiSyncARM3WithROS(MmArmPfnDatabase, (PVOID)((ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes - 1)); + MiSyncARM3WithROS(MmPfnDatabase, (PVOID)((ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes - 1)); MiSyncARM3WithROS((PVOID)HYPER_SPACE, (PVOID)(HYPER_SPACE + PAGE_SIZE - 1)); - - // - // Initialize the nonpaged pool - // - InitializePool(NonPagedPool, 0); - - // - // Do a little test of the nonpaged pool allocator - // - if (0) - { - ULONG i = 0; - PVOID Buffers[4096]; - while (TRUE) - { - Buffers[i] = MiAllocatePoolPages(NonPagedPool, PAGE_SIZE); - if (!Buffers[i]) break; - if (i == 4096) break; - i++; - } - - while (i--) - { - MiFreePoolPages(Buffers[i]); - } - } + + // + // Print the memory layout + // + DPRINT1(" 0x%p - 0x%p\t%s\n", + MmPfnDatabase, + (ULONG_PTR)MmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT), + "PFN Database"); + DPRINT1(" 0x%p - 0x%p\t%s\n", + MmNonPagedPoolStart, + (ULONG_PTR)MmNonPagedPoolStart + MmSizeOfNonPagedPoolInBytes, + "ARM Non Paged Pool"); + DPRINT1(" 0x%p - 0x%p\t%s\n", + MmNonPagedSystemStart, MmNonPagedPoolExpansionStart, + "System PTE Space"); + DPRINT1(" 0x%p - 0x%p\t%s\n", + MmNonPagedPoolExpansionStart, MmNonPagedPoolEnd, + "Non Paged Pool Expansion PTE Space"); } - else + else // NOW WE HAVE NONPAGED POOL { // // Instantiate memory that we don't consider RAM/usable
Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?re... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Wed Jul 22 09:33:22 2009 @@ -105,6 +105,9 @@ extern ULONG MmBootImageSize; extern PMMPTE MmSystemPtesStart[MaximumPtePoolTypes]; extern PMMPTE MmSystemPtesEnd[MaximumPtePoolTypes]; +extern PMEMORY_ALLOCATION_DESCRIPTOR MxFreeDescriptor; +extern MEMORY_ALLOCATION_DESCRIPTOR MxOldFreeDescriptor; +extern ULONG MxPfnAllocation;
VOID NTAPI
Modified: trunk/reactos/ntoskrnl/mm/freelist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] Wed Jul 22 09:33:22 2009 @@ -713,8 +713,8 @@ PFN_TYPE Pfn;
/* Use one of our highest usable pages */ - Pfn = MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount - 1; - MiFreeDescriptor->PageCount--; + Pfn = MxFreeDescriptor->BasePage + MxFreeDescriptor->PageCount - 1; + MxFreeDescriptor->PageCount--;
/* Return it */ return Pfn; @@ -813,7 +813,6 @@ MmInitializePageList(VOID) { ULONG i; - ULONG Reserved; NTSTATUS Status; PFN_TYPE Pfn = 0; PHYSICAL_PAGE UsedPage; @@ -824,12 +823,9 @@ InitializeListHead(&UserPageListHead); InitializeListHead(&FreeUnzeroedPageListHead); InitializeListHead(&FreeZeroedPageListHead); - - /* Set the size and start of the PFN Database */ - Reserved = PAGE_ROUND_UP((MmHighestPhysicalPage * sizeof(PHYSICAL_PAGE))) / PAGE_SIZE;
/* Loop every page required to hold the PFN database */ - for (i = 0; i < Reserved; i++) + for (i = 0; i < MxPfnAllocation; i++) { PVOID Address = (char*)MmPfnDatabase + (i * PAGE_SIZE);
@@ -924,10 +920,10 @@ } } } - + /* Finally handle the pages describing the PFN database themselves */ - for (i = (MiFreeDescriptor->BasePage + MiFreeDescriptor->PageCount); - i < (MiFreeDescriptorOrg.BasePage + MiFreeDescriptorOrg.PageCount); + for (i = (MxFreeDescriptor->BasePage + MxFreeDescriptor->PageCount); + i < (MxOldFreeDescriptor.BasePage + MxOldFreeDescriptor.PageCount); i++) { /* Ensure this page was not added previously */
Modified: trunk/reactos/ntoskrnl/mm/mminit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=42... ============================================================================== --- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Wed Jul 22 09:33:22 2009 @@ -48,10 +48,6 @@ PVOID MiNonPagedPoolStart; ULONG MiNonPagedPoolLength; ULONG MmBootImageSize; -ULONG MmNumberOfPhysicalPages, MmHighestPhysicalPage, MmLowestPhysicalPage; -ULONG_PTR MmPfnDatabaseEnd; -PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor; -MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg; ULONG MmUserProbeAddress = 0; PVOID MmHighestUserAddress = NULL; PBOOLEAN Mm64BitPhysicalAddress = FALSE; @@ -115,88 +111,6 @@
VOID NTAPI -MiCountFreePagesInLoaderBlock(PLOADER_PARAMETER_BLOCK LoaderBlock) -{ - PLIST_ENTRY NextEntry; - PMEMORY_ALLOCATION_DESCRIPTOR Md; - ULONG FreePages = 0; - - for (NextEntry = KeLoaderBlock->MemoryDescriptorListHead.Flink; - NextEntry != &KeLoaderBlock->MemoryDescriptorListHead; - NextEntry = NextEntry->Flink) - { - Md = CONTAINING_RECORD(NextEntry, MEMORY_ALLOCATION_DESCRIPTOR, ListEntry); - - /* Skip invisible memory */ - if ((Md->MemoryType != LoaderFirmwarePermanent) && - (Md->MemoryType != LoaderSpecialMemory) && - (Md->MemoryType != LoaderHALCachedMemory) && - (Md->MemoryType != LoaderBBTMemory)) - { - /* Check if BURNMEM was used */ - if (Md->MemoryType != LoaderBad) - { - /* Count this in the total of pages */ - MmNumberOfPhysicalPages += Md->PageCount; - } - - /* Check if this is the new lowest page */ - if (Md->BasePage < MmLowestPhysicalPage) - { - /* Update the lowest page */ - MmLowestPhysicalPage = Md->BasePage; - } - - /* Check if this is the new highest page */ - if ((Md->BasePage + Md->PageCount) > MmHighestPhysicalPage) - { - /* Update the highest page */ - MmHighestPhysicalPage = Md->BasePage + Md->PageCount - 1; - } - - /* Check if this is free memory */ - if ((Md->MemoryType == LoaderFree) || - (Md->MemoryType == LoaderLoadedProgram) || - (Md->MemoryType == LoaderFirmwareTemporary) || - (Md->MemoryType == LoaderOsloaderStack)) - { - /* Check if this is the largest memory descriptor */ - if (Md->PageCount > FreePages) - { - /* For now, it is */ - FreePages = Md->PageCount; - MiFreeDescriptor = Md; - } - } - } - } - - /* Save original values of the free descriptor, since it'll be - altered by early allocations */ - MiFreeDescriptorOrg = *MiFreeDescriptor; -} - -VOID -NTAPI -MiDbgKernelLayout(VOID) -{ - DPRINT1("%8s%12s\t\t%s\n", "Start", "End", "Type"); - DPRINT1("0x%p - 0x%p\t%s\n", - MmSystemRangeStart, (ULONG_PTR)MmSystemRangeStart + MmBootImageSize, - "Boot Image Mapping Region"); - DPRINT1("0x%p - 0x%p\t%s\n", - MmPfnDatabase, MmPfnDatabaseEnd, - "PFN Database region"); - DPRINT1("0x%p - 0x%p\t%s\n", - MiNonPagedPoolStart, (ULONG_PTR)MiNonPagedPoolStart + MiNonPagedPoolLength, - "Non paged pool region"); - DPRINT1("0x%p - 0x%p\t%s\n", - MmPagedPoolBase, (ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize, - "Paged pool region"); -} - -VOID -NTAPI MiDbgDumpMemoryDescriptors(VOID) { PLIST_ENTRY NextEntry; @@ -225,7 +139,12 @@ INIT_FUNCTION NTAPI MmInit1(VOID) -{ +{ + /* Initialize the kernel address space */ + KeInitializeGuardedMutex(&PsGetCurrentProcess()->AddressCreationLock); + MmKernelAddressSpace = MmGetCurrentAddressSpace(); + MmInitGlobalKernelPageDirectory(); + /* Dump memory descriptors */ if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors();
@@ -237,62 +156,46 @@ MmSystemRangeStart = (PVOID)KSEG0_BASE; MmUserProbeAddress = (ULONG_PTR)MmSystemRangeStart - 0x10000; MmHighestUserAddress = (PVOID)(MmUserProbeAddress - 1); - DPRINT("MmSystemRangeStart: %08x\n", MmSystemRangeStart); - DPRINT("MmUserProbeAddress: %08x\n", MmUserProbeAddress); - DPRINT("MmHighestUserAddress:%08x\n", MmHighestUserAddress); - - /* Count RAM */ - MiCountFreePagesInLoaderBlock(KeLoaderBlock); - DbgPrint("Used memory %dKb\n", (MmNumberOfPhysicalPages * PAGE_SIZE) / 1024); - - /* Initialize the kernel address space */ - KeInitializeGuardedMutex(&PsGetCurrentProcess()->AddressCreationLock); - MmKernelAddressSpace = MmGetCurrentAddressSpace(); - MmInitGlobalKernelPageDirectory(); - - /* We'll put the PFN array right after the loaded modules */ - MmPfnDatabase = (PVOID)((ULONG_PTR)MmSystemRangeStart + MmBootImageSize); - MmPfnDatabaseEnd = (ULONG_PTR)MmPfnDatabase + (MmHighestPhysicalPage * sizeof(MMPFN)); - MmPfnDatabaseEnd = PAGE_ROUND_UP(MmPfnDatabaseEnd); - - /* Put nonpaged pool after the PFN database */ - MiNonPagedPoolStart = (PVOID)MmPfnDatabaseEnd; - - /* Length of non-paged pool */ - MiNonPagedPoolLength = MM_NONPAGED_POOL_SIZE; - - /* Put the paged pool after the non-paged pool */ + + // + // Initialize ARM³ in phase 0 + // + MmArmInitSystem(0, KeLoaderBlock); + + /* Intialize system memory areas */ + MiInitSystemMemoryAreas(); + + /* Initialize the page list */ + MmInitializePageList(); + + // + // Initialize ARM³ in phase 1 + // + MmArmInitSystem(1, KeLoaderBlock); + // DEPRECATED + /* Put nonpaged pool after the loaded modules */ // DEPRECATED + MiNonPagedPoolStart = (PVOID)((ULONG_PTR)MmSystemRangeStart + // DEPRECATED + MmBootImageSize); // DEPRECATED + MiNonPagedPoolLength = MM_NONPAGED_POOL_SIZE; // DEPRECATED + // DEPRECATED + /* Initialize nonpaged pool */ // DEPRECATED + MiInitializeNonPagedPool(); // DEPRECATED + // DEPRECATED + // + // Initialize ARM³ in phase 2 + // + MmArmInitSystem(2, KeLoaderBlock); + + /* Put the paged pool after nonpaged pool */ MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MiNonPagedPoolStart + MiNonPagedPoolLength); MmPagedPoolSize = MM_PAGED_POOL_SIZE;
- /* Dump kernel memory layout */ - MiDbgKernelLayout(); - - /* Intialize system memory areas */ - MiInitSystemMemoryAreas(); - - /* Initialize the page list */ - MmInitializePageList(); - - // - // Initialize ARM³ in phase 0 - // - MmArmInitSystem(0, KeLoaderBlock); - - /* Initialize nonpaged pool */ - MiInitializeNonPagedPool(); - /* Initialize paged pool */ MmInitializePagedPool();
/* Initialize working sets */ MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory); - - // - // Initialize ARM³ in phase 1 - // - MmArmInitSystem(1, KeLoaderBlock); }
BOOLEAN