Sync with trunk (48237)
[reactos.git] / ntoskrnl / mm / i386 / page.c
index 96a97d9..8945ff2 100644 (file)
@@ -112,120 +112,12 @@ ProtectToPTE(ULONG flProtect)
     return(Attributes);
 }
 
-NTSTATUS
-NTAPI
-Mmi386ReleaseMmInfo(PEPROCESS Process)
-{
-    PUSHORT LdtDescriptor;
-    ULONG LdtBase;
-    PULONG PageDir;
-    ULONG i;
-    
-    DPRINT("Mmi386ReleaseMmInfo(Process %x)\n",Process);
-    
-    LdtDescriptor = (PUSHORT) &Process->Pcb.LdtDescriptor;
-    LdtBase = LdtDescriptor[1] |
-    ((LdtDescriptor[2] & 0xff) << 16) |
-    ((LdtDescriptor[3] & ~0xff) << 16);
-    
-    DPRINT("LdtBase: %x\n", LdtBase);
-    
-    if (LdtBase)
-    {
-        ExFreePool((PVOID) LdtBase);
-    }
-    
-    PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
-    for (i = 0; i < ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i++)
-    {
-        if (PageDir[i] != 0)
-        {
-            MiZeroPage(PTE_TO_PFN(PageDir[i]));
-            MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[i]));
-        }
-    }
-    MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)]));
-    MmDeleteHyperspaceMapping(PageDir);
-    MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
-
-    Process->Pcb.DirectoryTableBase[0] = 0;
-    Process->Pcb.DirectoryTableBase[1] = 0;
-
-    DPRINT("Finished Mmi386ReleaseMmInfo()\n");
-    return(STATUS_SUCCESS);
-}
-
-NTSTATUS
-NTAPI
-MmInitializeHandBuiltProcess(IN PEPROCESS Process,
-                             IN PULONG DirectoryTableBase)
-{
-    /* Share the directory base with the idle process */
-    DirectoryTableBase[0] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[0];
-    DirectoryTableBase[1] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[1];
-
-    /* Initialize the Addresss Space */
-    KeInitializeGuardedMutex(&Process->AddressCreationLock);
-    Process->Vm.WorkingSetExpansionLinks.Flink = NULL;
-    ASSERT(Process->VadRoot.NumberGenericTableElements == 0);
-    Process->VadRoot.BalancedRoot.u1.Parent = &Process->VadRoot.BalancedRoot;
-
-    /* The process now has an address space */
-    Process->HasAddressSpace = TRUE;
-    return STATUS_SUCCESS;
-}
-
-BOOLEAN
-NTAPI
-MmCreateProcessAddressSpace(IN ULONG MinWs,
-                            IN PEPROCESS Process,
-                            IN PULONG DirectoryTableBase)
-{
-    NTSTATUS Status;
-    ULONG i, j;
-    PFN_TYPE Pfn[2];
-    PULONG PageDirectory;
-    
-    DPRINT("MmCopyMmInfo(Src %x, Dest %x)\n", MinWs, Process);
-    
-    for (i = 0; i < 2; i++)
-    {
-        Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn[i]);
-        if (!NT_SUCCESS(Status))
-        {
-            for (j = 0; j < i; j++)
-            {
-                MmReleasePageMemoryConsumer(MC_NPPOOL, Pfn[j]);
-            }
-            
-            return FALSE;
-        }
-    }
-    
-    PageDirectory = MmCreateHyperspaceMapping(Pfn[0]);
-    
-    memcpy(PageDirectory + ADDR_TO_PDE_OFFSET(MmSystemRangeStart),
-           MmGlobalKernelPageDirectory + ADDR_TO_PDE_OFFSET(MmSystemRangeStart),
-           (1024 - ADDR_TO_PDE_OFFSET(MmSystemRangeStart)) * sizeof(ULONG));
-    
-    DPRINT("Addr %x\n",ADDR_TO_PDE_OFFSET(PAGETABLE_MAP));
-    PageDirectory[ADDR_TO_PDE_OFFSET(PAGETABLE_MAP)] = PFN_TO_PTE(Pfn[0]) | PA_PRESENT | PA_READWRITE;
-    PageDirectory[ADDR_TO_PDE_OFFSET(HYPERSPACE)] = PFN_TO_PTE(Pfn[1]) | PA_PRESENT | PA_READWRITE;
-    
-    MmDeleteHyperspaceMapping(PageDirectory);
-    
-    DirectoryTableBase[0] = PFN_TO_PTE(Pfn[0]);
-    DirectoryTableBase[1] = 0;
-    DPRINT("Finished MmCopyMmInfo(): 0x%x\n", DirectoryTableBase[0]);
-    return TRUE;
-}
-
 static PULONG
 MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
 {
     ULONG PdeOffset = ADDR_TO_PDE_OFFSET(Address);
     NTSTATUS Status;
-    PFN_TYPE Pfn;
+    PFN_NUMBER Pfn;
     ULONG Entry;
     PULONG Pt, PageDir;
     
@@ -344,7 +236,7 @@ static ULONG MmGetPageEntryForProcess(PEPROCESS Process, PVOID Address)
     return 0;
 }
 
-PFN_TYPE
+PFN_NUMBER
 NTAPI
 MmGetPfnForProcess(PEPROCESS Process,
                    PVOID Address)
@@ -360,7 +252,7 @@ MmGetPfnForProcess(PEPROCESS Process,
 
 VOID
 NTAPI
-MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPFN_TYPE Page)
+MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPFN_NUMBER Page)
 /*
  * FUNCTION: Delete a virtual mapping
  */
@@ -422,13 +314,13 @@ MmRawDeleteVirtualMapping(PVOID Address)
 VOID
 NTAPI
 MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN FreePage,
-                       BOOLEAN* WasDirty, PPFN_TYPE Page)
+                       BOOLEAN* WasDirty, PPFN_NUMBER Page)
 /*
  * FUNCTION: Delete a virtual mapping
  */
 {
     BOOLEAN WasValid = FALSE;
-    PFN_TYPE Pfn;
+    PFN_NUMBER Pfn;
     ULONG Pte;
     PULONG Pt;
     
@@ -701,7 +593,7 @@ NTAPI
 MmCreateVirtualMappingUnsafe(PEPROCESS Process,
                              PVOID Address,
                              ULONG flProtect,
-                             PPFN_TYPE Pages,
+                             PPFN_NUMBER Pages,
                              ULONG PageCount)
 {
     ULONG Attributes;
@@ -816,7 +708,7 @@ NTAPI
 MmCreateVirtualMapping(PEPROCESS Process,
                        PVOID Address,
                        ULONG flProtect,
-                       PPFN_TYPE Pages,
+                       PPFN_NUMBER Pages,
                        ULONG PageCount)
 {
     ULONG i;