mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:42:56 +00:00
*** empty log message ***
svn path=/trunk/; revision=1256
This commit is contained in:
parent
fb7b00bd59
commit
68375602c1
6 changed files with 166 additions and 76 deletions
|
@ -86,9 +86,11 @@ typedef struct
|
||||||
} Data;
|
} Data;
|
||||||
} MEMORY_AREA, *PMEMORY_AREA;
|
} MEMORY_AREA, *PMEMORY_AREA;
|
||||||
|
|
||||||
|
#define WSET_ADDRESSES_IN_PAGE (1020)
|
||||||
|
|
||||||
typedef struct _MWORKING_SET
|
typedef struct _MWORKING_SET
|
||||||
{
|
{
|
||||||
PVOID Address[1020];
|
PVOID Address[WSET_ADDRESSES_IN_PAGE];
|
||||||
struct _MWORKING_SET* Next;
|
struct _MWORKING_SET* Next;
|
||||||
} MWORKING_SET, *PMWORKING_SET;
|
} MWORKING_SET, *PMWORKING_SET;
|
||||||
|
|
||||||
|
@ -261,6 +263,7 @@ typedef struct
|
||||||
ULONG NrUserPages;
|
ULONG NrUserPages;
|
||||||
ULONG NrFreePages;
|
ULONG NrFreePages;
|
||||||
ULONG NrDirtyPages;
|
ULONG NrDirtyPages;
|
||||||
|
ULONG NrLockedPages;
|
||||||
ULONG PagingRequestsInLastMinute;
|
ULONG PagingRequestsInLastMinute;
|
||||||
ULONG PagingRequestsInLastFiveMinutes;
|
ULONG PagingRequestsInLastFiveMinutes;
|
||||||
ULONG PagingRequestsInLastFifteenMinutes;
|
ULONG PagingRequestsInLastFifteenMinutes;
|
||||||
|
@ -283,6 +286,8 @@ VOID MmSetSavedSwapEntryPage(PVOID PhysicalAddress,
|
||||||
SWAPENTRY SavedSwapEntry);
|
SWAPENTRY SavedSwapEntry);
|
||||||
SWAPENTRY MmGetSavedSwapEntryPage(PVOID PhysicalAddress);
|
SWAPENTRY MmGetSavedSwapEntryPage(PVOID PhysicalAddress);
|
||||||
VOID MmSetCleanPage(struct _EPROCESS* Process, PVOID Address);
|
VOID MmSetCleanPage(struct _EPROCESS* Process, PVOID Address);
|
||||||
|
VOID MmLockPage(PVOID PhysicalPage);
|
||||||
|
VOID MmUnlockPage(PVOID PhysicalPage);
|
||||||
|
|
||||||
#define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)
|
#define MM_PHYSICAL_PAGE_MPW_PENDING (0x8)
|
||||||
|
|
||||||
|
|
|
@ -115,10 +115,11 @@ VOID IoReadWriteCompletion(PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
ExFreePool(Irp->AssociatedIrp.SystemBuffer);
|
ExFreePool(Irp->AssociatedIrp.SystemBuffer);
|
||||||
}
|
}
|
||||||
if (DeviceObject->Flags & DO_DIRECT_IO && !(Irp->Flags & IRP_PAGING_IO))
|
if (DeviceObject->Flags & DO_DIRECT_IO)
|
||||||
{
|
{
|
||||||
|
/* FIXME: Is the MDL destroyed on a paging i/o, check all cases. */
|
||||||
DPRINT("Tearing down MDL\n");
|
DPRINT("Tearing down MDL\n");
|
||||||
if (Irp->MdlAddress->MappedSystemVa!=NULL)
|
if (Irp->MdlAddress->MappedSystemVa != NULL)
|
||||||
{
|
{
|
||||||
MmUnmapLockedPages(Irp->MdlAddress->MappedSystemVa,
|
MmUnmapLockedPages(Irp->MdlAddress->MappedSystemVa,
|
||||||
Irp->MdlAddress);
|
Irp->MdlAddress);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: main.c,v 1.52 2000/07/04 11:11:03 dwelch Exp $
|
/* $Id: main.c,v 1.53 2000/07/08 16:53:32 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -83,8 +83,16 @@ void _main (PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
*/
|
*/
|
||||||
HalInitSystem (0, &KeLoaderBlock);
|
HalInitSystem (0, &KeLoaderBlock);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display version number and copyright/warranty message
|
||||||
|
*/
|
||||||
HalDisplayString("Starting ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
|
HalDisplayString("Starting ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n");
|
||||||
|
HalDisplayString("Copyright 2000 (So who owns the copyright?).\n");
|
||||||
|
HalDisplayString("ReactOS is free software, covered by the GNU General Public License, and you\n");
|
||||||
|
HalDisplayString("are welcome to change it and/or distribute copies of it under certain\n");
|
||||||
|
HalDisplayString("conditions.\n");
|
||||||
|
HalDisplayString("There is absolutely no warranty for ReactOS.\n");
|
||||||
|
|
||||||
last_kernel_address = KERNEL_BASE;
|
last_kernel_address = KERNEL_BASE;
|
||||||
for (i=0; i <= KeLoaderBlock.nr_files; i++)
|
for (i=0; i <= KeLoaderBlock.nr_files; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,7 @@ typedef struct _PHYSICAL_PAGE
|
||||||
ULONG ReferenceCount;
|
ULONG ReferenceCount;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
SWAPENTRY SavedSwapEntry;
|
SWAPENTRY SavedSwapEntry;
|
||||||
|
ULONG LockCount;
|
||||||
} PHYSICAL_PAGE, *PPHYSICAL_PAGE;
|
} PHYSICAL_PAGE, *PPHYSICAL_PAGE;
|
||||||
|
|
||||||
/* GLOBALS ****************************************************************/
|
/* GLOBALS ****************************************************************/
|
||||||
|
@ -315,6 +316,40 @@ VOID MmDereferencePage(PVOID PhysicalAddress)
|
||||||
KeReleaseSpinLock(&PageListLock, oldIrql);
|
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID MmLockPage(PVOID PhysicalAddress)
|
||||||
|
{
|
||||||
|
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||||
|
KIRQL oldIrql;
|
||||||
|
|
||||||
|
DPRINT("MmReferencePage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||||
|
|
||||||
|
if (((ULONG)PhysicalAddress) == 0)
|
||||||
|
{
|
||||||
|
KeBugCheck(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||||
|
MmPageArray[Start].LockCount++;
|
||||||
|
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID MmUnlockPage(PVOID PhysicalAddress)
|
||||||
|
{
|
||||||
|
ULONG Start = (ULONG)PhysicalAddress / PAGESIZE;
|
||||||
|
KIRQL oldIrql;
|
||||||
|
|
||||||
|
DPRINT("MmReferencePage(PhysicalAddress %x)\n", PhysicalAddress);
|
||||||
|
|
||||||
|
if (((ULONG)PhysicalAddress) == 0)
|
||||||
|
{
|
||||||
|
KeBugCheck(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
KeAcquireSpinLock(&PageListLock, &oldIrql);
|
||||||
|
MmPageArray[Start].LockCount--;
|
||||||
|
KeReleaseSpinLock(&PageListLock, oldIrql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PVOID MmAllocPage(SWAPENTRY SavedSwapEntry)
|
PVOID MmAllocPage(SWAPENTRY SavedSwapEntry)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mdl.c,v 1.23 2000/07/07 10:30:56 dwelch Exp $
|
/* $Id: mdl.c,v 1.24 2000/07/08 16:53:33 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -24,14 +24,14 @@
|
||||||
|
|
||||||
PVOID MmGetMdlPageAddress(PMDL Mdl, PVOID Offset)
|
PVOID MmGetMdlPageAddress(PMDL Mdl, PVOID Offset)
|
||||||
{
|
{
|
||||||
PULONG mdl_pages;
|
PULONG MdlPages;
|
||||||
|
|
||||||
mdl_pages = (PULONG)(Mdl + 1);
|
MdlPages = (PULONG)(Mdl + 1);
|
||||||
|
|
||||||
return((PVOID)mdl_pages[((ULONG)Offset) / PAGESIZE]);
|
return((PVOID)MdlPages[((ULONG)Offset) / PAGESIZE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL MmUnlockPages(PMDL MemoryDescriptorList)
|
VOID STDCALL MmUnlockPages(PMDL Mdl)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Unlocks the physical pages described by a given MDL
|
* FUNCTION: Unlocks the physical pages described by a given MDL
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -41,7 +41,36 @@ VOID STDCALL MmUnlockPages(PMDL MemoryDescriptorList)
|
||||||
* MDL is updated
|
* MDL is updated
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
/* It is harmless to leave this one as a stub */
|
ULONG i;
|
||||||
|
PULONG MdlPages;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: I don't know whether this right, but it looks sensible
|
||||||
|
*/
|
||||||
|
if ((Mdl->MdlFlags & MDL_SOURCE_IS_NONPAGED_POOL) ||
|
||||||
|
(Mdl->MdlFlags & MDL_IO_PAGE_READ))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: Seems sensible
|
||||||
|
*/
|
||||||
|
if (!(Mdl->MdlFlags & MDL_PAGES_LOCKED))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MmLockAddressSpace(&Mdl->Process->AddressSpace);
|
||||||
|
|
||||||
|
MdlPages = (PULONG)(Mdl + 1);
|
||||||
|
for (i=0; i<(PAGE_ROUND_UP(Mdl->ByteCount+Mdl->ByteOffset)/PAGESIZE); i++)
|
||||||
|
{
|
||||||
|
MmUnlockPage((PVOID)MdlPages[i]);
|
||||||
|
MmDereferencePage((PVOID)MdlPages[i]);
|
||||||
|
}
|
||||||
|
MmUnlockAddressSpace(&Mdl->Process->AddressSpace);
|
||||||
|
Mdl->MdlFlags = Mdl->MdlFlags & (~MDL_PAGES_LOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID STDCALL MmMapLockedPages(PMDL Mdl, KPROCESSOR_MODE AccessMode)
|
PVOID STDCALL MmMapLockedPages(PMDL Mdl, KPROCESSOR_MODE AccessMode)
|
||||||
|
@ -52,41 +81,46 @@ PVOID STDCALL MmMapLockedPages(PMDL Mdl, KPROCESSOR_MODE AccessMode)
|
||||||
* AccessMode = Specifies the access mode in which to map the MDL
|
* AccessMode = Specifies the access mode in which to map the MDL
|
||||||
* RETURNS: The base virtual address that maps the locked pages for the
|
* RETURNS: The base virtual address that maps the locked pages for the
|
||||||
* range described by the MDL
|
* range described by the MDL
|
||||||
|
* FIXME: What does AccessMode do?
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PVOID base = NULL;
|
PVOID Base;
|
||||||
unsigned int i;
|
ULONG i;
|
||||||
ULONG* mdl_pages=NULL;
|
PULONG MdlPages;
|
||||||
MEMORY_AREA* Result;
|
MEMORY_AREA* Result;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("MmMapLockedPages(Mdl %x, AccessMode %x)\n", Mdl, AccessMode);
|
DPRINT("MmMapLockedPages(Mdl %x, AccessMode %x)\n", Mdl, AccessMode);
|
||||||
|
|
||||||
DPRINT("Mdl->ByteCount %x\n",Mdl->ByteCount);
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||||
DPRINT("PAGE_ROUND_UP(Mdl->ByteCount)/PAGESIZE) %x\n",
|
|
||||||
PAGE_ROUND_UP(Mdl->ByteCount)/PAGESIZE);
|
|
||||||
|
|
||||||
MmCreateMemoryArea(NULL,
|
Base = NULL;
|
||||||
MmGetKernelAddressSpace(),
|
Status = MmCreateMemoryArea(NULL,
|
||||||
MEMORY_AREA_MDL_MAPPING,
|
MmGetKernelAddressSpace(),
|
||||||
&base,
|
MEMORY_AREA_MDL_MAPPING,
|
||||||
Mdl->ByteCount + Mdl->ByteOffset,
|
&Base,
|
||||||
0,
|
Mdl->ByteCount + Mdl->ByteOffset,
|
||||||
&Result);
|
0,
|
||||||
CHECKPOINT;
|
&Result);
|
||||||
mdl_pages = (ULONG *)(Mdl + 1);
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
KeBugCheck(0);
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
MdlPages = (PULONG)(Mdl + 1);
|
||||||
for (i=0; i<(PAGE_ROUND_UP(Mdl->ByteCount+Mdl->ByteOffset)/PAGESIZE); i++)
|
for (i=0; i<(PAGE_ROUND_UP(Mdl->ByteCount+Mdl->ByteOffset)/PAGESIZE); i++)
|
||||||
{
|
{
|
||||||
DPRINT("Writing %x with physical address %x\n",
|
|
||||||
base+(i*PAGESIZE),mdl_pages[i]);
|
|
||||||
MmSetPage(NULL,
|
MmSetPage(NULL,
|
||||||
(PVOID)((DWORD)base+(i*PAGESIZE)),
|
(PVOID)((ULONG)Base+(i*PAGESIZE)),
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
mdl_pages[i]);
|
MdlPages[i]);
|
||||||
}
|
}
|
||||||
DPRINT("base %x\n",base);
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
Mdl->MdlFlags = Mdl->MdlFlags | MDL_MAPPED_TO_SYSTEM_VA;
|
Mdl->MdlFlags = Mdl->MdlFlags | MDL_MAPPED_TO_SYSTEM_VA;
|
||||||
Mdl->MappedSystemVa = base + Mdl->ByteOffset;
|
Mdl->MappedSystemVa = Base + Mdl->ByteOffset;
|
||||||
return(base + Mdl->ByteOffset);
|
return(Base + Mdl->ByteOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,34 +133,36 @@ VOID STDCALL MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DPRINT("MmUnmapLockedPages(BaseAddress %x, Mdl %x)\n", Mdl, BaseAddress);
|
DPRINT("MmUnmapLockedPages(BaseAddress %x, Mdl %x)\n", Mdl, BaseAddress);
|
||||||
(void)MmFreeMemoryArea(MmGetKernelAddressSpace(),
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
(VOID)MmFreeMemoryArea(MmGetKernelAddressSpace(),
|
||||||
BaseAddress - Mdl->ByteOffset,
|
BaseAddress - Mdl->ByteOffset,
|
||||||
Mdl->ByteCount,
|
Mdl->ByteCount,
|
||||||
FALSE);
|
FALSE);
|
||||||
Mdl->MdlFlags = Mdl->MdlFlags & ~MDL_MAPPED_TO_SYSTEM_VA;
|
Mdl->MdlFlags = Mdl->MdlFlags & ~MDL_MAPPED_TO_SYSTEM_VA;
|
||||||
Mdl->MappedSystemVa = NULL;
|
Mdl->MappedSystemVa = NULL;
|
||||||
DPRINT("MmUnmapLockedPages() finished\n");
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID MmBuildMdlFromPages(PMDL Mdl, PULONG Pages)
|
VOID MmBuildMdlFromPages(PMDL Mdl, PULONG Pages)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PULONG mdl_pages;
|
PULONG MdlPages;
|
||||||
|
|
||||||
mdl_pages = (PULONG)(Mdl + 1);
|
Mdl->MdlFlags = Mdl->MdlFlags |
|
||||||
|
(MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
|
||||||
|
|
||||||
|
MdlPages = (PULONG)(Mdl + 1);
|
||||||
|
|
||||||
for (i=0;i<(PAGE_ROUND_UP(Mdl->ByteOffset+Mdl->ByteCount)/PAGESIZE);i++)
|
for (i=0;i<(PAGE_ROUND_UP(Mdl->ByteOffset+Mdl->ByteCount)/PAGESIZE);i++)
|
||||||
{
|
{
|
||||||
mdl_pages[i] = Pages[i];
|
MdlPages[i] = Pages[i];
|
||||||
DPRINT("mdl_pages[i] %x\n",mdl_pages[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
||||||
VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
KPROCESSOR_MODE AccessMode,
|
||||||
KPROCESSOR_MODE AccessMode,
|
LOCK_OPERATION Operation)
|
||||||
LOCK_OPERATION Operation)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Probes the specified pages, makes them resident and locks them
|
* FUNCTION: Probes the specified pages, makes them resident and locks them
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -135,14 +171,20 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
||||||
* Operation = Operation to probe for
|
* Operation = Operation to probe for
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
ULONG* mdl_pages=NULL;
|
PULONG MdlPages;
|
||||||
int i;
|
ULONG i;
|
||||||
MEMORY_AREA* marea;
|
PMEMORY_AREA MArea;
|
||||||
PVOID Address;
|
|
||||||
PMADDRESS_SPACE AddressSpace;
|
PMADDRESS_SPACE AddressSpace;
|
||||||
|
|
||||||
DPRINT("MmProbeAndLockPages(Mdl %x)\n",Mdl);
|
DPRINT("MmProbeAndLockPages(Mdl %x)\n", Mdl);
|
||||||
DPRINT("StartVa %x\n",Mdl->StartVa);
|
|
||||||
|
/*
|
||||||
|
* FIXME: Check behaviour against NT
|
||||||
|
*/
|
||||||
|
if (Mdl->MdlFlags & MDL_PAGES_LOCKED)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Mdl->StartVa > (PVOID)KERNEL_BASE)
|
if (Mdl->StartVa > (PVOID)KERNEL_BASE)
|
||||||
{
|
{
|
||||||
|
@ -153,38 +195,36 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
||||||
AddressSpace = &Mdl->Process->AddressSpace;
|
AddressSpace = &Mdl->Process->AddressSpace;
|
||||||
}
|
}
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
marea = MmOpenMemoryAreaByAddress(AddressSpace,
|
MArea = MmOpenMemoryAreaByAddress(AddressSpace,
|
||||||
Mdl->StartVa);
|
Mdl->StartVa);
|
||||||
DPRINT("marea %x\n",marea);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the area is valid
|
* Check the area is valid
|
||||||
*/
|
*/
|
||||||
if (marea==NULL )
|
if (MArea == NULL)
|
||||||
{
|
{
|
||||||
DbgPrint("(%s:%d) Area is invalid\n",__FILE__,__LINE__);
|
DbgPrint("(%s:%d) Area is invalid\n",__FILE__,__LINE__);
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
|
/* FIXME: ExRaiseStatus doesn't do anything sensible at the moment */
|
||||||
ExRaiseStatus(STATUS_INVALID_PARAMETER);
|
ExRaiseStatus(STATUS_INVALID_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Lock the memory area
|
|
||||||
* (We can't allow it to be freed while an I/O operation to it is
|
|
||||||
* ongoing)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock the pages
|
* Lock the pages
|
||||||
*/
|
*/
|
||||||
mdl_pages = (ULONG *)(Mdl + 1);
|
MdlPages = (ULONG *)(Mdl + 1);
|
||||||
|
|
||||||
for (i=0;i<(PAGE_ROUND_UP(Mdl->ByteOffset+Mdl->ByteCount)/PAGESIZE);i++)
|
for (i=0;i<(PAGE_ROUND_UP(Mdl->ByteOffset+Mdl->ByteCount)/PAGESIZE);i++)
|
||||||
{
|
{
|
||||||
|
PVOID Address;
|
||||||
|
|
||||||
Address = Mdl->StartVa + (i*PAGESIZE);
|
Address = Mdl->StartVa + (i*PAGESIZE);
|
||||||
mdl_pages[i] = (MmGetPhysicalAddress(Address)).u.LowPart;
|
MdlPages[i] = (MmGetPhysicalAddress(Address)).u.LowPart;
|
||||||
DPRINT("mdl_pages[i] %x\n",mdl_pages[i]);
|
MmReferencePage((PVOID)MdlPages[i]);
|
||||||
|
MmLockPage((PVOID)MdlPages[i]);
|
||||||
}
|
}
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
|
Mdl->MdlFlags = Mdl->MdlFlags | MDL_PAGES_LOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,9 +238,10 @@ ULONG STDCALL MmSizeOfMdl (PVOID Base,
|
||||||
* Length = number of bytes to map
|
* Length = number of bytes to map
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
unsigned int len=ADDRESS_AND_SIZE_TO_SPAN_PAGES(Base,Length);
|
ULONG len;
|
||||||
|
|
||||||
|
len = ADDRESS_AND_SIZE_TO_SPAN_PAGES(Base,Length);
|
||||||
|
|
||||||
DPRINT("MmSizeOfMdl() %x\n",sizeof(MDL)+(len*sizeof(ULONG)));
|
|
||||||
return(sizeof(MDL)+(len*sizeof(ULONG)));
|
return(sizeof(MDL)+(len*sizeof(ULONG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +285,7 @@ PMDL STDCALL MmCreateMdl (PMDL MemoryDescriptorList,
|
||||||
|
|
||||||
Size = MmSizeOfMdl(Base,Length);
|
Size = MmSizeOfMdl(Base,Length);
|
||||||
MemoryDescriptorList = (PMDL)ExAllocatePool(NonPagedPool,Size);
|
MemoryDescriptorList = (PMDL)ExAllocatePool(NonPagedPool,Size);
|
||||||
if (MemoryDescriptorList==NULL)
|
if (MemoryDescriptorList == NULL)
|
||||||
{
|
{
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
@ -256,13 +297,13 @@ PMDL STDCALL MmCreateMdl (PMDL MemoryDescriptorList,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID STDCALL MmMapMemoryDumpMdl (PVOID Unknown0)
|
||||||
STDCALL
|
/*
|
||||||
MmMapMemoryDumpMdl (
|
* FIXME: Has something to do with crash dumps. Do we want to implement
|
||||||
PVOID Unknown0
|
* this?
|
||||||
)
|
*/
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: wset.c,v 1.3 2000/07/07 10:30:57 dwelch Exp $
|
/* $Id: wset.c,v 1.4 2000/07/08 16:53:33 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -124,7 +124,7 @@ ULONG MmTrimWorkingSet(PEPROCESS Process,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
j = (j + 1) % 1020;
|
j = (j + 1) % WSET_ADDRESSES_IN_PAGE;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,11 +163,11 @@ VOID MmRemovePageFromWorkingSet(PEPROCESS Process,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddressSpace->WorkingSetLruLast = 1020;
|
AddressSpace->WorkingSetLruLast = WSET_ADDRESSES_IN_PAGE;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
j = (j + 1) % 1020;
|
j = (j + 1) % WSET_ADDRESSES_IN_PAGE;
|
||||||
}
|
}
|
||||||
KeBugCheck(0);
|
KeBugCheck(0);
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ BOOLEAN MmAddPageToWorkingSet(PEPROCESS Process,
|
||||||
|
|
||||||
AddressSpace = &Process->AddressSpace;
|
AddressSpace = &Process->AddressSpace;
|
||||||
|
|
||||||
if (((AddressSpace->WorkingSetLruLast + 1) % 1020) ==
|
if (((AddressSpace->WorkingSetLruLast + 1) % WSET_ADDRESSES_IN_PAGE) ==
|
||||||
AddressSpace->WorkingSetLruFirst)
|
AddressSpace->WorkingSetLruFirst)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
@ -191,7 +191,7 @@ BOOLEAN MmAddPageToWorkingSet(PEPROCESS Process,
|
||||||
WSet->Address[AddressSpace->WorkingSetLruLast] = Address;
|
WSet->Address[AddressSpace->WorkingSetLruLast] = Address;
|
||||||
|
|
||||||
AddressSpace->WorkingSetLruLast =
|
AddressSpace->WorkingSetLruLast =
|
||||||
(AddressSpace->WorkingSetLruLast + 1) % 1024;
|
(AddressSpace->WorkingSetLruLast + 1) % WSET_ADDRESSES_IN_PAGE;
|
||||||
AddressSpace->WorkingSetSize++;
|
AddressSpace->WorkingSetSize++;
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue