"LoaderXIPRom "
};
-PBOOLEAN Mm64BitPhysicalAddress = FALSE;
+BOOLEAN Mm64BitPhysicalAddress = FALSE;
ULONG MmReadClusterSize;
//
// 0 | 1 is on/off paging, 2 is undocumented
//
// Protect the PFN database
//
- BaseAddress = MmPfnDatabase;
+ BaseAddress = MmPfnDatabase[0];
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
&BaseAddress,
(ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize,
"Paged Pool");
DPRINT1(" 0x%p - 0x%p\t%s\n",
- MmPfnDatabase,
- (ULONG_PTR)MmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT),
+ MmPfnDatabase[0],
+ (ULONG_PTR)MmPfnDatabase[0] + (MxPfnAllocation << PAGE_SHIFT),
"PFN Database");
DPRINT1(" 0x%p - 0x%p\t%s\n",
MmNonPagedPoolStart,
DPRINT1("Total: %08lX (%d MB)\n", TotalPages, (TotalPages * PAGE_SIZE) / 1024 / 1024);
}
+VOID NTAPI MiInitializeUserPfnBitmap(VOID);
+
BOOLEAN
NTAPI
MmInitSystem(IN ULONG Phase,
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
{
- extern MMPTE HyperTemplatePte;
+ extern MMPTE ValidKernelPte;
PMMPTE PointerPte;
- MMPTE TempPte = HyperTemplatePte;
+ MMPTE TempPte = ValidKernelPte;
PFN_NUMBER PageFrameNumber;
if (Phase == 0)
// Initialize ARMĀ³ in phase 0
//
MmArmInitSystem(0, KeLoaderBlock);
-
- /* Initialize the page list */
- MmInitializePageList();
-
- //
- // Initialize ARMĀ³ in phase 1
- //
- MmArmInitSystem(1, KeLoaderBlock);
#if defined(_WINKD_)
//
/* Intialize system memory areas */
MiInitSystemMemoryAreas();
-
- //
- // STEP 1: Allocate and free a single page, repeatedly
- // We should always get the same address back
- //
- if (1)
- {
- PULONG Test, OldTest;
- ULONG i;
-
- OldTest = Test = MiAllocatePoolPages(PagedPool, PAGE_SIZE);
- ASSERT(Test);
- for (i = 0; i < 16; i++)
- {
- MiFreePoolPages(Test);
- Test = MiAllocatePoolPages(PagedPool, PAGE_SIZE);
- ASSERT(OldTest == Test);
- }
- MiFreePoolPages(Test);
- }
-
- //
- // STEP 2: Allocate 2048 pages without freeing them
- // We should run out of space at 1024 pages, since we don't support
- // expansion yet.
- //
- if (1)
- {
- PULONG Test[2048];
- ULONG i;
-
- for (i = 0; i < 2048; i++)
- {
- Test[i] = MiAllocatePoolPages(PagedPool, PAGE_SIZE);
- if (!Test[i])
- {
- ASSERT(i == 1024);
- break;
- }
- }
-
- //
- // Cleanup
- //
- while (--i) if (Test[i]) MiFreePoolPages(Test[i]);
- }
-
- //
- // STEP 3: Allocate a page and touch it.
- // We should get an ARM3 page fault and it should handle the fault
- //
- if (1)
- {
- PULONG Test;
-
- Test = MiAllocatePoolPages(PagedPool, PAGE_SIZE);
- ASSERT(*Test == 0);
- MiFreePoolPages(Test);
- }
-
+
/* Dump the address space */
MiDbgDumpAddressSpace();
/* Initialize paged pool */
MmInitializePagedPool();
- /* Initialize working sets */
- MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
-
- /* Initialize the user mode image list */
- InitializeListHead(&MmLoadedUserImageList);
-
- /* Initialize the Loader Lock */
- KeInitializeMutant(&MmSystemLoadLock, FALSE);
-
- /* Reload boot drivers */
- MiReloadBootLoadedDrivers(LoaderBlock);
-
/* Initialize the loaded module list */
MiInitializeLoadedModuleList(LoaderBlock);
-
- /* Setup shared user data settings that NT does as well */
- ASSERT(SharedUserData->NumberOfPhysicalPages == 0);
- SharedUserData->NumberOfPhysicalPages = MmNumberOfPhysicalPages;
- SharedUserData->LargePageMinimum = 0;
- /* For now, we assume that we're always Server */
- SharedUserData->NtProductType = NtProductServer;
+ /* Initialize working sets */
+ MiInitializeUserPfnBitmap();
+ MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
}
else if (Phase == 1)
{
TempPte.u.Hard.PageFrameNumber = PageFrameNumber;
*MmSharedUserDataPte = TempPte;
+ /* Setup the memory threshold events */
+ if (!MiInitializeMemoryEvents()) return FALSE;
+
/*
* Unmap low memory
*/