Commit in reactos/ntoskrnl on MAIN
include/internal/mm.h-41.79 -> 1.80
mm/iospace.c+1-21.27 -> 1.28
  /marea.c+24-171.61 -> 1.62
  /pagefile.c+5-41.44 -> 1.45
mm/i386/page.c+8-801.65 -> 1.66
+38-107
5 modified files
- Do not change the mapping count of a page if the physical address falls 
  in the range of valid physical memory (in MmMapIoSpace and MmUnmapIoSpace).

reactos/ntoskrnl/include/internal
mm.h 1.79 -> 1.80
diff -u -r1.79 -r1.80
--- mm.h	22 Apr 2004 01:57:28 -0000	1.79
+++ mm.h	20 May 2004 08:37:20 -0000	1.80
@@ -669,9 +669,5 @@
 MmRawDeleteVirtualMapping(PVOID Address);
 VOID
 MiStopPagerThread(VOID);
-NTSTATUS 
-MmCreateVirtualMappingDump(PVOID Address, 
-			   ULONG flProtect,
-			   PHYSICAL_ADDRESS PhysicalAddress);
 
 #endif

reactos/ntoskrnl/mm
iospace.c 1.27 -> 1.28
diff -u -r1.27 -r1.28
--- iospace.c	15 May 2004 22:45:49 -0000	1.27
+++ iospace.c	20 May 2004 08:37:20 -0000	1.28
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: iospace.c,v 1.27 2004/05/15 22:45:49 hbirr Exp $
+/* $Id: iospace.c,v 1.28 2004/05/20 08:37:20 hbirr Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/mm/iospace.c
@@ -126,7 +126,6 @@
          DbgPrint("Unable to create virtual mapping\n");
          KEBUGCHECK(0);
       }
-      MmMarkPageMapped(PhysicalAddress);
    }
    return ((PVOID)((char*)Result + Offset));
 }

reactos/ntoskrnl/mm
marea.c 1.61 -> 1.62
diff -u -r1.61 -r1.62
--- marea.c	10 Apr 2004 22:35:25 -0000	1.61
+++ marea.c	20 May 2004 08:37:20 -0000	1.62
@@ -395,28 +395,35 @@
       PHYSICAL_ADDRESS PhysAddr = { 0 };
 #endif
 
-      BOOL Dirty = FALSE;
-      SWAPENTRY SwapEntry = 0;
-
-      if (MmIsPageSwapEntry(AddressSpace->Process,
-                            (char*)MemoryArea->BaseAddress + (i * PAGE_SIZE)))
+      if (MemoryArea->Type == MEMORY_AREA_IO_MAPPING)
       {
-         MmDeletePageFileMapping(AddressSpace->Process,
-                                 (char*)MemoryArea->BaseAddress + (i * PAGE_SIZE),
-                                 &SwapEntry);
+         MmRawDeleteVirtualMapping((char*)MemoryArea->BaseAddress + (i * PAGE_SIZE));
       }
       else
       {
-         MmDeleteVirtualMapping(AddressSpace->Process,
-                                (char*)MemoryArea->BaseAddress + (i*PAGE_SIZE),
-                                FALSE, &Dirty, &PhysAddr);
+	 BOOL Dirty = FALSE;
+         SWAPENTRY SwapEntry = 0;
 
-      }
-      if (FreePage != NULL)
-      {
-         FreePage(FreePageContext, MemoryArea,
-                  (char*)MemoryArea->BaseAddress + (i * PAGE_SIZE), PhysAddr,
-                  SwapEntry, (BOOLEAN)Dirty);
+         if (MmIsPageSwapEntry(AddressSpace->Process,
+                               (char*)MemoryArea->BaseAddress + (i * PAGE_SIZE)))
+         {
+            MmDeletePageFileMapping(AddressSpace->Process,
+                                    (char*)MemoryArea->BaseAddress + (i * PAGE_SIZE),
+                                    &SwapEntry);
+         }
+         else
+         {
+            MmDeleteVirtualMapping(AddressSpace->Process,
+                                   (char*)MemoryArea->BaseAddress + (i*PAGE_SIZE),
+                                   FALSE, &Dirty, &PhysAddr);
+
+         }
+         if (FreePage != NULL)
+         {
+            FreePage(FreePageContext, MemoryArea,
+                     (char*)MemoryArea->BaseAddress + (i * PAGE_SIZE), PhysAddr,
+                     SwapEntry, (BOOLEAN)Dirty);
+         }
       }
    }
    if (AddressSpace->Process != NULL &&

reactos/ntoskrnl/mm
pagefile.c 1.44 -> 1.45
diff -u -r1.44 -r1.45
--- pagefile.c	22 Apr 2004 01:57:49 -0000	1.44
+++ pagefile.c	20 May 2004 08:37:20 -0000	1.45
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: pagefile.c,v 1.44 2004/04/22 01:57:49 jimtabor Exp $
+/* $Id: pagefile.c,v 1.45 2004/05/20 08:37:20 hbirr Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/mm/pagefile.c
@@ -587,9 +587,9 @@
          LARGE_INTEGER PhysicalAddress;
          PhysicalAddress.QuadPart = i * PAGE_SIZE;
          MdlMap[0] = i * PAGE_SIZE;
-         MmCreateVirtualMappingDump(MmCoreDumpPageFrame,
-                                    PAGE_READWRITE,
-                                    PhysicalAddress);
+         MmCreateVirtualMappingForKernel(MmCoreDumpPageFrame, 
+	                                 PAGE_READWRITE,
+                                         PhysicalAddress);
 #if defined(__GNUC__)
 
          DiskOffset = MmGetOffsetPageFile(RetrievalPointers,
@@ -604,6 +604,7 @@
 #endif
          DiskOffset.QuadPart += MmCoreDumpLcnMapping.LcnDiskOffset.QuadPart;
          Status = MmCoreDumpFunctions->DumpWrite(DiskOffset, Mdl);
+	 MmRawDeleteVirtualMapping(MmCoreDumpPageFrame);
          if (!NT_SUCCESS(Status))
          {
             DPRINT1("MM: Failed to write page to core dump.\n");

reactos/ntoskrnl/mm/i386
page.c 1.65 -> 1.66
diff -u -r1.65 -r1.66
--- page.c	28 Apr 2004 20:46:03 -0000	1.65
+++ page.c	20 May 2004 08:37:21 -0000	1.66
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: page.c,v 1.65 2004/04/28 20:46:03 hbirr Exp $
+/* $Id: page.c,v 1.66 2004/05/20 08:37:21 hbirr Exp $
  *
  * PROJECT:     ReactOS kernel
  * FILE:        ntoskrnl/mm/i386/page.c
@@ -1003,9 +1003,9 @@
 }
 
 NTSTATUS
-MmCreateVirtualMappingDump(PVOID Address,
-                           ULONG flProtect,
-                           PHYSICAL_ADDRESS PhysicalAddress)
+MmCreateVirtualMappingForKernel(PVOID Address,
+                                ULONG flProtect,
+                                PHYSICAL_ADDRESS PhysicalAddress)
 {
    ULONG Attributes;
    PULONG Pte;
@@ -1013,7 +1013,7 @@
 
    if (Address < (PVOID)KERNEL_BASE)
    {
-      DPRINT1("No process\n");
+      DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n");
       KEBUGCHECK(0);
    }
 
@@ -1031,87 +1031,15 @@
    {
       return(Status);
    }
-   if (PAGE_MASK((*Pte)) != 0 && !((*Pte) & PA_PRESENT))
-   {
-      KEBUGCHECK(0);
-   }
-   *Pte = (ULONG)(PhysicalAddress.QuadPart | Attributes);
-   FLUSH_TLB;
-   return(STATUS_SUCCESS);
-}
-
-
-NTSTATUS
-MmCreateVirtualMappingForKernel(PVOID Address,
-                                ULONG flProtect,
-                                PHYSICAL_ADDRESS PhysicalAddress)
-{
-   PEPROCESS CurrentProcess;
-   ULONG Attributes;
-   PULONG Pte;
-   NTSTATUS Status;
-   PEPROCESS Process = NULL;
-
-   if (Process != NULL)
-   {
-      CurrentProcess = PsGetCurrentProcess();
-   }
-   else
-   {
-      CurrentProcess = NULL;
-   }
-
-   if (Process == NULL && Address < (PVOID)KERNEL_BASE)
-   {
-      DPRINT1("No process\n");
-      KEBUGCHECK(0);
-   }
-   if (Process != NULL && Address >= (PVOID)KERNEL_BASE)
-   {
-      DPRINT1("Setting kernel address with process context\n");
-      KEBUGCHECK(0);
-   }
-   Attributes = ProtectToPTE(flProtect);
-
-   if (Process != NULL && Process != CurrentProcess)
-   {
-      KeAttachProcess(Process);
-   }
 
-   Status = MmGetPageEntry2(Address, &Pte, FALSE);
-   if (!NT_SUCCESS(Status))
-   {
-      if (Process != NULL && Process != CurrentProcess)
-      {
-         KeDetachProcess();
-      }
-      return(Status);
-   }
-   if (PAGE_MASK((*Pte)) != 0 && !((*Pte) & PA_PRESENT))
-   {
-      KEBUGCHECK(0);
-   }
    if (PAGE_MASK((*Pte)) != 0)
    {
-      MmMarkPageUnmapped(PTE_TO_PAGE((*Pte)));
+      KEBUGCHECK(0);
    }
+   
    *Pte = (ULONG)(PhysicalAddress.QuadPart | Attributes);
-   if (Process != NULL &&
-         Process->AddressSpace.PageTableRefCountTable != NULL &&
-         Address < (PVOID)KERNEL_BASE &&
-         Attributes & PA_PRESENT)
-   {
-      PUSHORT Ptrc;
-
-      Ptrc = Process->AddressSpace.PageTableRefCountTable;
-
-      Ptrc[ADDR_TO_PAGE_TABLE(Address)]++;
-   }
    FLUSH_TLB;
-   if (Process != NULL && Process != CurrentProcess)
-   {
-      KeDetachProcess();
-   }
+
    return(STATUS_SUCCESS);
 }
 
CVSspam 0.2.8