One more bug in MmAllocateContiguousPages

Removed debugging code

svn path=/trunk/; revision=1715
This commit is contained in:
David Welch 2001-03-18 21:28:30 +00:00
parent ffca6e4a0a
commit cebfcd7c5e
4 changed files with 29 additions and 31 deletions

View file

@ -43,4 +43,5 @@ cp apps/uitest/uitest.exe $1/reactos/bin/
cp apps/gditest/gditest.exe $1/reactos/bin/
cp apps/ptest/ptest.exe $1/reactos/bin/
cp apps/timer/timer.exe $1/reactos/bin/
cp apps/exp/exp.exe $1/reactos/bin
cp apps/exp/exp.exe $1/reactos/bin/
cp apps/alive/alive.exe $1/reactos/bin/

View file

@ -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: main.c,v 1.81 2001/03/18 19:35:12 dwelch Exp $
/* $Id: main.c,v 1.82 2001/03/18 21:28:30 dwelch Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c
@ -589,29 +589,6 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
}
}
DbgPrint("About to try MmAllocateContiguousAlignedMemory\n");
do
{
extern PVOID STDCALL
MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
IN PHYSICAL_ADDRESS HighestAcceptableAddress,
IN ULONG Alignment);
PVOID v;
PHYSICAL_ADDRESS p;
p.QuadPart = 16*1024*1024;
v = MmAllocateContiguousAlignedMemory(12*1024, p,
64*1024);
if (v != NULL)
{
DbgPrint("Worked\n");
}
else
{
DbgPrint("Failed\n");
}
}
while (0);
/* Create the SystemRoot symbolic link */
DbgPrint("CommandLine: %s\n", (PUCHAR)KeLoaderBlock.CommandLine);
CreateSystemRootLink ((PUCHAR)KeLoaderBlock.CommandLine);

View file

@ -66,7 +66,7 @@ MmGetContinuousPages(ULONG NumberOfBytes,
length = 0;
for (i = 0; i < (HighestAcceptableAddress.QuadPart / PAGESIZE); )
{
if (MmPageArray[i].Flags & MM_PHYSICAL_PAGE_FREE)
if (MM_PTYPE(MmPageArray[i].Flags) == MM_PHYSICAL_PAGE_FREE)
{
if (start == -1)
{

View file

@ -1,4 +1,4 @@
/* $Id: wset.c,v 1.7 2001/02/06 00:11:19 dwelch Exp $
/* $Id: wset.c,v 1.8 2001/03/18 21:28:30 dwelch Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -122,8 +122,8 @@ ULONG MmPageOutPage(PMADDRESS_SPACE AddressSpace,
return(0);
}
ULONG MmTrimWorkingSet(PEPROCESS Process,
ULONG ReduceHint)
ULONG
MmTrimWorkingSet(PEPROCESS Process, ULONG ReduceHint)
{
ULONG i, j;
PMADDRESS_SPACE AddressSpace;
@ -178,14 +178,19 @@ ULONG MmTrimWorkingSet(PEPROCESS Process,
return(Count);
}
VOID MmRemovePageFromWorkingSet(PEPROCESS Process,
PVOID Address)
VOID
MmRemovePageFromWorkingSet(PEPROCESS Process, PVOID Address)
/*
* Remove a page from a process's working set
*/
{
ULONG i;
PMADDRESS_SPACE AddressSpace;
PVOID* WSet;
ULONG j;
MmLockWorkingSet(Process);
WSet = (PVOID*)Process->WorkingSetPage;
AddressSpace = &Process->AddressSpace;
@ -204,6 +209,7 @@ VOID MmRemovePageFromWorkingSet(PEPROCESS Process,
AddressSpace->WorkingSetLruLast =
AddressSpace->WorkingSetMaximumLength;
}
MmUnlockWorkingSet(Process);
return;
}
j = (j + 1) % AddressSpace->WorkingSetMaximumLength;
@ -214,6 +220,9 @@ VOID MmRemovePageFromWorkingSet(PEPROCESS Process,
VOID
MmAddPageToWorkingSet(PEPROCESS Process,
PVOID Address)
/*
* Insert a page into a process's working set
*/
{
PVOID* WSet;
PMADDRESS_SPACE AddressSpace;
@ -230,6 +239,11 @@ MmAddPageToWorkingSet(PEPROCESS Process,
{
KeBugCheck(0);
}
/*
* Lock the working set
*/
MmLockWorkingSet(Process);
WSet = (PVOID*)Process->WorkingSetPage;
@ -246,6 +260,7 @@ MmAddPageToWorkingSet(PEPROCESS Process,
PVOID Page;
NTSTATUS Status;
/* FIXME: This isn't correct */
Page = MmAllocPageMaybeSwap(0);
if (Page == 0)
{
@ -270,6 +285,11 @@ MmAddPageToWorkingSet(PEPROCESS Process,
AddressSpace->WorkingSetLruLast =
(Current + 1) % AddressSpace->WorkingSetMaximumLength;
AddressSpace->WorkingSetSize++;
/*
* And unlock
*/
MmUnlockWorkingSet(Process);
}