[NTOS]: Reimplement MmCreateProcessAddressSpace in ARM3. Basically the same as before...
[reactos.git] / reactos / ntoskrnl / mm / i386 / page.c
index 3392772..8945ff2 100644 (file)
@@ -112,114 +112,6 @@ 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_PTR 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_NUMBER Pfn[2];
-    PULONG_PTR 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)
 {