ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2018
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
32 participants
304 discussions
Start a n
N
ew thread
04/06: [USBPORT] Remove an unnecessary check in USBPORT_AllocateBandwidthUSB2. CID 1434261
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=db54e5eb1c6283d098999…
commit db54e5eb1c6283d098999046a56c7b6021b70040 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Wed Aug 15 12:49:42 2018 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Thu Aug 16 14:14:23 2018 +0200 [USBPORT] Remove an unnecessary check in USBPORT_AllocateBandwidthUSB2. CID 1434261 --- drivers/usb/usbport/usb2.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index a2c5de5816..e41a7c0620 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -1892,11 +1892,7 @@ USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, case UsbHighSpeed: { Tt = &FdoExtension->Usb2Extension->HcTt; - - if (EndpointProperties->Period > USB2_MAX_MICROFRAMES) - Period = USB2_MAX_MICROFRAMES; - else - Period = EndpointProperties->Period; + Period = EndpointProperties->Period; break; }
6 years, 4 months
1
0
0
0
03/06: [USBPORT] Remove an unnecessary check in USB2_ConvertFrame. CID 1434244
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7ad4cf96f3a1b3c500e74…
commit 7ad4cf96f3a1b3c500e74dd0f94b4b227c5b53bd Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Wed Aug 15 12:22:02 2018 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Thu Aug 16 14:14:15 2018 +0200 [USBPORT] Remove an unnecessary check in USB2_ConvertFrame. CID 1434244 --- drivers/usb/usbport/usb2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 77cbd57b4b..a2c5de5816 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -739,8 +739,7 @@ USB2_ConvertFrame(IN UCHAR Frame, *HcMicroframe = 0; } - if (Microframe >= 0 && - Microframe <= (USB2_MICROFRAMES - 2)) + if (Microframe <= (USB2_MICROFRAMES - 2)) { *HcFrame = Frame; *HcMicroframe = Microframe + 1;
6 years, 4 months
1
0
0
0
02/06: [USBPORT] Accept negative BusTime in USB2_MoveTtEndpoint. CID 1434226
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d1e5699e604d81d27f97e…
commit d1e5699e604d81d27f97e6b333d455e0953e09bf Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Wed Aug 15 12:20:01 2018 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Thu Aug 16 14:14:04 2018 +0200 [USBPORT] Accept negative BusTime in USB2_MoveTtEndpoint. CID 1434226 --- drivers/usb/usbport/usb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index be13000112..77cbd57b4b 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -617,7 +617,7 @@ USB2_DeallocateHS(IN PUSB2_TT_ENDPOINT TtEndpoint, BOOLEAN NTAPI USB2_MoveTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, - IN USHORT BusTime, + IN LONG BusTime, IN PUSB2_REBALANCE Rebalance, IN ULONG RebalanceListEntries, OUT BOOLEAN * OutResult)
6 years, 4 months
1
0
0
0
01/06: [WIN32K:NTUSER] Fix type confusion in MsgMemorySize.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7b2bb85ceb4a84d7c1901…
commit 7b2bb85ceb4a84d7c1901068b19a26026af98f4a Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sun Aug 12 15:47:12 2018 +0200 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Thu Aug 16 14:13:47 2018 +0200 [WIN32K:NTUSER] Fix type confusion in MsgMemorySize. --- win32ss/user/ntuser/message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win32ss/user/ntuser/message.c b/win32ss/user/ntuser/message.c index c8cfededfb..3f7bcfb03b 100644 --- a/win32ss/user/ntuser/message.c +++ b/win32ss/user/ntuser/message.c @@ -164,7 +164,7 @@ static UINT FASTCALL MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam) { CREATESTRUCTW *Cs; - PUNICODE_STRING WindowName; + PLARGE_STRING WindowName; PUNICODE_STRING ClassName; UINT Size = 0; @@ -196,7 +196,7 @@ MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam) case WM_CREATE: case WM_NCCREATE: Cs = (CREATESTRUCTW *) lParam; - WindowName = (PUNICODE_STRING) Cs->lpszName; + WindowName = (PLARGE_STRING) Cs->lpszName; ClassName = (PUNICODE_STRING) Cs->lpszClass; Size = sizeof(CREATESTRUCTW) + WindowName->Length + sizeof(WCHAR); if (IS_ATOM(ClassName->Buffer))
6 years, 4 months
1
0
0
0
07/07: [NTOSKRNL] Start making our MMPAGING_FILE struct look like the real one
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=19318dcc1deb97ea8aa01…
commit 19318dcc1deb97ea8aa017df4a5b0f8ea02a1c0f Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu Aug 16 14:04:27 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu Aug 16 14:04:27 2018 +0200 [NTOSKRNL] Start making our MMPAGING_FILE struct look like the real one --- ntoskrnl/include/internal/mm.h | 8 ++++---- ntoskrnl/mm/pagefile.c | 40 ++++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h index ca82fd87d9..cf9e5069ac 100644 --- a/ntoskrnl/include/internal/mm.h +++ b/ntoskrnl/include/internal/mm.h @@ -426,14 +426,14 @@ extern MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]; /* Page file information */ typedef struct _MMPAGING_FILE { - PFN_NUMBER CurrentSize; + PFN_NUMBER Size; PFN_NUMBER MaximumSize; PFN_NUMBER MinimumSize; - PFN_NUMBER FreePages; - PFN_NUMBER UsedPages; + PFN_NUMBER FreeSpace; + PFN_NUMBER CurrentUsage; PFILE_OBJECT FileObject; UNICODE_STRING PageFileName; - PRTL_BITMAP AllocMap; + PRTL_BITMAP Bitmap; HANDLE FileHandle; } MMPAGING_FILE, *PMMPAGING_FILE; diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c index dd24fe7d5b..9019beef90 100644 --- a/ntoskrnl/mm/pagefile.c +++ b/ntoskrnl/mm/pagefile.c @@ -290,10 +290,10 @@ MmFreeSwapPage(SWAPENTRY Entry) KeBugCheck(MEMORY_MANAGEMENT); } - RtlClearBit(PagingFile->AllocMap, off >> 5); + RtlClearBit(PagingFile->Bitmap, off >> 5); - PagingFile->FreePages++; - PagingFile->UsedPages--; + PagingFile->FreeSpace++; + PagingFile->CurrentUsage--; MiFreeSwapPages++; MiUsedSwapPages--; @@ -320,9 +320,9 @@ MmAllocSwapPage(VOID) for (i = 0; i < MAX_PAGING_FILES; i++) { if (MmPagingFile[i] != NULL && - MmPagingFile[i]->FreePages >= 1) + MmPagingFile[i]->FreeSpace >= 1) { - off = RtlFindClearBitsAndSet(MmPagingFile[i]->AllocMap, 1, 0); + off = RtlFindClearBitsAndSet(MmPagingFile[i]->Bitmap, 1, 0); if (off == 0xFFFFFFFF) { KeBugCheck(MEMORY_MANAGEMENT); @@ -741,17 +741,21 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, PagingFile->FileHandle = FileHandle; PagingFile->FileObject = FileObject; PagingFile->MaximumSize = (SafeMaximumSize.QuadPart >> PAGE_SHIFT); - PagingFile->CurrentSize = (SafeMinimumSize.QuadPart >> PAGE_SHIFT); + PagingFile->Size = (SafeMinimumSize.QuadPart >> PAGE_SHIFT); PagingFile->MinimumSize = (SafeMinimumSize.QuadPart >> PAGE_SHIFT); - PagingFile->FreePages = (ULONG)(SafeMinimumSize.QuadPart / PAGE_SIZE); - PagingFile->UsedPages = 0; + /* First page is never used: it's the header + * TODO: write it + */ + PagingFile->FreeSpace = (ULONG)(SafeMinimumSize.QuadPart / PAGE_SIZE) - 1; + PagingFile->CurrentUsage = 0; PagingFile->PageFileName = PageFileName; + ASSERT(PagingFile->Size == PagingFile->FreeSpace + PagingFile->CurrentUsage + 1); - AllocMapSize = sizeof(RTL_BITMAP) + (((PagingFile->FreePages + 31) / 32) * sizeof(ULONG)); - PagingFile->AllocMap = ExAllocatePoolWithTag(NonPagedPool, - AllocMapSize, - TAG_MM); - if (PagingFile->AllocMap == NULL) + AllocMapSize = sizeof(RTL_BITMAP) + (((PagingFile->MaximumSize + 31) / 32) * sizeof(ULONG)); + PagingFile->Bitmap = ExAllocatePoolWithTag(NonPagedPool, + AllocMapSize, + TAG_MM); + if (PagingFile->Bitmap == NULL) { ExFreePoolWithTag(PagingFile, TAG_MM); ObDereferenceObject(FileObject); @@ -760,10 +764,10 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, return STATUS_INSUFFICIENT_RESOURCES; } - RtlInitializeBitMap(PagingFile->AllocMap, - (PULONG)(PagingFile->AllocMap + 1), - (ULONG)(PagingFile->FreePages)); - RtlClearAllBits(PagingFile->AllocMap); + RtlInitializeBitMap(PagingFile->Bitmap, + (PULONG)(PagingFile->Bitmap + 1), + (ULONG)(PagingFile->MaximumSize)); + RtlClearAllBits(PagingFile->Bitmap); /* FIXME: should be calling unsafe instead, * we should already be in a guarded region @@ -772,7 +776,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, ASSERT(MmPagingFile[MmNumberOfPagingFiles] == NULL); MmPagingFile[MmNumberOfPagingFiles] = PagingFile; MmNumberOfPagingFiles++; - MiFreeSwapPages = MiFreeSwapPages + PagingFile->FreePages; + MiFreeSwapPages = MiFreeSwapPages + PagingFile->FreeSpace; KeReleaseGuardedMutex(&MmPageFileCreationLock); MmSwapSpaceMessage = FALSE;
6 years, 4 months
1
0
0
0
06/07: [NTOSKRNL] Store page file sizes in pages, not in bytes
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e392bdf962d278fa7ee7d…
commit e392bdf962d278fa7ee7dd0c2aeaf6658d8bef03 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu Aug 16 13:50:16 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu Aug 16 13:50:16 2018 +0200 [NTOSKRNL] Store page file sizes in pages, not in bytes --- ntoskrnl/include/internal/mm.h | 6 +++--- ntoskrnl/mm/pagefile.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h index 9739d62709..ca82fd87d9 100644 --- a/ntoskrnl/include/internal/mm.h +++ b/ntoskrnl/include/internal/mm.h @@ -426,9 +426,9 @@ extern MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]; /* Page file information */ typedef struct _MMPAGING_FILE { - LARGE_INTEGER CurrentSize; - LARGE_INTEGER MaximumSize; - LARGE_INTEGER MinimumSize; + PFN_NUMBER CurrentSize; + PFN_NUMBER MaximumSize; + PFN_NUMBER MinimumSize; PFN_NUMBER FreePages; PFN_NUMBER UsedPages; PFILE_OBJECT FileObject; diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c index 784495d444..dd24fe7d5b 100644 --- a/ntoskrnl/mm/pagefile.c +++ b/ntoskrnl/mm/pagefile.c @@ -635,7 +635,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, } /* Don't allow page file shrinking */ - if (PagingFile->MinimumSize.QuadPart > SafeMinimumSize.QuadPart) + if (PagingFile->MinimumSize > (SafeMinimumSize.QuadPart >> PAGE_SHIFT)) { KeReleaseGuardedMutex(&MmPageFileCreationLock); ObDereferenceObject(FileObject); @@ -645,7 +645,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, return STATUS_INVALID_PARAMETER_2; } - if (SafeMaximumSize.QuadPart < PagingFile->MaximumSize.QuadPart) + if ((SafeMaximumSize.QuadPart >> PAGE_SHIFT) < PagingFile->MaximumSize) { KeReleaseGuardedMutex(&MmPageFileCreationLock); ObDereferenceObject(FileObject); @@ -740,9 +740,9 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, PagingFile->FileHandle = FileHandle; PagingFile->FileObject = FileObject; - PagingFile->MaximumSize.QuadPart = SafeMaximumSize.QuadPart; - PagingFile->CurrentSize.QuadPart = SafeMinimumSize.QuadPart; - PagingFile->MinimumSize.QuadPart = SafeMinimumSize.QuadPart; + PagingFile->MaximumSize = (SafeMaximumSize.QuadPart >> PAGE_SHIFT); + PagingFile->CurrentSize = (SafeMinimumSize.QuadPart >> PAGE_SHIFT); + PagingFile->MinimumSize = (SafeMinimumSize.QuadPart >> PAGE_SHIFT); PagingFile->FreePages = (ULONG)(SafeMinimumSize.QuadPart / PAGE_SIZE); PagingFile->UsedPages = 0; PagingFile->PageFileName = PageFileName;
6 years, 4 months
1
0
0
0
05/07: [NTOSKRNL] Store page file minimum size and use it to prevent page file shrinking
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2fe4e71383e0196bb8157…
commit 2fe4e71383e0196bb815745469da05dd9137b3eb Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu Aug 16 13:41:16 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu Aug 16 13:41:16 2018 +0200 [NTOSKRNL] Store page file minimum size and use it to prevent page file shrinking --- ntoskrnl/include/internal/mm.h | 10 +++++----- ntoskrnl/mm/pagefile.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h index 38b34cd74f..9739d62709 100644 --- a/ntoskrnl/include/internal/mm.h +++ b/ntoskrnl/include/internal/mm.h @@ -426,15 +426,15 @@ extern MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]; /* Page file information */ typedef struct _MMPAGING_FILE { - PFILE_OBJECT FileObject; - HANDLE FileHandle; - LARGE_INTEGER MaximumSize; LARGE_INTEGER CurrentSize; + LARGE_INTEGER MaximumSize; + LARGE_INTEGER MinimumSize; PFN_NUMBER FreePages; PFN_NUMBER UsedPages; - PRTL_BITMAP AllocMap; - KSPIN_LOCK AllocMapLock; + PFILE_OBJECT FileObject; UNICODE_STRING PageFileName; + PRTL_BITMAP AllocMap; + HANDLE FileHandle; } MMPAGING_FILE, *PMMPAGING_FILE; diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c index 15d8ae0033..784495d444 100644 --- a/ntoskrnl/mm/pagefile.c +++ b/ntoskrnl/mm/pagefile.c @@ -634,6 +634,27 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, return STATUS_NOT_FOUND; } + /* Don't allow page file shrinking */ + if (PagingFile->MinimumSize.QuadPart > SafeMinimumSize.QuadPart) + { + KeReleaseGuardedMutex(&MmPageFileCreationLock); + ObDereferenceObject(FileObject); + ZwClose(FileHandle); + ExFreePoolWithTag(Dacl, 'lcaD'); + ExFreePoolWithTag(Buffer, TAG_MM); + return STATUS_INVALID_PARAMETER_2; + } + + if (SafeMaximumSize.QuadPart < PagingFile->MaximumSize.QuadPart) + { + KeReleaseGuardedMutex(&MmPageFileCreationLock); + ObDereferenceObject(FileObject); + ZwClose(FileHandle); + ExFreePoolWithTag(Dacl, 'lcaD'); + ExFreePoolWithTag(Buffer, TAG_MM); + return STATUS_INVALID_PARAMETER_3; + } + /* FIXME: implement parameters checking and page file extension */ UNIMPLEMENTED; @@ -721,6 +742,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, PagingFile->FileObject = FileObject; PagingFile->MaximumSize.QuadPart = SafeMaximumSize.QuadPart; PagingFile->CurrentSize.QuadPart = SafeMinimumSize.QuadPart; + PagingFile->MinimumSize.QuadPart = SafeMinimumSize.QuadPart; PagingFile->FreePages = (ULONG)(SafeMinimumSize.QuadPart / PAGE_SIZE); PagingFile->UsedPages = 0; PagingFile->PageFileName = PageFileName;
6 years, 4 months
1
0
0
0
04/07: [NTOSKRNL] Page files don't have an init size, but a minimum size
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bfc6a7957c8afb64244fc…
commit bfc6a7957c8afb64244fce59450a56fd2219b8ee Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu Aug 16 12:42:34 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu Aug 16 12:42:34 2018 +0200 [NTOSKRNL] Page files don't have an init size, but a minimum size NFC --- ntoskrnl/mm/pagefile.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c index 38c93d6559..15d8ae0033 100644 --- a/ntoskrnl/mm/pagefile.c +++ b/ntoskrnl/mm/pagefile.c @@ -345,7 +345,7 @@ MmAllocSwapPage(VOID) NTSTATUS NTAPI NtCreatePagingFile(IN PUNICODE_STRING FileName, - IN PLARGE_INTEGER InitialSize, + IN PLARGE_INTEGER MinimumSize, IN PLARGE_INTEGER MaximumSize, IN ULONG Reserved) { @@ -359,14 +359,14 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, ULONG Count; KPROCESSOR_MODE PreviousMode; UNICODE_STRING PageFileName; - LARGE_INTEGER SafeInitialSize, SafeMaximumSize, AllocationSize; + LARGE_INTEGER SafeMinimumSize, SafeMaximumSize, AllocationSize; FILE_FS_DEVICE_INFORMATION FsDeviceInfo; SECURITY_DESCRIPTOR SecurityDescriptor; PACL Dacl; PWSTR Buffer; - DPRINT("NtCreatePagingFile(FileName %wZ, InitialSize %I64d)\n", - FileName, InitialSize->QuadPart); + DPRINT("NtCreatePagingFile(FileName %wZ, MinimumSize %I64d)\n", + FileName, MinimumSize->QuadPart); PAGED_CODE(); @@ -386,7 +386,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, _SEH2_TRY { - SafeInitialSize = ProbeForReadLargeInteger(InitialSize); + SafeMinimumSize = ProbeForReadLargeInteger(MinimumSize); SafeMaximumSize = ProbeForReadLargeInteger(MaximumSize); PageFileName.Length = FileName->Length; @@ -402,7 +402,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, } else { - SafeInitialSize = *InitialSize; + SafeMinimumSize = *MinimumSize; SafeMaximumSize = *MaximumSize; PageFileName.Length = FileName->Length; @@ -412,7 +412,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, /* Pagefiles can't be larger than 4GB and ofcourse the minimum should be smaller than the maximum */ - if (0 != SafeInitialSize.u.HighPart) + if (0 != SafeMinimumSize.u.HighPart) { return STATUS_INVALID_PARAMETER_2; } @@ -420,7 +420,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, { return STATUS_INVALID_PARAMETER_3; } - if (SafeMaximumSize.u.LowPart < SafeInitialSize.u.LowPart) + if (SafeMaximumSize.u.LowPart < SafeMinimumSize.u.LowPart) { return STATUS_INVALID_PARAMETER_MIX; } @@ -535,7 +535,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, * of the paging file is cluster 3042 but cluster 3043 is NOT part of the * paging file but of another file. We can't write a complete page (4096 * bytes) to the physical location of cluster 3042 then. */ - AllocationSize.QuadPart = SafeInitialSize.QuadPart + PAGE_SIZE; + AllocationSize.QuadPart = SafeMinimumSize.QuadPart + PAGE_SIZE; /* First, attempt to replace the page file, if existing */ Status = IoCreateFile(&FileHandle, @@ -669,10 +669,10 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, /* DACL is no longer needed, free it */ ExFreePoolWithTag(Dacl, 'lcaD'); - /* Set its end of file to initial size */ + /* Set its end of file to minimal size */ Status = ZwSetInformationFile(FileHandle, &IoStatus, - &SafeInitialSize, + &SafeMinimumSize, sizeof(LARGE_INTEGER), FileEndOfFileInformation); if (!NT_SUCCESS(Status) || !NT_SUCCESS(IoStatus.Status)) @@ -720,8 +720,8 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, PagingFile->FileHandle = FileHandle; PagingFile->FileObject = FileObject; PagingFile->MaximumSize.QuadPart = SafeMaximumSize.QuadPart; - PagingFile->CurrentSize.QuadPart = SafeInitialSize.QuadPart; - PagingFile->FreePages = (ULONG)(SafeInitialSize.QuadPart / PAGE_SIZE); + PagingFile->CurrentSize.QuadPart = SafeMinimumSize.QuadPart; + PagingFile->FreePages = (ULONG)(SafeMinimumSize.QuadPart / PAGE_SIZE); PagingFile->UsedPages = 0; PagingFile->PageFileName = PageFileName;
6 years, 4 months
1
0
0
0
03/07: [NTOSKRNL] Drop the MmPagingFile spin lock in favor of a guarded mutex
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=315867d4ffe456e9e222e…
commit 315867d4ffe456e9e222e72577357e9322129681 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu Aug 16 12:39:24 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu Aug 16 12:39:24 2018 +0200 [NTOSKRNL] Drop the MmPagingFile spin lock in favor of a guarded mutex --- ntoskrnl/mm/pagefile.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c index b5f9c4faaa..38c93d6559 100644 --- a/ntoskrnl/mm/pagefile.c +++ b/ntoskrnl/mm/pagefile.c @@ -44,7 +44,7 @@ PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES]; /* Lock for examining the list of paging files */ -static KSPIN_LOCK PagingFileListLock; +KGUARDED_MUTEX MmPageFileCreationLock; /* Number of paging files */ ULONG MmNumberOfPagingFiles; @@ -258,7 +258,7 @@ MmInitPagingFile(VOID) { ULONG i; - KeInitializeSpinLock(&PagingFileListLock); + KeInitializeGuardedMutex(&MmPageFileCreationLock); MiFreeSwapPages = 0; MiUsedSwapPages = 0; @@ -277,13 +277,12 @@ MmFreeSwapPage(SWAPENTRY Entry) { ULONG i; ULONG_PTR off; - KIRQL oldIrql; PMMPAGING_FILE PagingFile; i = FILE_FROM_ENTRY(Entry); off = OFFSET_FROM_ENTRY(Entry) - 1; - KeAcquireSpinLock(&PagingFileListLock, &oldIrql); + KeAcquireGuardedMutex(&MmPageFileCreationLock); PagingFile = MmPagingFile[i]; if (PagingFile == NULL) @@ -299,23 +298,22 @@ MmFreeSwapPage(SWAPENTRY Entry) MiFreeSwapPages++; MiUsedSwapPages--; - KeReleaseSpinLock(&PagingFileListLock, oldIrql); + KeReleaseGuardedMutex(&MmPageFileCreationLock); } SWAPENTRY NTAPI MmAllocSwapPage(VOID) { - KIRQL oldIrql; ULONG i; ULONG off; SWAPENTRY entry; - KeAcquireSpinLock(&PagingFileListLock, &oldIrql); + KeAcquireGuardedMutex(&MmPageFileCreationLock); if (MiFreeSwapPages == 0) { - KeReleaseSpinLock(&PagingFileListLock, oldIrql); + KeReleaseGuardedMutex(&MmPageFileCreationLock); return(0); } @@ -328,19 +326,19 @@ MmAllocSwapPage(VOID) if (off == 0xFFFFFFFF) { KeBugCheck(MEMORY_MANAGEMENT); - KeReleaseSpinLock(&PagingFileListLock, oldIrql); + KeReleaseGuardedMutex(&MmPageFileCreationLock); return(STATUS_UNSUCCESSFUL); } MiUsedSwapPages++; MiFreeSwapPages--; - KeReleaseSpinLock(&PagingFileListLock, oldIrql); + KeReleaseGuardedMutex(&MmPageFileCreationLock); entry = ENTRY_FROM_FILE_OFFSET(i, off + 1); return(entry); } } - KeReleaseSpinLock(&PagingFileListLock, oldIrql); + KeReleaseGuardedMutex(&MmPageFileCreationLock); KeBugCheck(MEMORY_MANAGEMENT); return(0); } @@ -357,7 +355,6 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, IO_STATUS_BLOCK IoStatus; PFILE_OBJECT FileObject; PMMPAGING_FILE PagingFile; - KIRQL oldIrql; ULONG AllocMapSize; ULONG Count; KPROCESSOR_MODE PreviousMode; @@ -371,6 +368,8 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, DPRINT("NtCreatePagingFile(FileName %wZ, InitialSize %I64d)\n", FileName, InitialSize->QuadPart); + PAGED_CODE(); + if (MmNumberOfPagingFiles >= MAX_PAGING_FILES) { return STATUS_TOO_MANY_PAGING_FILES; @@ -602,6 +601,11 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, /* Find if it matches a previous page file */ PagingFile = NULL; + + /* FIXME: should be calling unsafe instead, + * we should already be in a guarded region + */ + KeAcquireGuardedMutex(&MmPageFileCreationLock); if (MmNumberOfPagingFiles > 0) { i = 0; @@ -622,6 +626,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, /* If we didn't find the page file, fail */ if (PagingFile == NULL) { + KeReleaseGuardedMutex(&MmPageFileCreationLock); ObDereferenceObject(FileObject); ZwClose(FileHandle); ExFreePoolWithTag(Dacl, 'lcaD'); @@ -632,6 +637,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, /* FIXME: implement parameters checking and page file extension */ UNIMPLEMENTED; + KeReleaseGuardedMutex(&MmPageFileCreationLock); ObDereferenceObject(FileObject); ZwClose(FileHandle); ExFreePoolWithTag(Dacl, 'lcaD'); @@ -737,12 +743,15 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, (ULONG)(PagingFile->FreePages)); RtlClearAllBits(PagingFile->AllocMap); - KeAcquireSpinLock(&PagingFileListLock, &oldIrql); + /* FIXME: should be calling unsafe instead, + * we should already be in a guarded region + */ + KeAcquireGuardedMutex(&MmPageFileCreationLock); ASSERT(MmPagingFile[MmNumberOfPagingFiles] == NULL); MmPagingFile[MmNumberOfPagingFiles] = PagingFile; MmNumberOfPagingFiles++; MiFreeSwapPages = MiFreeSwapPages + PagingFile->FreePages; - KeReleaseSpinLock(&PagingFileListLock, oldIrql); + KeReleaseGuardedMutex(&MmPageFileCreationLock); MmSwapSpaceMessage = FALSE;
6 years, 4 months
1
0
0
0
02/07: [NTOSKRNL] Drop the alloc map from page file
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=891a6eeeb926342a49d88…
commit 891a6eeeb926342a49d88953c5e611bc4a48fa1e Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Thu Aug 16 12:16:39 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Thu Aug 16 12:16:39 2018 +0200 [NTOSKRNL] Drop the alloc map from page file It was making no sense, and implemented in a broken way that couldn't have worked if code path was used. --- ntoskrnl/mm/pagefile.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c index dba39b7653..b5f9c4faaa 100644 --- a/ntoskrnl/mm/pagefile.c +++ b/ntoskrnl/mm/pagefile.c @@ -271,19 +271,6 @@ MmInitPagingFile(VOID) MmNumberOfPagingFiles = 0; } -static ULONG -MiAllocPageFromPagingFile(PMMPAGING_FILE PagingFile) -{ - KIRQL oldIrql; - ULONG off; - - KeAcquireSpinLock(&PagingFile->AllocMapLock, &oldIrql); - off = RtlFindClearBitsAndSet(PagingFile->AllocMap, 1, 0); - KeReleaseSpinLock(&PagingFile->AllocMapLock, oldIrql); - - return off; -} - VOID NTAPI MmFreeSwapPage(SWAPENTRY Entry) @@ -303,7 +290,6 @@ MmFreeSwapPage(SWAPENTRY Entry) { KeBugCheck(MEMORY_MANAGEMENT); } - KeAcquireSpinLockAtDpcLevel(&PagingFile->AllocMapLock); RtlClearBit(PagingFile->AllocMap, off >> 5); @@ -313,7 +299,6 @@ MmFreeSwapPage(SWAPENTRY Entry) MiFreeSwapPages++; MiUsedSwapPages--; - KeReleaseSpinLockFromDpcLevel(&PagingFile->AllocMapLock); KeReleaseSpinLock(&PagingFileListLock, oldIrql); } @@ -339,7 +324,7 @@ MmAllocSwapPage(VOID) if (MmPagingFile[i] != NULL && MmPagingFile[i]->FreePages >= 1) { - off = MiAllocPageFromPagingFile(MmPagingFile[i]); + off = RtlFindClearBitsAndSet(MmPagingFile[i]->AllocMap, 1, 0); if (off == 0xFFFFFFFF) { KeBugCheck(MEMORY_MANAGEMENT); @@ -732,7 +717,6 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, PagingFile->CurrentSize.QuadPart = SafeInitialSize.QuadPart; PagingFile->FreePages = (ULONG)(SafeInitialSize.QuadPart / PAGE_SIZE); PagingFile->UsedPages = 0; - KeInitializeSpinLock(&PagingFile->AllocMapLock); PagingFile->PageFileName = PageFileName; AllocMapSize = sizeof(RTL_BITMAP) + (((PagingFile->FreePages + 31) / 32) * sizeof(ULONG));
6 years, 4 months
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
31
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Results per page:
10
25
50
100
200