mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
[NTOS:MM] Do not use PAGE_ROUND_DOWN for LONGLONG values (#7603)
PAGE_ROUND_DOWN macro seems to not work correctly with LONGLONG values. It creates some random freezes in the 1st-stage setup after commit 69bf140506
.
It's fixed by creating PAGE_ROUND_UP_64 and PAGE_ROUND_DOWN_64 macros for 64-bit only data types.
---------
Co-authored-by: Thamatip Chitpong <thamatip.chitpong@reactos.org>
This commit is contained in:
parent
190f710942
commit
6ada5978d0
2 changed files with 11 additions and 4 deletions
|
@ -131,6 +131,13 @@ typedef ULONG_PTR SWAPENTRY;
|
|||
#define MM_ROUND_DOWN(x,s) \
|
||||
((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
|
||||
|
||||
/* PAGE_ROUND_UP and PAGE_ROUND_DOWN equivalent, with support for 64-bit-only data types */
|
||||
#define PAGE_ROUND_UP_64(x) \
|
||||
(((x) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|
||||
|
||||
#define PAGE_ROUND_DOWN_64(x) \
|
||||
((x) & ~(PAGE_SIZE - 1))
|
||||
|
||||
#define PAGE_FLAGS_VALID_FOR_SECTION \
|
||||
(PAGE_READONLY | \
|
||||
PAGE_READWRITE | \
|
||||
|
|
|
@ -4876,7 +4876,7 @@ MmPurgeSegment(
|
|||
}
|
||||
|
||||
/* Find byte offset of the page to start */
|
||||
PurgeStart.QuadPart = PAGE_ROUND_DOWN(PurgeStart.QuadPart);
|
||||
PurgeStart.QuadPart = PAGE_ROUND_DOWN_64(PurgeStart.QuadPart);
|
||||
|
||||
while (PurgeStart.QuadPart < PurgeEnd.QuadPart)
|
||||
{
|
||||
|
@ -4947,7 +4947,7 @@ MmIsDataSectionResident(
|
|||
return FALSE;
|
||||
|
||||
/* Find byte offset of the page to start */
|
||||
RangeStart.QuadPart = PAGE_ROUND_DOWN(RangeStart.QuadPart);
|
||||
RangeStart.QuadPart = PAGE_ROUND_DOWN_64(RangeStart.QuadPart);
|
||||
|
||||
MmLockSectionSegment(Segment);
|
||||
|
||||
|
@ -5010,7 +5010,7 @@ MmMakeSegmentDirty(
|
|||
return STATUS_NOT_MAPPED_VIEW;
|
||||
|
||||
/* Find byte offset of the page to start */
|
||||
RangeStart.QuadPart = PAGE_ROUND_DOWN(RangeStart.QuadPart);
|
||||
RangeStart.QuadPart = PAGE_ROUND_DOWN_64(RangeStart.QuadPart);
|
||||
|
||||
MmLockSectionSegment(Segment);
|
||||
|
||||
|
@ -5098,7 +5098,7 @@ MmFlushSegment(
|
|||
}
|
||||
|
||||
/* Find byte offset of the page to start */
|
||||
FlushStart.QuadPart = PAGE_ROUND_DOWN(FlushStart.QuadPart);
|
||||
FlushStart.QuadPart = PAGE_ROUND_DOWN_64(FlushStart.QuadPart);
|
||||
|
||||
while (FlushStart.QuadPart < FlushEnd.QuadPart)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue