mirror of
https://github.com/reactos/reactos.git
synced 2025-06-09 20:11:14 +00:00
- 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). svn path=/trunk/; revision=9445
This commit is contained in:
parent
a7cf6b254f
commit
4a1429bb28
5 changed files with 38 additions and 107 deletions
|
@ -669,9 +669,5 @@ VOID
|
||||||
MmRawDeleteVirtualMapping(PVOID Address);
|
MmRawDeleteVirtualMapping(PVOID Address);
|
||||||
VOID
|
VOID
|
||||||
MiStopPagerThread(VOID);
|
MiStopPagerThread(VOID);
|
||||||
NTSTATUS
|
|
||||||
MmCreateVirtualMappingDump(PVOID Address,
|
|
||||||
ULONG flProtect,
|
|
||||||
PHYSICAL_ADDRESS PhysicalAddress);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/i386/page.c
|
* FILE: ntoskrnl/mm/i386/page.c
|
||||||
|
@ -1003,7 +1003,7 @@ BOOLEAN MmIsPageSwapEntry(PEPROCESS Process, PVOID Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
MmCreateVirtualMappingDump(PVOID Address,
|
MmCreateVirtualMappingForKernel(PVOID Address,
|
||||||
ULONG flProtect,
|
ULONG flProtect,
|
||||||
PHYSICAL_ADDRESS PhysicalAddress)
|
PHYSICAL_ADDRESS PhysicalAddress)
|
||||||
{
|
{
|
||||||
|
@ -1013,7 +1013,7 @@ MmCreateVirtualMappingDump(PVOID Address,
|
||||||
|
|
||||||
if (Address < (PVOID)KERNEL_BASE)
|
if (Address < (PVOID)KERNEL_BASE)
|
||||||
{
|
{
|
||||||
DPRINT1("No process\n");
|
DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n");
|
||||||
KEBUGCHECK(0);
|
KEBUGCHECK(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1031,87 +1031,15 @@ MmCreateVirtualMappingDump(PVOID Address,
|
||||||
{
|
{
|
||||||
return(Status);
|
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)
|
if (PAGE_MASK((*Pte)) != 0)
|
||||||
{
|
{
|
||||||
MmMarkPageUnmapped(PTE_TO_PAGE((*Pte)));
|
KEBUGCHECK(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
*Pte = (ULONG)(PhysicalAddress.QuadPart | Attributes);
|
*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;
|
FLUSH_TLB;
|
||||||
if (Process != NULL && Process != CurrentProcess)
|
|
||||||
{
|
|
||||||
KeDetachProcess();
|
|
||||||
}
|
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/iospace.c
|
* FILE: ntoskrnl/mm/iospace.c
|
||||||
|
@ -126,7 +126,6 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
|
||||||
DbgPrint("Unable to create virtual mapping\n");
|
DbgPrint("Unable to create virtual mapping\n");
|
||||||
KEBUGCHECK(0);
|
KEBUGCHECK(0);
|
||||||
}
|
}
|
||||||
MmMarkPageMapped(PhysicalAddress);
|
|
||||||
}
|
}
|
||||||
return ((PVOID)((char*)Result + Offset));
|
return ((PVOID)((char*)Result + Offset));
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,6 +395,12 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
||||||
PHYSICAL_ADDRESS PhysAddr = { 0 };
|
PHYSICAL_ADDRESS PhysAddr = { 0 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (MemoryArea->Type == MEMORY_AREA_IO_MAPPING)
|
||||||
|
{
|
||||||
|
MmRawDeleteVirtualMapping((char*)MemoryArea->BaseAddress + (i * PAGE_SIZE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
BOOL Dirty = FALSE;
|
BOOL Dirty = FALSE;
|
||||||
SWAPENTRY SwapEntry = 0;
|
SWAPENTRY SwapEntry = 0;
|
||||||
|
|
||||||
|
@ -419,6 +425,7 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
|
||||||
SwapEntry, (BOOLEAN)Dirty);
|
SwapEntry, (BOOLEAN)Dirty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (AddressSpace->Process != NULL &&
|
if (AddressSpace->Process != NULL &&
|
||||||
AddressSpace->Process != CurrentProcess)
|
AddressSpace->Process != CurrentProcess)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/pagefile.c
|
* FILE: ntoskrnl/mm/pagefile.c
|
||||||
|
@ -587,7 +587,7 @@ MmDumpToPagingFile(ULONG BugCode,
|
||||||
LARGE_INTEGER PhysicalAddress;
|
LARGE_INTEGER PhysicalAddress;
|
||||||
PhysicalAddress.QuadPart = i * PAGE_SIZE;
|
PhysicalAddress.QuadPart = i * PAGE_SIZE;
|
||||||
MdlMap[0] = i * PAGE_SIZE;
|
MdlMap[0] = i * PAGE_SIZE;
|
||||||
MmCreateVirtualMappingDump(MmCoreDumpPageFrame,
|
MmCreateVirtualMappingForKernel(MmCoreDumpPageFrame,
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
PhysicalAddress);
|
PhysicalAddress);
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
@ -604,6 +604,7 @@ MmDumpToPagingFile(ULONG BugCode,
|
||||||
#endif
|
#endif
|
||||||
DiskOffset.QuadPart += MmCoreDumpLcnMapping.LcnDiskOffset.QuadPart;
|
DiskOffset.QuadPart += MmCoreDumpLcnMapping.LcnDiskOffset.QuadPart;
|
||||||
Status = MmCoreDumpFunctions->DumpWrite(DiskOffset, Mdl);
|
Status = MmCoreDumpFunctions->DumpWrite(DiskOffset, Mdl);
|
||||||
|
MmRawDeleteVirtualMapping(MmCoreDumpPageFrame);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("MM: Failed to write page to core dump.\n");
|
DPRINT1("MM: Failed to write page to core dump.\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue