mirror of
https://github.com/reactos/reactos.git
synced 2024-09-03 17:19:20 +00:00
Unmap the pages first and than remove the entries from the allocation map in MmUnmapLockedPages.
svn path=/trunk/; revision=3042
This commit is contained in:
parent
16068960f0
commit
0dbc90e4e0
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mdl.c,v 1.41 2002/06/04 15:26:56 dwelch Exp $
|
/* $Id: mdl.c,v 1.42 2002/06/10 21:36:31 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -209,6 +209,16 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
|
||||||
/* Calculate the number of pages we mapped. */
|
/* Calculate the number of pages we mapped. */
|
||||||
RegionSize = PAGE_ROUND_UP(Mdl->ByteCount + Mdl->ByteOffset) / PAGESIZE;
|
RegionSize = PAGE_ROUND_UP(Mdl->ByteCount + Mdl->ByteOffset) / PAGESIZE;
|
||||||
|
|
||||||
|
/* Unmap all the pages. */
|
||||||
|
for (i = 0; i < RegionSize; i++)
|
||||||
|
{
|
||||||
|
MmDeleteVirtualMapping(NULL,
|
||||||
|
BaseAddress + (i * PAGESIZE),
|
||||||
|
FALSE,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
KeAcquireSpinLock(&MiMdlMappingRegionLock, &oldIrql);
|
KeAcquireSpinLock(&MiMdlMappingRegionLock, &oldIrql);
|
||||||
/* Deallocate all the pages used. */
|
/* Deallocate all the pages used. */
|
||||||
Base = (ULONG)(BaseAddress - MiMdlMappingRegionBase - Mdl->ByteOffset);
|
Base = (ULONG)(BaseAddress - MiMdlMappingRegionBase - Mdl->ByteOffset);
|
||||||
|
@ -225,16 +235,6 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
|
||||||
}
|
}
|
||||||
KeReleaseSpinLock(&MiMdlMappingRegionLock, oldIrql);
|
KeReleaseSpinLock(&MiMdlMappingRegionLock, oldIrql);
|
||||||
|
|
||||||
/* Unmap all the pages. */
|
|
||||||
for (i = 0; i < RegionSize; i++)
|
|
||||||
{
|
|
||||||
MmDeleteVirtualMapping(NULL,
|
|
||||||
BaseAddress + (i * PAGESIZE),
|
|
||||||
FALSE,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset the MDL state. */
|
/* Reset the MDL state. */
|
||||||
Mdl->MdlFlags = Mdl->MdlFlags & ~MDL_MAPPED_TO_SYSTEM_VA;
|
Mdl->MdlFlags = Mdl->MdlFlags & ~MDL_MAPPED_TO_SYSTEM_VA;
|
||||||
Mdl->MappedSystemVa = NULL;
|
Mdl->MappedSystemVa = NULL;
|
||||||
|
|
Loading…
Reference in a new issue