/* GLOBALS *******************************************************************/
+VOID NTAPI MiInitializeUserPfnBitmap(VOID);
+
PCHAR
MemType[] =
{
"LoaderXIPRom "
};
+HANDLE MpwThreadHandle;
+KEVENT MpwThreadEvent;
+
BOOLEAN Mm64BitPhysicalAddress = FALSE;
ULONG MmReadClusterSize;
//
BoundaryAddressMultiple);
ASSERT(Status == STATUS_SUCCESS);
- //
- // And now, ReactOS paged pool
- //
- BaseAddress = MmPagedPoolBase;
- 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
//
#if defined(_X86_)
//
- // Finally, reserve the 2 pages we currently make use of for HAL mappings
+ // Finally, reserve the 2 pages we currently make use of for HAL mappings
//
BaseAddress = (PVOID)0xFFC00000;
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
MmSystemRangeStart,
(ULONG_PTR)MmSystemRangeStart + MmBootImageSize,
"Boot Loaded Image");
- DPRINT1(" 0x%p - 0x%p\t%s\n",
- MmPagedPoolBase,
- (ULONG_PTR)MmPagedPoolBase + MmPagedPoolSize,
- "Paged Pool");
DPRINT1(" 0x%p - 0x%p\t%s\n",
MmPfnDatabase,
(ULONG_PTR)MmPfnDatabase + (MxPfnAllocation << PAGE_SHIFT),
DPRINT1("Total: %08lX (%d MB)\n", TotalPages, (TotalPages * PAGE_SIZE) / 1024 / 1024);
}
-VOID NTAPI MiInitializeUserPfnBitmap(VOID);
+NTSTATUS NTAPI
+MmMpwThreadMain(PVOID Ignored)
+{
+ NTSTATUS Status;
+ ULONG PagesWritten;
+ LARGE_INTEGER Timeout;
+
+ Timeout.QuadPart = -50000000;
+
+ for(;;)
+ {
+ Status = KeWaitForSingleObject(&MpwThreadEvent,
+ 0,
+ KernelMode,
+ FALSE,
+ &Timeout);
+ if (!NT_SUCCESS(Status))
+ {
+ DbgPrint("MpwThread: Wait failed\n");
+ KeBugCheck(MEMORY_MANAGEMENT);
+ return(STATUS_UNSUCCESSFUL);
+ }
+
+ PagesWritten = 0;
+
+ CcRosFlushDirtyPages(128, &PagesWritten);
+ }
+}
+
+NTSTATUS
+NTAPI
+MmInitMpwThread(VOID)
+{
+ KPRIORITY Priority;
+ NTSTATUS Status;
+ CLIENT_ID MpwThreadId;
+
+ KeInitializeEvent(&MpwThreadEvent, SynchronizationEvent, FALSE);
+
+ Status = PsCreateSystemThread(&MpwThreadHandle,
+ THREAD_ALL_ACCESS,
+ NULL,
+ NULL,
+ &MpwThreadId,
+ (PKSTART_ROUTINE) MmMpwThreadMain,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+
+ Priority = 27;
+ NtSetInformationThread(MpwThreadHandle,
+ ThreadPriority,
+ &Priority,
+ sizeof(Priority));
+
+ return(STATUS_SUCCESS);
+}
+
+NTSTATUS
+NTAPI
+MmInitBsmThread(VOID)
+{
+ NTSTATUS Status;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ HANDLE ThreadHandle;
+
+ /* Create the thread */
+ InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL);
+ Status = PsCreateSystemThread(&ThreadHandle,
+ THREAD_ALL_ACCESS,
+ &ObjectAttributes,
+ NULL,
+ NULL,
+ KeBalanceSetManager,
+ NULL);
+
+ /* Close the handle and return status */
+ ZwClose(ThreadHandle);
+ return Status;
+}
BOOLEAN
NTAPI
/* Initialize ARMĀ³ in phase 0 */
MmArmInitSystem(0, KeLoaderBlock);
-
- /* Put the paged pool after the loaded modules */
- MmPagedPoolBase = (PVOID)PAGE_ROUND_UP((ULONG_PTR)MmSystemRangeStart +
- MmBootImageSize);
- MmPagedPoolSize = MM_PAGED_POOL_SIZE;
-
+
/* Intialize system memory areas */
MiInitSystemMemoryAreas();
}
else if (Phase == 1)
{
- MmInitializePagedPool();
MiInitializeUserPfnBitmap();
MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory);
MmInitializeRmapList();