"LoaderXIPRom "
};
-PBOOLEAN Mm64BitPhysicalAddress = FALSE;
+BOOLEAN Mm64BitPhysicalAddress = FALSE;
ULONG MmReadClusterSize;
//
// 0 | 1 is on/off paging, 2 is undocumented
UCHAR MmDisablePagingExecutive = 1; // Forced to off
PMMPTE MmSharedUserDataPte;
PMMSUPPORT MmKernelAddressSpace;
-extern KMUTANT MmSystemLoadLock;
BOOLEAN MiDbgEnableMdDump =
#ifdef _ARM_
TRUE;
// And now, ReactOS paged pool
//
BaseAddress = MmPagedPoolBase;
- MmCreateMemoryArea(MmGetKernelAddressSpace(),
- MEMORY_AREA_PAGED_POOL | MEMORY_AREA_STATIC,
- &BaseAddress,
- MmPagedPoolSize,
- PAGE_READWRITE,
- &MArea,
- TRUE,
- 0,
- BoundaryAddressMultiple);
+ Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
+ MEMORY_AREA_PAGED_POOL | MEMORY_AREA_STATIC,
+ &BaseAddress,
+ MmPagedPoolSize,
+ PAGE_READWRITE,
+ &MArea,
+ TRUE,
+ 0,
+ BoundaryAddressMultiple);
+ ASSERT(Status == STATUS_SUCCESS);
//
// Next, the KPCR
//
BaseAddress = (PVOID)PCR;
- MmCreateMemoryArea(MmGetKernelAddressSpace(),
- MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
- &BaseAddress,
- PAGE_SIZE * KeNumberProcessors,
- PAGE_READWRITE,
- &MArea,
- TRUE,
- 0,
- BoundaryAddressMultiple);
+ Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
+ MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
+ &BaseAddress,
+ PAGE_SIZE * KeNumberProcessors,
+ PAGE_READWRITE,
+ &MArea,
+ TRUE,
+ 0,
+ BoundaryAddressMultiple);
+ ASSERT(Status == STATUS_SUCCESS);
//
// Now the KUSER_SHARED_DATA
//
BaseAddress = (PVOID)KI_USER_SHARED_DATA;
- MmCreateMemoryArea(MmGetKernelAddressSpace(),
- MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
- &BaseAddress,
- PAGE_SIZE,
- PAGE_READWRITE,
- &MArea,
- TRUE,
- 0,
- BoundaryAddressMultiple);
+ Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
+ MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
+ &BaseAddress,
+ PAGE_SIZE,
+ PAGE_READWRITE,
+ &MArea,
+ TRUE,
+ 0,
+ BoundaryAddressMultiple);
+ ASSERT(Status == STATUS_SUCCESS);
+
+ //
+ // And the debugger mapping
+ //
+ BaseAddress = MI_DEBUG_MAPPING;
+ Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
+ MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
+ &BaseAddress,
+ PAGE_SIZE,
+ PAGE_READWRITE,
+ &MArea,
+ TRUE,
+ 0,
+ BoundaryAddressMultiple);
+ ASSERT(Status == STATUS_SUCCESS);
+
+#if defined(_X86_)
+ //
+ // Finally, reserve the 2 pages we currently make use of for HAL mappings
+ //
+ BaseAddress = (PVOID)0xFFC00000;
+ Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
+ MEMORY_AREA_OWNED_BY_ARM3 | MEMORY_AREA_STATIC,
+ &BaseAddress,
+ PAGE_SIZE * 2,
+ PAGE_READWRITE,
+ &MArea,
+ TRUE,
+ 0,
+ BoundaryAddressMultiple);
+ ASSERT(Status == STATUS_SUCCESS);
+#endif
}
VOID
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)
/* Dump memory descriptors */
if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors();
- //
- // Initialize ARM³ in phase 0
- //
+ /* Initialize ARM³ in phase 0 */
MmArmInitSystem(0, KeLoaderBlock);
- /* Initialize the page list */
- MmInitializePageList();
-
- //
- // Initialize ARM³ in phase 1
- //
- MmArmInitSystem(1, KeLoaderBlock);
-
/* Put the paged pool after the loaded modules */
MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MmSystemRangeStart +
MmBootImageSize);
/* 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;
}
else if (Phase == 1)
{
+ MmInitializePagedPool();
+ MiInitializeUserPfnBitmap();
+ MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
MmInitializeRmapList();
MmInitializePageOp();
MmInitSectionImplementation();
TempPte.u.Hard.PageFrameNumber = PageFrameNumber;
*MmSharedUserDataPte = TempPte;
+ /* Setup the memory threshold events */
+ if (!MiInitializeMemoryEvents()) return FALSE;
+
/*
* Unmap low memory
*/
}
else if (Phase == 2)
{
-
+ /* Enough fun for now */
+ extern BOOLEAN AllowPagedPool;
+ AllowPagedPool = FALSE;
}
return TRUE;