mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 12:32:47 +00:00
- Allocate memory for mdl's for paging io from stack instead of the non paged pool.
svn path=/trunk/; revision=9636
This commit is contained in:
parent
efc9160052
commit
1d4397159c
1 changed files with 19 additions and 13 deletions
|
@ -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.46 2004/06/06 07:52:22 hbirr Exp $
|
/* $Id: pagefile.c,v 1.47 2004/06/06 09:13:21 hbirr Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/pagefile.c
|
* FILE: ntoskrnl/mm/pagefile.c
|
||||||
|
@ -191,13 +191,15 @@ MmGetOffsetPageFile(PGET_RETRIEVAL_DESCRIPTOR RetrievalPointers, LARGE_INTEGER O
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS MmWriteToSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
|
NTSTATUS MmWriteToSwapPage(SWAPENTRY SwapEntry, PHYSICAL_ADDRESS* Page)
|
||||||
{
|
{
|
||||||
ULONG i, offset;
|
ULONG i, offset;
|
||||||
LARGE_INTEGER file_offset;
|
LARGE_INTEGER file_offset;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
|
UCHAR MdlBase[sizeof(MDL) + sizeof(ULONG)];
|
||||||
|
PMDL Mdl = (PMDL)MdlBase;
|
||||||
|
|
||||||
DPRINT("MmWriteToSwapPage\n");
|
DPRINT("MmWriteToSwapPage\n");
|
||||||
|
|
||||||
|
@ -222,6 +224,9 @@ NTSTATUS MmWriteToSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
|
||||||
KEBUGCHECK(0);
|
KEBUGCHECK(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MmInitializeMdl(Mdl, NULL, PAGE_SIZE);
|
||||||
|
MmBuildMdlFromPages(Mdl, (PULONG)Page);
|
||||||
|
|
||||||
file_offset.QuadPart = offset * PAGE_SIZE;
|
file_offset.QuadPart = offset * PAGE_SIZE;
|
||||||
file_offset = MmGetOffsetPageFile(PagingFileList[i]->RetrievalPointers, file_offset);
|
file_offset = MmGetOffsetPageFile(PagingFileList[i]->RetrievalPointers, file_offset);
|
||||||
|
|
||||||
|
@ -234,18 +239,21 @@ NTSTATUS MmWriteToSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
|
||||||
if (Status == STATUS_PENDING)
|
if (Status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||||
return(Iosb.Status);
|
Status = Iosb.Status;
|
||||||
}
|
}
|
||||||
|
MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS MmReadFromSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
|
NTSTATUS MmReadFromSwapPage(SWAPENTRY SwapEntry, PHYSICAL_ADDRESS* Page)
|
||||||
{
|
{
|
||||||
ULONG i, offset;
|
ULONG i, offset;
|
||||||
LARGE_INTEGER file_offset;
|
LARGE_INTEGER file_offset;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
|
UCHAR MdlBase[sizeof(MDL) + sizeof(ULONG)];
|
||||||
|
PMDL Mdl = (PMDL)MdlBase;
|
||||||
|
|
||||||
DPRINT("MmReadFromSwapPage\n");
|
DPRINT("MmReadFromSwapPage\n");
|
||||||
|
|
||||||
|
@ -270,6 +278,9 @@ NTSTATUS MmReadFromSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
|
||||||
KEBUGCHECK(0);
|
KEBUGCHECK(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MmInitializeMdl(Mdl, NULL, PAGE_SIZE);
|
||||||
|
MmBuildMdlFromPages(Mdl, (PULONG)Page);
|
||||||
|
|
||||||
file_offset.QuadPart = offset * PAGE_SIZE;
|
file_offset.QuadPart = offset * PAGE_SIZE;
|
||||||
file_offset = MmGetOffsetPageFile(PagingFileList[i]->RetrievalPointers, file_offset);
|
file_offset = MmGetOffsetPageFile(PagingFileList[i]->RetrievalPointers, file_offset);
|
||||||
|
|
||||||
|
@ -282,8 +293,9 @@ NTSTATUS MmReadFromSwapPage(SWAPENTRY SwapEntry, PMDL Mdl)
|
||||||
if (Status == STATUS_PENDING)
|
if (Status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||||
return(Iosb.Status);
|
Status = Iosb.Status;
|
||||||
}
|
}
|
||||||
|
MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,14 +550,8 @@ MmDumpToPagingFile(ULONG BugCode,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the MDL. */
|
/* Initialize the MDL. */
|
||||||
Mdl->Next = NULL;
|
MmInitializeMdl(Mdl, MmCoreDumpPageFrame, PAGE_SIZE);
|
||||||
Mdl->Size = sizeof(MDL) + sizeof(PVOID);
|
Mdl->MdlFlags = MDL_PAGES_LOCKED|MDL_IO_PAGE_READ|MDL_SOURCE_IS_NONPAGED_POOL;
|
||||||
Mdl->MdlFlags = MDL_SOURCE_IS_NONPAGED_POOL;
|
|
||||||
Mdl->Process = NULL;
|
|
||||||
Mdl->MappedSystemVa = MmCoreDumpPageFrame;
|
|
||||||
Mdl->StartVa = NULL;
|
|
||||||
Mdl->ByteCount = PAGE_SIZE;
|
|
||||||
Mdl->ByteOffset = 0;
|
|
||||||
MdlMap = (PULONG)(Mdl + 1);
|
MdlMap = (PULONG)(Mdl + 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue