Author: tkreuzer
Date: Sat May 16 20:10:26 2015
New Revision: 67786
URL:
http://svn.reactos.org/svn/reactos?rev=67786&view=rev
Log:
[NTOSKRNL]
Convert MEMORY_AREA::EndingAddress to EndingVpn
Modified:
trunk/reactos/ntoskrnl/cache/section/data.c
trunk/reactos/ntoskrnl/cache/section/fault.c
trunk/reactos/ntoskrnl/cache/section/swapout.c
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
trunk/reactos/ntoskrnl/mm/marea.c
trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/cache/section/data.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/dat…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] Sat May 16 20:10:26 2015
@@ -161,7 +161,7 @@
return STATUS_NOT_MAPPED_DATA;
}
BeginningAddress = PAGE_ROUND_DOWN(MA_GetStartingAddress(MemoryArea));
- EndingAddress = PAGE_ROUND_UP((ULONG_PTR)MemoryArea->EndingAddress);
+ EndingAddress = PAGE_ROUND_UP(MA_GetEndingAddress(MemoryArea));
Segment = MemoryArea->Data.SectionData.Segment;
ViewOffset.QuadPart = MemoryArea->Data.SectionData.ViewOffset.QuadPart;
Modified: trunk/reactos/ntoskrnl/cache/section/fault.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/fau…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/fault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/fault.c [iso-8859-1] Sat May 16 20:10:26 2015
@@ -123,7 +123,7 @@
AddressSpace,
Address,
MA_GetStartingAddress(MemoryArea),
- MemoryArea->EndingAddress);
+ MA_GetEndingAddress(MemoryArea));
/*
* There is a window between taking the page fault and locking the
@@ -585,7 +585,7 @@
DPRINT("Type %x (%p -> %p)\n",
MemoryArea->Type,
MA_GetStartingAddress(MemoryArea),
- MemoryArea->EndingAddress);
+ MA_GetEndingAddress(MemoryArea));
Resources.DoAcquisition = NULL;
@@ -661,7 +661,7 @@
DPRINT1("Type %x (%p -> %p)\n",
MemoryArea->Type,
MA_GetStartingAddress(MemoryArea),
- MemoryArea->EndingAddress);
+ MA_GetEndingAddress(MemoryArea));
}
if (!FromMdl)
@@ -790,7 +790,7 @@
MemoryArea->Type,
MA_GetStartingAddress(MemoryArea),
Address,
- MemoryArea->EndingAddress,
+ MA_GetEndingAddress(MemoryArea),
PsGetCurrentThread());
Resources.DoAcquisition = NULL;
Modified: trunk/reactos/ntoskrnl/cache/section/swapout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/swa…
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] Sat May 16 20:10:26 2015
@@ -458,7 +458,7 @@
DPRINTC("Type %x (%p -> %p)\n",
MemoryArea->Type,
MA_GetStartingAddress(MemoryArea),
- MemoryArea->EndingAddress);
+ MA_GetEndingAddress(MemoryArea));
Resources.DoAcquisition = NULL;
Resources.Page[0] = Page;
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sat May 16 20:10:26 2015
@@ -205,7 +205,7 @@
typedef struct _MEMORY_AREA
{
ULONG_PTR StartingVpn;
- ULONG_PTR EndingAddress;
+ ULONG_PTR EndingVpn;
struct _MEMORY_AREA *Parent;
struct _MEMORY_AREA *LeftChild;
struct _MEMORY_AREA *RightChild;
Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Sat May 16 20:10:26 2015
@@ -1886,7 +1886,7 @@
if (!NT_SUCCESS(Status))
{
DPRINT1("MmQuerySectionView failed. MemoryArea=%p (%p-%p),
BaseAddress=%p\n",
- MemoryArea, MA_GetStartingAddress(MemoryArea),
MemoryArea->EndingAddress, BaseAddress);
+ MemoryArea, MA_GetStartingAddress(MemoryArea),
MA_GetEndingAddress(MemoryArea), BaseAddress);
NT_ASSERT(NT_SUCCESS(Status));
}
}
@@ -5317,10 +5317,10 @@
Vad->u.VadFlags.CommitCharge -= CommitReduction;
// For ReactOS: shrink the corresponding memory area
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
(PVOID)StartingAddress);
- ASSERT(Vad->StartingVpn << PAGE_SHIFT ==
MA_GetStartingAddress(MemoryArea));
- ASSERT((Vad->EndingVpn + 1) << PAGE_SHIFT ==
MemoryArea->EndingAddress);
+ ASSERT(Vad->StartingVpn == MemoryArea->StartingVpn);
+ ASSERT(Vad->EndingVpn == MemoryArea->EndingVpn);
Vad->EndingVpn = (StartingAddress - 1) >> PAGE_SHIFT;
- MemoryArea->EndingAddress = StartingAddress;
+ MemoryArea->EndingVpn = Vad->EndingVpn;
}
else
{
Modified: trunk/reactos/ntoskrnl/mm/marea.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/marea.c?rev=67…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/marea.c [iso-8859-1] Sat May 16 20:10:26 2015
@@ -174,12 +174,12 @@
{
if (Address < MA_GetStartingAddress(Node))
Node = Node->LeftChild;
- else if (Address >= Node->EndingAddress)
+ else if (Address >= MA_GetEndingAddress(Node))
Node = Node->RightChild;
else
{
DPRINT("MmLocateMemoryAreaByAddress(%p): %p [%p - %p]\n",
- Address, Node, MA_GetStartingAddress(Node), Node->EndingAddress);
+ Address, Node, MA_GetStartingAddress(Node),
MA_GetEndingAddress(Node));
return Node;
}
}
@@ -212,23 +212,23 @@
{
DPRINT("MmLocateMemoryAreaByRegion(%p - %p): %p - %p\n",
Address, (ULONG_PTR)Address + Length, MA_GetStartingAddress(Node),
- Node->EndingAddress);
+ MA_GetEndingAddress(Node));
return Node;
}
- if (Node->EndingAddress > Address &&
- Node->EndingAddress < Extent)
+ if (MA_GetEndingAddress(Node) > Address &&
+ MA_GetEndingAddress(Node) < Extent)
{
DPRINT("MmLocateMemoryAreaByRegion(%p - %p): %p - %p\n",
Address, (ULONG_PTR)Address + Length, MA_GetStartingAddress(Node),
- Node->EndingAddress);
+ MA_GetEndingAddress(Node));
return Node;
}
if (MA_GetStartingAddress(Node) <= Address &&
- Node->EndingAddress >= Extent)
+ MA_GetEndingAddress(Node) >= Extent)
{
DPRINT("MmLocateMemoryAreaByRegion(%p - %p): %p - %p\n",
Address, (ULONG_PTR)Address + Length, MA_GetStartingAddress(Node),
- Node->EndingAddress);
+ MA_GetEndingAddress(Node));
return Node;
}
if (MA_GetStartingAddress(Node) >= Extent)
@@ -378,7 +378,7 @@
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
/* Build a lame VAD if this is a user-space allocation */
- if ((marea->EndingAddress < (ULONG_PTR)MmSystemRangeStart) &&
+ if ((MA_GetEndingAddress(marea) < (ULONG_PTR)MmSystemRangeStart) &&
(marea->Type != MEMORY_AREA_OWNED_BY_ARM3))
{
PMMVAD Vad;
@@ -393,9 +393,9 @@
* In a normal OS/Memory Manager, this would be retarded, but ReactOS allows this
(how it works
* I don't even want to know).
*/
- if (marea->EndingAddress != MA_GetStartingAddress(marea))
- {
- Vad->EndingVpn = PAGE_ROUND_DOWN((ULONG_PTR)marea->EndingAddress - 1)
>> PAGE_SHIFT;
+ if (MA_GetEndingAddress(marea) != MA_GetStartingAddress(marea))
+ {
+ Vad->EndingVpn = PAGE_ROUND_DOWN((ULONG_PTR)MA_GetEndingAddress(marea) -
1) >> PAGE_SHIFT;
}
else
{
@@ -423,12 +423,12 @@
Node = (PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink;
do
{
- DPRINT("marea->EndingAddress: %p Node->StartingAddress: %p\n",
- marea->EndingAddress, MA_GetStartingAddress(Node));
- DPRINT("marea->StartingAddress: %p Node->EndingAddress: %p\n",
- MA_GetStartingAddress(marea), Node->EndingAddress);
- ASSERT(marea->EndingAddress <= MA_GetStartingAddress(Node) ||
- MA_GetStartingAddress(marea) >= Node->EndingAddress);
+ DPRINT("MA_GetEndingAddress(marea): %p Node->StartingAddress:
%p\n",
+ MA_GetEndingAddress(marea), MA_GetStartingAddress(Node));
+ DPRINT("marea->StartingAddress: %p MA_GetEndingAddress(Node):
%p\n",
+ MA_GetStartingAddress(marea), MA_GetEndingAddress(Node));
+ ASSERT(MA_GetEndingAddress(marea) <= MA_GetStartingAddress(Node) ||
+ MA_GetStartingAddress(marea) >= MA_GetEndingAddress(Node));
ASSERT(MA_GetStartingAddress(marea) != MA_GetStartingAddress(Node));
PreviousNode = Node;
@@ -490,13 +490,13 @@
/* Go to the node with lowest address in the tree. */
Node = Root ? MmIterateFirstNode(Root) : NULL;
- while (Node && ((ULONG_PTR)Node->EndingAddress < LowestAddress))
+ while (Node && ((ULONG_PTR)MA_GetEndingAddress(Node) < LowestAddress))
{
Node = MmIterateNextNode(Node);
}
/* Traverse the tree from low to high addresses */
- while (Node && ((ULONG_PTR)Node->EndingAddress < HighestAddress))
+ while (Node && ((ULONG_PTR)MA_GetEndingAddress(Node) < HighestAddress))
{
/* Check if the memory area fits before the current node */
if (MA_GetStartingAddress(Node) >= (Candidate + Length))
@@ -507,10 +507,10 @@
}
/* Calculate next possible adress above this node */
- Candidate = ALIGN_UP_BY((ULONG_PTR)Node->EndingAddress, Granularity);
+ Candidate = ALIGN_UP_BY((ULONG_PTR)MA_GetEndingAddress(Node), Granularity);
/* Check for overflow */
- if ((Candidate + Length) < (ULONG_PTR)Node->EndingAddress) return NULL;
+ if ((Candidate + Length) < (ULONG_PTR)MA_GetEndingAddress(Node)) return NULL;
/* Go to the next higher node */
Node = MmIterateNextNode(Node);
@@ -570,7 +570,7 @@
while (Node && (MA_GetStartingAddress(Node) > LowestAddress))
{
/* Check if the memory area fits after the current node */
- if ((ULONG_PTR)Node->EndingAddress <= Candidate)
+ if ((ULONG_PTR)MA_GetEndingAddress(Node) <= Candidate)
{
DPRINT("MmFindGapTopDown: %p\n", Candidate);
return (PVOID)Candidate;
@@ -631,9 +631,9 @@
/* Check some fields */
ASSERT(Node->Magic == 'erAM');
ASSERT(PAGE_ALIGN(MA_GetStartingAddress(Node)) ==
(PVOID)MA_GetStartingAddress(Node));
- ASSERT(Node->EndingAddress != 0);
- ASSERT(PAGE_ALIGN(Node->EndingAddress) == (PVOID)Node->EndingAddress);
- ASSERT(MA_GetStartingAddress(Node) < Node->EndingAddress);
+ ASSERT(MA_GetEndingAddress(Node) != 0);
+ ASSERT(PAGE_ALIGN(MA_GetEndingAddress(Node)) == (PVOID)MA_GetEndingAddress(Node));
+ ASSERT(MA_GetStartingAddress(Node) < MA_GetEndingAddress(Node));
ASSERT((Node->Type == 0) ||
(Node->Type == MEMORY_AREA_CACHE) ||
// (Node->Type == MEMORY_AREA_CACHE_SEGMENT) ||
@@ -765,7 +765,7 @@
KeAttachProcess(&Process->Pcb);
}
- EndAddress = MM_ROUND_UP(MemoryArea->EndingAddress, PAGE_SIZE);
+ EndAddress = MM_ROUND_UP(MA_GetEndingAddress(MemoryArea), PAGE_SIZE);
for (Address = MA_GetStartingAddress(MemoryArea);
Address < (ULONG_PTR)EndAddress;
Address += PAGE_SIZE)
@@ -815,7 +815,7 @@
if (MemoryArea->Vad)
{
- ASSERT(MemoryArea->EndingAddress < (ULONG_PTR)MmSystemRangeStart);
+ ASSERT(MA_GetEndingAddress(MemoryArea) < (ULONG_PTR)MmSystemRangeStart);
ASSERT(MemoryArea->Type == MEMORY_AREA_SECTION_VIEW || MemoryArea->Type
== MEMORY_AREA_CACHE);
/* MmCleanProcessAddressSpace might have removed it (and this would be
MmDeleteProcessAdressSpace) */
@@ -1009,7 +1009,7 @@
RtlZeroMemory(MemoryArea, sizeof(MEMORY_AREA));
MemoryArea->Type = Type;
MemoryArea->StartingVpn = (ULONG_PTR)*BaseAddress >> PAGE_SHIFT;
- MemoryArea->EndingAddress = ((ULONG_PTR)*BaseAddress + tmpLength);
+ MemoryArea->EndingVpn = ((ULONG_PTR)*BaseAddress + tmpLength - 1) >>
PAGE_SHIFT;
MemoryArea->Protect = Protect;
MemoryArea->Flags = AllocationFlags;
//MemoryArea->LockCount = 0;
Modified: trunk/reactos/ntoskrnl/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Sat May 16 20:10:26 2015
@@ -2520,7 +2520,7 @@
NTSTATUS Status;
ULONG_PTR MaxLength;
- MaxLength = MemoryArea->EndingAddress - (ULONG_PTR)BaseAddress;
+ MaxLength = MA_GetEndingAddress(MemoryArea) - (ULONG_PTR)BaseAddress;
if (Length > MaxLength)
Length = (ULONG)MaxLength;