[CMAKE]
[reactos.git] / ntoskrnl / include / internal / mm.h
index db7003d..7499571 100644 (file)
@@ -6,21 +6,17 @@
 
 struct _EPROCESS;
 
-extern ULONG MiFreeSwapPages;
-extern ULONG MiUsedSwapPages;
-extern ULONG MmPagedPoolSize;
-extern ULONG MmTotalPagedPoolQuota;
-extern ULONG MmTotalNonPagedPoolQuota;
+extern PFN_NUMBER MiFreeSwapPages;
+extern PFN_NUMBER MiUsedSwapPages;
+extern SIZE_T MmTotalPagedPoolQuota;
+extern SIZE_T MmTotalNonPagedPoolQuota;
 extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
-extern ULONG MmNumberOfPhysicalPages;
+extern PFN_NUMBER MmNumberOfPhysicalPages;
 extern UCHAR MmDisablePagingExecutive;
-extern ULONG MmLowestPhysicalPage;
-extern ULONG MmHighestPhysicalPage;
-extern ULONG MmAvailablePages;
-extern ULONG MmResidentAvailablePages;
-
-extern PVOID MmPagedPoolBase;
-extern ULONG MmPagedPoolSize;
+extern PFN_NUMBER MmLowestPhysicalPage;
+extern PFN_NUMBER MmHighestPhysicalPage;
+extern PFN_NUMBER MmAvailablePages;
+extern PFN_NUMBER MmResidentAvailablePages;
 
 extern PMEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptor;
 extern MEMORY_ALLOCATION_DESCRIPTOR MiFreeDescriptorOrg;
@@ -46,14 +42,14 @@ extern SIZE_T MmPagedPoolCommit;
 extern SIZE_T MmPeakCommitment;
 extern SIZE_T MmtotalCommitLimitMaximum;
 
-extern BOOLEAN MiDbgReadyForPhysical;
+extern PVOID MiDebugMapping;
+extern PMMPTE MmDebugPte;
 
 struct _KTRAP_FRAME;
 struct _EPROCESS;
 struct _MM_RMAP_ENTRY;
 struct _MM_PAGEOP;
 typedef ULONG SWAPENTRY;
-typedef ULONG PFN_TYPE, *PPFN_TYPE;
 
 //
 // MmDbgCopyMemory Flags
@@ -76,20 +72,8 @@ typedef ULONG PFN_TYPE, *PPFN_TYPE;
 #define MI_STATIC_MEMORY_AREAS              (13)
 #endif
 
-#define MEMORY_AREA_INVALID                 (0)
 #define MEMORY_AREA_SECTION_VIEW            (1)
-#define MEMORY_AREA_CONTINUOUS_MEMORY       (2)
-#define MEMORY_AREA_NO_CACHE                (3)
-#define MEMORY_AREA_IO_MAPPING              (4)
-#define MEMORY_AREA_SYSTEM                  (5)
-#define MEMORY_AREA_MDL_MAPPING             (7)
 #define MEMORY_AREA_VIRTUAL_MEMORY          (8)
-#define MEMORY_AREA_CACHE_SEGMENT           (9)
-#define MEMORY_AREA_SHARED_DATA             (10)
-#define MEMORY_AREA_KERNEL_STACK            (11)
-#define MEMORY_AREA_PAGED_POOL              (12)
-#define MEMORY_AREA_NO_ACCESS               (13)
-#define MEMORY_AREA_PEB_OR_TEB              (14)
 #define MEMORY_AREA_OWNED_BY_ARM3           (15)
 #define MEMORY_AREA_STATIC                  (0x80000000)
 
@@ -130,10 +114,8 @@ typedef ULONG PFN_TYPE, *PPFN_TYPE;
 
 #define MC_CACHE                            (0)
 #define MC_USER                             (1)
-#define MC_PPOOL                            (2)
-#define MC_NPPOOL                           (3)
-#define MC_SYSTEM                           (4)
-#define MC_MAXIMUM                          (5)
+#define MC_SYSTEM                           (2)
+#define MC_MAXIMUM                          (3)
 
 #define PAGED_POOL_MASK                     1
 #define MUST_SUCCEED_POOL_MASK              2
@@ -266,6 +248,8 @@ typedef struct _ROS_SECTION_OBJECT
     };
 } ROS_SECTION_OBJECT, *PROS_SECTION_OBJECT;
 
+struct _MM_CACHE_SECTION_SEGMENT;
+
 typedef struct _MEMORY_AREA
 {
     PVOID StartingAddress;
@@ -278,6 +262,7 @@ typedef struct _MEMORY_AREA
     ULONG Flags;
     BOOLEAN DeleteInProgress;
     ULONG PageOpCount;
+    PVOID Vad;
     union
     {
         struct
@@ -285,9 +270,13 @@ typedef struct _MEMORY_AREA
             ROS_SECTION_OBJECT* Section;
             ULONG ViewOffset;
             PMM_SECTION_SEGMENT Segment;
-            BOOLEAN WriteCopyView;
             LIST_ENTRY RegionListHead;
         } SectionData;
+               struct
+               {
+            LARGE_INTEGER ViewOffset;
+            struct _MM_CACHE_SECTION_SEGMENT *Segment;
+               } CacheData;
         struct
         {
             LIST_ENTRY RegionListHead;
@@ -295,6 +284,54 @@ typedef struct _MEMORY_AREA
     } Data;
 } MEMORY_AREA, *PMEMORY_AREA;
 
+typedef struct _MM_RMAP_ENTRY
+{
+   struct _MM_RMAP_ENTRY* Next;
+   PEPROCESS Process;
+   PVOID Address;
+#if DBG
+   PVOID Caller;
+#endif
+}
+MM_RMAP_ENTRY, *PMM_RMAP_ENTRY;
+
+#if MI_TRACE_PFNS
+extern ULONG MI_PFN_CURRENT_USAGE;
+extern CHAR MI_PFN_CURRENT_PROCESS_NAME[16];
+#define MI_SET_USAGE(x)     MI_PFN_CURRENT_USAGE = x
+#define MI_SET_PROCESS2(x)  memcpy(MI_PFN_CURRENT_PROCESS_NAME, x, 16)
+#else
+#define MI_SET_USAGE(x)
+#define MI_SET_PROCESS2(x)
+#endif
+
+typedef enum _MI_PFN_USAGES
+{
+    MI_USAGE_NOT_SET = 0,
+    MI_USAGE_PAGED_POOL,
+    MI_USAGE_NONPAGED_POOL,
+    MI_USAGE_NONPAGED_POOL_EXPANSION,
+    MI_USAGE_KERNEL_STACK,
+    MI_USAGE_KERNEL_STACK_EXPANSION,
+    MI_USAGE_SYSTEM_PTE,
+    MI_USAGE_VAD,
+    MI_USAGE_PEB_TEB,
+    MI_USAGE_SECTION,
+    MI_USAGE_PAGE_TABLE,
+    MI_USAGE_PAGE_DIRECTORY,
+    MI_USAGE_LEGACY_PAGE_DIRECTORY,
+    MI_USAGE_DRIVER_PAGE,
+    MI_USAGE_CONTINOUS_ALLOCATION,
+    MI_USAGE_MDL,
+    MI_USAGE_DEMAND_ZERO,
+    MI_USAGE_ZERO_LOOP,
+    MI_USAGE_CACHE,
+    MI_USAGE_PFN_DATABASE,
+    MI_USAGE_BOOT_DRIVER,
+    MI_USAGE_INIT_MEMORY,
+    MI_USAGE_FREE_PAGE
+} MI_PFN_USAGES;
+
 //
 // These two mappings are actually used by Windows itself, based on the ASSERTS
 //
@@ -306,30 +343,30 @@ typedef struct _MMPFNENTRY
     USHORT Modified:1;
     USHORT ReadInProgress:1;                 // StartOfAllocation
     USHORT WriteInProgress:1;                // EndOfAllocation
-    USHORT PrototypePte:1;                   // Zero
-    USHORT PageColor:4;                      // LockCount
-    USHORT PageLocation:3;                   // Consumer
+    USHORT PrototypePte:1;
+    USHORT PageColor:4;
+    USHORT PageLocation:3;
     USHORT RemovalRequested:1;
-    USHORT CacheAttribute:2;                 // Type
+    USHORT CacheAttribute:2;
     USHORT Rom:1;
-    USHORT ParityError:1;
+    USHORT ParityError:1;                    // HasRmap
 } MMPFNENTRY;
 
 typedef struct _MMPFN
 {
     union
     {
-        PFN_NUMBER Flink;                    // ListEntry.Flink
-        ULONG WsIndex;
+        PFN_NUMBER Flink;
+        ULONG WsIndex;                       // SavedSwapEntry
         PKEVENT Event;
         NTSTATUS ReadStatus;
         SINGLE_LIST_ENTRY NextStackPfn;
     } u1;
-    PMMPTE PteAddress;                       // ListEntry.Blink
+    PMMPTE PteAddress;
     union
     {
         PFN_NUMBER Blink;
-        ULONG_PTR ShareCount;                // MapCount
+        ULONG_PTR ShareCount;
     } u2;
     union
     {
@@ -351,7 +388,7 @@ typedef struct _MMPFN
     };
     union
     {
-        ULONG_PTR EntireFrame;               // SavedSwapEntry
+        ULONG_PTR EntireFrame;
         struct
         {
             ULONG_PTR PteFrame:25;
@@ -362,9 +399,13 @@ typedef struct _MMPFN
             ULONG_PTR MustBeCached:1;
         };
     } u4;
+#if MI_TRACE_PFNS
+    MI_PFN_USAGES PfnUsage;
+    CHAR ProcessName[16];
+#endif
 } MMPFN, *PMMPFN;
 
-extern PMMPFN MmPfnDatabase[2];
+extern PMMPFN MmPfnDatabase;
 
 typedef struct _MMPFNLIST
 {
@@ -435,6 +476,9 @@ typedef struct _MMFREE_POOL_ENTRY
     struct _MMFREE_POOL_ENTRY *Owner;
 } MMFREE_POOL_ENTRY, *PMMFREE_POOL_ENTRY;
 
+/* Signature of a freed block */
+#define MM_FREE_POOL_SIGNATURE 'ARM3'
+
 /* Paged pool information */
 typedef struct _MM_PAGED_POOL_INFO
 {
@@ -466,7 +510,7 @@ typedef VOID
     PVOID Context,
     PMEMORY_AREA MemoryArea,
     PVOID Address,
-    PFN_TYPE Page,
+    PFN_NUMBER Page,
     SWAPENTRY SwapEntry,
     BOOLEAN Dirty
 );
@@ -688,7 +732,7 @@ VOID
 NTAPI
 MmBuildMdlFromPages(
     PMDL Mdl,
-    PULONG Pages
+    PPFN_NUMBER Pages
 );
 
 /* mminit.c ******************************************************************/
@@ -738,7 +782,7 @@ NTSTATUS
 NTAPI
 MmReadFromSwapPage(
     SWAPENTRY SwapEntry,
-    PFN_TYPE Page
+    PFN_NUMBER Page
 );
 
 BOOLEAN
@@ -749,7 +793,7 @@ NTSTATUS
 NTAPI
 MmWriteToSwapPage(
     SWAPENTRY SwapEntry,
-    PFN_TYPE Page
+    PFN_NUMBER Page
 );
 
 NTSTATUS
@@ -875,7 +919,7 @@ MmQueryAnonMem(
     PMEMORY_AREA MemoryArea,
     PVOID Address,
     PMEMORY_BASIC_INFORMATION Info,
-    PULONG ResultLength
+    PSIZE_T ResultLength
 );
 
 VOID
@@ -917,18 +961,18 @@ ExUnmapPage(PVOID Addr);
 
 PVOID
 NTAPI
-ExAllocatePageWithPhysPage(PFN_TYPE Page);
+ExAllocatePageWithPhysPage(PFN_NUMBER Page);
 
 NTSTATUS
 NTAPI
 MiCopyFromUserPage(
-    PFN_TYPE Page,
+    PFN_NUMBER Page,
     PVOID SourceAddress
 );
 
 NTSTATUS
 NTAPI
-MiZeroPage(PFN_TYPE Page);
+MiZeroPage(PFN_NUMBER Page);
 
 /* memsafe.s *****************************************************************/
 
@@ -999,7 +1043,7 @@ NTSTATUS
 NTAPI
 MmReleasePageMemoryConsumer(
     ULONG Consumer,
-    PFN_TYPE Page
+    PFN_NUMBER Page
 );
 
 NTSTATUS
@@ -1007,7 +1051,7 @@ NTAPI
 MmRequestPageMemoryConsumer(
     ULONG Consumer,
     BOOLEAN MyWait,
-    PPFN_TYPE AllocatedPage
+    PPFN_NUMBER AllocatedPage
 );
 
 VOID
@@ -1023,18 +1067,18 @@ MmRebalanceMemoryConsumers(VOID);
 VOID
 NTAPI
 MmSetRmapListHeadPage(
-    PFN_TYPE Page,
+    PFN_NUMBER Page,
     struct _MM_RMAP_ENTRY* ListHead
 );
 
 struct _MM_RMAP_ENTRY*
 NTAPI
-MmGetRmapListHeadPage(PFN_TYPE Page);
+MmGetRmapListHeadPage(PFN_NUMBER Page);
 
 VOID
 NTAPI
 MmInsertRmap(
-    PFN_TYPE Page,
+    PFN_NUMBER Page,
     struct _EPROCESS *Process,
     PVOID Address
 );
@@ -1042,7 +1086,7 @@ MmInsertRmap(
 VOID
 NTAPI
 MmDeleteAllRmaps(
-    PFN_TYPE Page,
+    PFN_NUMBER Page,
     PVOID Context,
     VOID (*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address)
 );
@@ -1050,7 +1094,7 @@ MmDeleteAllRmaps(
 VOID
 NTAPI
 MmDeleteRmap(
-    PFN_TYPE Page,
+    PFN_NUMBER Page,
     struct _EPROCESS *Process,
     PVOID Address
 );
@@ -1061,29 +1105,29 @@ MmInitializeRmapList(VOID);
 
 VOID
 NTAPI
-MmSetCleanAllRmaps(PFN_TYPE Page);
+MmSetCleanAllRmaps(PFN_NUMBER Page);
 
 VOID
 NTAPI
-MmSetDirtyAllRmaps(PFN_TYPE Page);
+MmSetDirtyAllRmaps(PFN_NUMBER Page);
 
 BOOLEAN
 NTAPI
-MmIsDirtyPageRmap(PFN_TYPE Page);
+MmIsDirtyPageRmap(PFN_NUMBER Page);
 
 NTSTATUS
 NTAPI
-MmWritePagePhysicalAddress(PFN_TYPE Page);
+MmWritePagePhysicalAddress(PFN_NUMBER Page);
 
 NTSTATUS
 NTAPI
-MmPageOutPhysicalAddress(PFN_TYPE Page);
+MmPageOutPhysicalAddress(PFN_NUMBER Page);
 
 /* freelist.c **********************************************************/
 
 FORCEINLINE
 PMMPFN
-MiGetPfnEntry(IN PFN_TYPE Pfn)
+MiGetPfnEntry(IN PFN_NUMBER Pfn)
 {
     PMMPFN Page;
     extern RTL_BITMAP MiPfnBitMap;
@@ -1095,7 +1139,7 @@ MiGetPfnEntry(IN PFN_TYPE Pfn)
     if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, Pfn))) return NULL;
 
     /* Get the entry */
-    Page = &MmPfnDatabase[0][Pfn];
+    Page = &MmPfnDatabase[Pfn];
 
     /* Return it */
     return Page;
@@ -1108,36 +1152,36 @@ MiGetPfnEntryIndex(IN PMMPFN Pfn1)
     //
     // This will return the Page Frame Number (PFN) from the MMPFN
     //
-    return Pfn1 - MmPfnDatabase[0];
+    return Pfn1 - MmPfnDatabase;
 }
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
-MmGetLRUNextUserPage(PFN_TYPE PreviousPage);
+MmGetLRUNextUserPage(PFN_NUMBER PreviousPage);
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
 MmGetLRUFirstUserPage(VOID);
 
 VOID
 NTAPI
-MmInsertLRULastUserPage(PFN_TYPE Page);
+MmInsertLRULastUserPage(PFN_NUMBER Page);
 
 VOID
 NTAPI
-MmRemoveLRUUserPage(PFN_TYPE Page);
+MmRemoveLRUUserPage(PFN_NUMBER Page);
 
 VOID
 NTAPI
-MmLockPage(PFN_TYPE Page);
+MmLockPage(PFN_NUMBER Page);
 
 VOID
 NTAPI
-MmUnlockPage(PFN_TYPE Page);
+MmUnlockPage(PFN_NUMBER Page);
 
 ULONG
 NTAPI
-MmGetLockCountPage(PFN_TYPE Page);
+MmGetLockCountPage(PFN_NUMBER Page);
 
 VOID
 NTAPI
@@ -1147,11 +1191,11 @@ MmInitializePageList(
 
 VOID
 NTAPI
-MmDumpPfnDatabase(
-   VOID
+MmDumpArmPfnDatabase(
+   IN BOOLEAN StatusOnly
 );
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
 MmGetContinuousPages(
     ULONG NumberOfBytes,
@@ -1161,10 +1205,10 @@ MmGetContinuousPages(
     BOOLEAN ZeroPages
 );
 
-NTSTATUS
+VOID
 NTAPI
-MmZeroPageThreadMain(
-    PVOID Context
+MmZeroPageThread(
+    VOID
 );
 
 /* hypermap.c *****************************************************************/
@@ -1186,7 +1230,7 @@ MiUnmapPageInHyperSpace(IN PEPROCESS Process,
 
 PVOID
 NTAPI
-MiMapPagesToZeroInHyperSpace(IN PMMPFN *Pages,
+MiMapPagesToZeroInHyperSpace(IN PMMPFN Pfn1,
                              IN PFN_NUMBER NumberOfPages);
 
 VOID
@@ -1205,14 +1249,6 @@ MmCreateHyperspaceMapping(IN PFN_NUMBER Page)
     return MiMapPageInHyperSpace(HyperProcess, Page, &HyperIrql);
 }
 
-FORCEINLINE
-PVOID
-MiMapPageToZeroInHyperSpace(IN PFN_NUMBER Page)
-{
-    PMMPFN Pfn1 = MiGetPfnEntry(Page);
-    return MiMapPagesToZeroInHyperSpace(&Pfn1, 1);
-}
-
 #define MmDeleteHyperspaceMapping(x) MiUnmapPageInHyperSpace(HyperProcess, x, HyperIrql);
 
 /* i386/page.c *********************************************************/
@@ -1222,7 +1258,7 @@ NTAPI
 MmCreateVirtualMappingForKernel(
     PVOID Address,
     ULONG flProtect,
-    PPFN_TYPE Pages,
+    PPFN_NUMBER Pages,
     ULONG PageCount
 );
 
@@ -1239,7 +1275,7 @@ MmCreateVirtualMapping(
     struct _EPROCESS* Process,
     PVOID Address,
     ULONG flProtect,
-    PPFN_TYPE Pages,
+    PPFN_NUMBER Pages,
     ULONG PageCount
 );
 
@@ -1249,7 +1285,7 @@ MmCreateVirtualMappingUnsafe(
     struct _EPROCESS* Process,
     PVOID Address,
     ULONG flProtect,
-    PPFN_TYPE Pages,
+    PPFN_NUMBER Pages,
     ULONG PageCount
 );
 
@@ -1284,7 +1320,7 @@ MmDisableVirtualMapping(
     struct _EPROCESS *Process,
     PVOID Address,
     BOOLEAN* WasDirty,
-    PPFN_TYPE Page
+    PPFN_NUMBER Page
 );
 
 VOID
@@ -1298,6 +1334,14 @@ VOID
 NTAPI
 MmRawDeleteVirtualMapping(PVOID Address);
 
+
+VOID
+NTAPI
+MmGetPageFileMapping(
+       struct _EPROCESS *Process, 
+       PVOID Address,
+       SWAPENTRY* SwapEntry);
+
 VOID
 NTAPI
 MmDeletePageFileMapping(
@@ -1324,7 +1368,7 @@ MmIsPageSwapEntry(
 VOID
 NTAPI
 MmTransferOwnershipPage(
-    PFN_TYPE Page,
+    PFN_NUMBER Page,
     ULONG NewConsumer
 );
 
@@ -1335,7 +1379,7 @@ MmSetDirtyPage(
     PVOID Address
 );
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
 MmAllocPage(
     ULONG Consumer
@@ -1348,34 +1392,34 @@ MmAllocPagesSpecifyRange(
     PHYSICAL_ADDRESS LowestAddress,
     PHYSICAL_ADDRESS HighestAddress,
     ULONG NumberOfPages,
-    PPFN_TYPE Pages
+    PPFN_NUMBER Pages
 );
 
 VOID
 NTAPI
-MmDereferencePage(PFN_TYPE Page);
+MmDereferencePage(PFN_NUMBER Page);
 
 VOID
 NTAPI
-MmReferencePage(PFN_TYPE Page);
+MmReferencePage(PFN_NUMBER Page);
 
 ULONG
 NTAPI
-MmGetReferenceCountPage(PFN_TYPE Page);
+MmGetReferenceCountPage(PFN_NUMBER Page);
 
 BOOLEAN
 NTAPI
-MmIsPageInUse(PFN_TYPE Page);
+MmIsPageInUse(PFN_NUMBER Page);
 
 VOID
 NTAPI
 MmSetSavedSwapEntryPage(
-    PFN_TYPE Page,
+    PFN_NUMBER Page,
     SWAPENTRY SavedSwapEntry);
 
 SWAPENTRY
 NTAPI
-MmGetSavedSwapEntryPage(PFN_TYPE Page);
+MmGetSavedSwapEntryPage(PFN_NUMBER Page);
 
 VOID
 NTAPI
@@ -1395,7 +1439,7 @@ MmDeletePageTable(
     PVOID Address
 );
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
 MmGetPfnForProcess(
     struct _EPROCESS *Process,
@@ -1407,14 +1451,14 @@ NTAPI
 MmCreateProcessAddressSpace(
     IN ULONG MinWs,
     IN PEPROCESS Dest,
-    IN PULONG DirectoryTableBase
+    IN PULONG_PTR DirectoryTableBase
 );
 
 NTSTATUS
 NTAPI
 MmInitializeHandBuiltProcess(
     IN PEPROCESS Process,
-    IN PULONG DirectoryTableBase
+    IN PULONG_PTR DirectoryTableBase
 );
 
 
@@ -1439,7 +1483,7 @@ MmDeleteVirtualMapping(
     PVOID Address,
     BOOLEAN FreePage,
     BOOLEAN* WasDirty,
-    PPFN_TYPE Page
+    PPFN_NUMBER Page
 );
 
 BOOLEAN
@@ -1451,11 +1495,11 @@ MmIsDirtyPage(
 
 VOID
 NTAPI
-MmMarkPageMapped(PFN_TYPE Page);
+MmMarkPageMapped(PFN_NUMBER Page);
 
 VOID
 NTAPI
-MmMarkPageUnmapped(PFN_TYPE Page);
+MmMarkPageUnmapped(PFN_NUMBER Page);
 
 VOID
 NTAPI
@@ -1520,7 +1564,7 @@ MmFindRegion(
 PFILE_OBJECT
 NTAPI
 MmGetFileObjectForSection(
-    IN PROS_SECTION_OBJECT Section
+    IN PVOID Section
 );
 NTSTATUS
 NTAPI
@@ -1532,7 +1576,7 @@ MmGetFileNameForAddress(
 NTSTATUS
 NTAPI
 MmGetFileNameForSection(
-    IN PROS_SECTION_OBJECT Section,
+    IN PVOID Section,
     OUT POBJECT_NAME_INFORMATION *ModuleName
 );
 
@@ -1549,7 +1593,7 @@ MmQuerySectionView(
     PMEMORY_AREA MemoryArea,
     PVOID Address,
     PMEMORY_BASIC_INFORMATION Info,
-    PULONG ResultLength
+    PSIZE_T ResultLength
 );
 
 NTSTATUS
@@ -1642,8 +1686,8 @@ MiQueryVirtualMemory(
     IN PVOID Address,
     IN MEMORY_INFORMATION_CLASS VirtualMemoryInformationClass,
     OUT PVOID VirtualMemoryInformation,
-    IN ULONG Length,
-    OUT PULONG ResultLength
+    IN SIZE_T Length,
+    OUT PSIZE_T ResultLength
 );
 
 /* sysldr.c ******************************************************************/
@@ -1691,20 +1735,6 @@ MmCallDllInitialize(
     IN PLIST_ENTRY ListHead
 );
 
-/* ReactOS Mm Hacks */
-VOID
-FASTCALL
-MiSyncForProcessAttach(
-    IN PKTHREAD NextThread,
-    IN PEPROCESS Process
-);
-
-VOID
-FASTCALL
-MiSyncForContextSwitch(
-    IN PKTHREAD Thread
-);
-
 extern PMMSUPPORT MmKernelAddressSpace;
 
 FORCEINLINE