mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 19:23:50 +08:00
[NTOSKRNL]
Convert MEMORY_AREA::StartingAddress to StaringVpn svn path=/trunk/; revision=67785
This commit is contained in:
parent
418daaac86
commit
85f59f294f
6
reactos/ntoskrnl/cache/section/data.c
vendored
6
reactos/ntoskrnl/cache/section/data.c
vendored
@ -160,7 +160,7 @@ _MiFlushMappedSection(PVOID BaseAddress,
|
||||
DPRINT("STATUS_NOT_MAPPED_DATA\n");
|
||||
return STATUS_NOT_MAPPED_DATA;
|
||||
}
|
||||
BeginningAddress = PAGE_ROUND_DOWN((ULONG_PTR)MemoryArea->StartingAddress);
|
||||
BeginningAddress = PAGE_ROUND_DOWN(MA_GetStartingAddress(MemoryArea));
|
||||
EndingAddress = PAGE_ROUND_UP((ULONG_PTR)MemoryArea->EndingAddress);
|
||||
Segment = MemoryArea->Data.SectionData.Segment;
|
||||
ViewOffset.QuadPart = MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
@ -681,7 +681,7 @@ MmFreeCacheSectionPage(PVOID Context,
|
||||
Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||
Address = (PVOID)PAGE_ROUND_DOWN(Address);
|
||||
Segment = ContextData[1];
|
||||
Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress +
|
||||
Offset.QuadPart = (ULONG_PTR)Address - MA_GetStartingAddress(MemoryArea) +
|
||||
MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
|
||||
Entry = MmGetPageEntrySectionSegment(Segment, &Offset);
|
||||
@ -732,7 +732,7 @@ MmUnmapViewOfCacheSegment(PMMSUPPORT AddressSpace,
|
||||
|
||||
DPRINT("MmFreeMemoryArea(%p,%p)\n",
|
||||
MmGetAddressSpaceOwner(AddressSpace),
|
||||
MemoryArea->StartingAddress);
|
||||
MA_GetStartingAddress(MemoryArea));
|
||||
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
|
||||
|
12
reactos/ntoskrnl/cache/section/fault.c
vendored
12
reactos/ntoskrnl/cache/section/fault.c
vendored
@ -122,7 +122,7 @@ MmNotPresentFaultCachePage (
|
||||
DPRINT("Not Present: %p %p (%p-%p)\n",
|
||||
AddressSpace,
|
||||
Address,
|
||||
MemoryArea->StartingAddress,
|
||||
MA_GetStartingAddress(MemoryArea),
|
||||
MemoryArea->EndingAddress);
|
||||
|
||||
/*
|
||||
@ -138,7 +138,7 @@ MmNotPresentFaultCachePage (
|
||||
|
||||
PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE);
|
||||
TotalOffset.QuadPart = (ULONG_PTR)PAddress -
|
||||
(ULONG_PTR)MemoryArea->StartingAddress;
|
||||
MA_GetStartingAddress(MemoryArea);
|
||||
|
||||
Segment = MemoryArea->Data.SectionData.Segment;
|
||||
|
||||
@ -345,7 +345,7 @@ MiCowCacheSectionPage (
|
||||
|
||||
/* Find the offset of the page */
|
||||
PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE);
|
||||
Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress +
|
||||
Offset.QuadPart = (ULONG_PTR)PAddress - MA_GetStartingAddress(MemoryArea) +
|
||||
MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
|
||||
if (!Segment->WriteCopy /*&&
|
||||
@ -584,7 +584,7 @@ MmpSectionAccessFaultInner(KPROCESSOR_MODE Mode,
|
||||
|
||||
DPRINT("Type %x (%p -> %p)\n",
|
||||
MemoryArea->Type,
|
||||
MemoryArea->StartingAddress,
|
||||
MA_GetStartingAddress(MemoryArea),
|
||||
MemoryArea->EndingAddress);
|
||||
|
||||
Resources.DoAcquisition = NULL;
|
||||
@ -660,7 +660,7 @@ MmpSectionAccessFaultInner(KPROCESSOR_MODE Mode,
|
||||
DPRINT1("Completed page fault handling %Ix %x\n", Address, Status);
|
||||
DPRINT1("Type %x (%p -> %p)\n",
|
||||
MemoryArea->Type,
|
||||
MemoryArea->StartingAddress,
|
||||
MA_GetStartingAddress(MemoryArea),
|
||||
MemoryArea->EndingAddress);
|
||||
}
|
||||
|
||||
@ -788,7 +788,7 @@ MmNotPresentFaultCacheSectionInner(KPROCESSOR_MODE Mode,
|
||||
|
||||
DPRINTC("Type %x (%p -> %08Ix -> %p) in %p\n",
|
||||
MemoryArea->Type,
|
||||
MemoryArea->StartingAddress,
|
||||
MA_GetStartingAddress(MemoryArea),
|
||||
Address,
|
||||
MemoryArea->EndingAddress,
|
||||
PsGetCurrentThread());
|
||||
|
5
reactos/ntoskrnl/cache/section/swapout.c
vendored
5
reactos/ntoskrnl/cache/section/swapout.c
vendored
@ -289,7 +289,8 @@ MmPageOutCacheSection(PMMSUPPORT AddressSpace,
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
PVOID PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE);
|
||||
|
||||
TotalOffset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress +
|
||||
TotalOffset.QuadPart = (ULONG_PTR)PAddress -
|
||||
MA_GetStartingAddress(MemoryArea) +
|
||||
MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
|
||||
Segment = MemoryArea->Data.SectionData.Segment;
|
||||
@ -456,7 +457,7 @@ MmpPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||
|
||||
DPRINTC("Type %x (%p -> %p)\n",
|
||||
MemoryArea->Type,
|
||||
MemoryArea->StartingAddress,
|
||||
MA_GetStartingAddress(MemoryArea),
|
||||
MemoryArea->EndingAddress);
|
||||
|
||||
Resources.DoAcquisition = NULL;
|
||||
|
@ -199,9 +199,12 @@ typedef struct _ROS_SECTION_OBJECT
|
||||
};
|
||||
} ROS_SECTION_OBJECT, *PROS_SECTION_OBJECT;
|
||||
|
||||
#define MA_GetStartingAddress(_MemoryArea) ((_MemoryArea)->StartingVpn << PAGE_SHIFT)
|
||||
#define MA_GetEndingAddress(_MemoryArea) (((_MemoryArea)->EndingVpn + 1) << PAGE_SHIFT)
|
||||
|
||||
typedef struct _MEMORY_AREA
|
||||
{
|
||||
ULONG_PTR StartingAddress;
|
||||
ULONG_PTR StartingVpn;
|
||||
ULONG_PTR EndingAddress;
|
||||
struct _MEMORY_AREA *Parent;
|
||||
struct _MEMORY_AREA *LeftChild;
|
||||
|
@ -1886,7 +1886,7 @@ MiQueryMemoryBasicInformation(IN HANDLE ProcessHandle,
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("MmQuerySectionView failed. MemoryArea=%p (%p-%p), BaseAddress=%p\n",
|
||||
MemoryArea, MemoryArea->StartingAddress, MemoryArea->EndingAddress, BaseAddress);
|
||||
MemoryArea, MA_GetStartingAddress(MemoryArea), MemoryArea->EndingAddress, BaseAddress);
|
||||
NT_ASSERT(NT_SUCCESS(Status));
|
||||
}
|
||||
}
|
||||
@ -5317,7 +5317,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||
Vad->u.VadFlags.CommitCharge -= CommitReduction;
|
||||
// For ReactOS: shrink the corresponding memory area
|
||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, (PVOID)StartingAddress);
|
||||
ASSERT(Vad->StartingVpn << PAGE_SHIFT == MemoryArea->StartingAddress);
|
||||
ASSERT(Vad->StartingVpn << PAGE_SHIFT == MA_GetStartingAddress(MemoryArea));
|
||||
ASSERT((Vad->EndingVpn + 1) << PAGE_SHIFT == MemoryArea->EndingAddress);
|
||||
Vad->EndingVpn = (StartingAddress - 1) >> PAGE_SHIFT;
|
||||
MemoryArea->EndingAddress = StartingAddress;
|
||||
|
@ -172,14 +172,14 @@ MmLocateMemoryAreaByAddress(
|
||||
|
||||
while (Node != NULL)
|
||||
{
|
||||
if (Address < Node->StartingAddress)
|
||||
if (Address < MA_GetStartingAddress(Node))
|
||||
Node = Node->LeftChild;
|
||||
else if (Address >= Node->EndingAddress)
|
||||
Node = Node->RightChild;
|
||||
else
|
||||
{
|
||||
DPRINT("MmLocateMemoryAreaByAddress(%p): %p [%p - %p]\n",
|
||||
Address, Node, Node->StartingAddress, Node->EndingAddress);
|
||||
Address, Node, MA_GetStartingAddress(Node), Node->EndingAddress);
|
||||
return Node;
|
||||
}
|
||||
}
|
||||
@ -207,11 +207,11 @@ MmLocateMemoryAreaByRegion(
|
||||
Node != NULL;
|
||||
Node = MmIterateNextNode(Node))
|
||||
{
|
||||
if (Node->StartingAddress >= Address &&
|
||||
Node->StartingAddress < Extent)
|
||||
if (MA_GetStartingAddress(Node) >= Address &&
|
||||
MA_GetStartingAddress(Node) < Extent)
|
||||
{
|
||||
DPRINT("MmLocateMemoryAreaByRegion(%p - %p): %p - %p\n",
|
||||
Address, (ULONG_PTR)Address + Length, Node->StartingAddress,
|
||||
Address, (ULONG_PTR)Address + Length, MA_GetStartingAddress(Node),
|
||||
Node->EndingAddress);
|
||||
return Node;
|
||||
}
|
||||
@ -219,19 +219,19 @@ MmLocateMemoryAreaByRegion(
|
||||
Node->EndingAddress < Extent)
|
||||
{
|
||||
DPRINT("MmLocateMemoryAreaByRegion(%p - %p): %p - %p\n",
|
||||
Address, (ULONG_PTR)Address + Length, Node->StartingAddress,
|
||||
Address, (ULONG_PTR)Address + Length, MA_GetStartingAddress(Node),
|
||||
Node->EndingAddress);
|
||||
return Node;
|
||||
}
|
||||
if (Node->StartingAddress <= Address &&
|
||||
if (MA_GetStartingAddress(Node) <= Address &&
|
||||
Node->EndingAddress >= Extent)
|
||||
{
|
||||
DPRINT("MmLocateMemoryAreaByRegion(%p - %p): %p - %p\n",
|
||||
Address, (ULONG_PTR)Address + Length, Node->StartingAddress,
|
||||
Address, (ULONG_PTR)Address + Length, MA_GetStartingAddress(Node),
|
||||
Node->EndingAddress);
|
||||
return Node;
|
||||
}
|
||||
if (Node->StartingAddress >= Extent)
|
||||
if (MA_GetStartingAddress(Node) >= Extent)
|
||||
{
|
||||
DPRINT("Finished MmLocateMemoryAreaByRegion() = NULL\n");
|
||||
return NULL;
|
||||
@ -387,13 +387,13 @@ MmInsertMemoryArea(
|
||||
Vad = ExAllocatePoolWithTag(NonPagedPool, sizeof(MMVAD), TAG_MVAD);
|
||||
ASSERT(Vad);
|
||||
RtlZeroMemory(Vad, sizeof(MMVAD));
|
||||
Vad->StartingVpn = PAGE_ROUND_DOWN(marea->StartingAddress) >> PAGE_SHIFT;
|
||||
Vad->StartingVpn = PAGE_ROUND_DOWN(MA_GetStartingAddress(marea)) >> PAGE_SHIFT;
|
||||
/*
|
||||
* For some strange reason, it is perfectly valid to create a MAREA from 0x1000 to... 0x1000.
|
||||
* 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 != marea->StartingAddress)
|
||||
if (marea->EndingAddress != MA_GetStartingAddress(marea))
|
||||
{
|
||||
Vad->EndingVpn = PAGE_ROUND_DOWN((ULONG_PTR)marea->EndingAddress - 1) >> PAGE_SHIFT;
|
||||
}
|
||||
@ -424,16 +424,16 @@ MmInsertMemoryArea(
|
||||
do
|
||||
{
|
||||
DPRINT("marea->EndingAddress: %p Node->StartingAddress: %p\n",
|
||||
marea->EndingAddress, Node->StartingAddress);
|
||||
marea->EndingAddress, MA_GetStartingAddress(Node));
|
||||
DPRINT("marea->StartingAddress: %p Node->EndingAddress: %p\n",
|
||||
marea->StartingAddress, Node->EndingAddress);
|
||||
ASSERT(marea->EndingAddress <= Node->StartingAddress ||
|
||||
marea->StartingAddress >= Node->EndingAddress);
|
||||
ASSERT(marea->StartingAddress != Node->StartingAddress);
|
||||
MA_GetStartingAddress(marea), Node->EndingAddress);
|
||||
ASSERT(marea->EndingAddress <= MA_GetStartingAddress(Node) ||
|
||||
MA_GetStartingAddress(marea) >= Node->EndingAddress);
|
||||
ASSERT(MA_GetStartingAddress(marea) != MA_GetStartingAddress(Node));
|
||||
|
||||
PreviousNode = Node;
|
||||
|
||||
if (marea->StartingAddress < Node->StartingAddress)
|
||||
if (MA_GetStartingAddress(marea) < MA_GetStartingAddress(Node))
|
||||
Node = Node->LeftChild;
|
||||
else
|
||||
Node = Node->RightChild;
|
||||
@ -452,7 +452,7 @@ MmInsertMemoryArea(
|
||||
|
||||
marea->LeftChild = marea->RightChild = NULL;
|
||||
marea->Parent = PreviousNode;
|
||||
if (marea->StartingAddress < PreviousNode->StartingAddress)
|
||||
if (MA_GetStartingAddress(marea) < MA_GetStartingAddress(PreviousNode))
|
||||
PreviousNode->LeftChild = marea;
|
||||
else
|
||||
PreviousNode->RightChild = marea;
|
||||
@ -499,7 +499,7 @@ MmFindGapBottomUp(
|
||||
while (Node && ((ULONG_PTR)Node->EndingAddress < HighestAddress))
|
||||
{
|
||||
/* Check if the memory area fits before the current node */
|
||||
if ((ULONG_PTR)Node->StartingAddress >= (Candidate + Length))
|
||||
if (MA_GetStartingAddress(Node) >= (Candidate + Length))
|
||||
{
|
||||
DPRINT("MmFindGapBottomUp: %p\n", Candidate);
|
||||
ASSERT(Candidate >= LowestAddress);
|
||||
@ -561,13 +561,13 @@ MmFindGapTopDown(
|
||||
|
||||
/* Go to the node with highest address in the tree. */
|
||||
Node = Root ? MmIterateLastNode(Root) : NULL;
|
||||
while (Node && ((ULONG_PTR)Node->StartingAddress > HighestAddress))
|
||||
while (Node && (MA_GetStartingAddress(Node) > HighestAddress))
|
||||
{
|
||||
Node = MmIteratePrevNode(Node);
|
||||
}
|
||||
|
||||
/* Traverse the tree from high to low addresses */
|
||||
while (Node && ((ULONG_PTR)Node->StartingAddress > LowestAddress))
|
||||
while (Node && (MA_GetStartingAddress(Node) > LowestAddress))
|
||||
{
|
||||
/* Check if the memory area fits after the current node */
|
||||
if ((ULONG_PTR)Node->EndingAddress <= Candidate)
|
||||
@ -577,11 +577,11 @@ MmFindGapTopDown(
|
||||
}
|
||||
|
||||
/* Calculate next possible adress below this node */
|
||||
Candidate = ALIGN_DOWN_BY((ULONG_PTR)Node->StartingAddress - Length,
|
||||
Candidate = ALIGN_DOWN_BY(MA_GetStartingAddress(Node) - Length,
|
||||
Granularity);
|
||||
|
||||
/* Check for overflow. */
|
||||
if (Candidate > (ULONG_PTR)Node->StartingAddress)
|
||||
if (Candidate > MA_GetStartingAddress(Node))
|
||||
return NULL;
|
||||
|
||||
/* Go to the next lower node */
|
||||
@ -630,10 +630,10 @@ MiRosCheckMemoryAreasRecursive(
|
||||
|
||||
/* Check some fields */
|
||||
ASSERT(Node->Magic == 'erAM');
|
||||
ASSERT(PAGE_ALIGN(Node->StartingAddress) == (PVOID)Node->StartingAddress);
|
||||
ASSERT(PAGE_ALIGN(MA_GetStartingAddress(Node)) == (PVOID)MA_GetStartingAddress(Node));
|
||||
ASSERT(Node->EndingAddress != 0);
|
||||
ASSERT(PAGE_ALIGN(Node->EndingAddress) == (PVOID)Node->EndingAddress);
|
||||
ASSERT(Node->StartingAddress < Node->EndingAddress);
|
||||
ASSERT(MA_GetStartingAddress(Node) < Node->EndingAddress);
|
||||
ASSERT((Node->Type == 0) ||
|
||||
(Node->Type == MEMORY_AREA_CACHE) ||
|
||||
// (Node->Type == MEMORY_AREA_CACHE_SEGMENT) ||
|
||||
@ -766,7 +766,7 @@ MmFreeMemoryArea(
|
||||
}
|
||||
|
||||
EndAddress = MM_ROUND_UP(MemoryArea->EndingAddress, PAGE_SIZE);
|
||||
for (Address = (ULONG_PTR)MemoryArea->StartingAddress;
|
||||
for (Address = MA_GetStartingAddress(MemoryArea);
|
||||
Address < (ULONG_PTR)EndAddress;
|
||||
Address += PAGE_SIZE)
|
||||
{
|
||||
@ -1008,7 +1008,7 @@ MmCreateMemoryArea(PMMSUPPORT AddressSpace,
|
||||
|
||||
RtlZeroMemory(MemoryArea, sizeof(MEMORY_AREA));
|
||||
MemoryArea->Type = Type;
|
||||
MemoryArea->StartingAddress = (ULONG_PTR)*BaseAddress;
|
||||
MemoryArea->StartingVpn = (ULONG_PTR)*BaseAddress >> PAGE_SHIFT;
|
||||
MemoryArea->EndingAddress = ((ULONG_PTR)*BaseAddress + tmpLength);
|
||||
MemoryArea->Protect = Protect;
|
||||
MemoryArea->Flags = AllocationFlags;
|
||||
@ -1049,14 +1049,14 @@ MmDeleteProcessAddressSpace(PEPROCESS Process)
|
||||
switch (MemoryArea->Type)
|
||||
{
|
||||
case MEMORY_AREA_SECTION_VIEW:
|
||||
Address = (PVOID)MemoryArea->StartingAddress;
|
||||
Address = (PVOID)MA_GetStartingAddress(MemoryArea);
|
||||
MmUnlockAddressSpace(&Process->Vm);
|
||||
MmUnmapViewOfSection(Process, Address);
|
||||
MmLockAddressSpace(&Process->Vm);
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_CACHE:
|
||||
Address = (PVOID)MemoryArea->StartingAddress;
|
||||
Address = (PVOID)MA_GetStartingAddress(MemoryArea);
|
||||
MmUnlockAddressSpace(&Process->Vm);
|
||||
MmUnmapViewOfCacheSegment(&Process->Vm, Address);
|
||||
MmLockAddressSpace(&Process->Vm);
|
||||
|
@ -137,7 +137,7 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||
{
|
||||
ULONG_PTR Entry;
|
||||
Offset = MemoryArea->Data.SectionData.ViewOffset.QuadPart +
|
||||
((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress);
|
||||
((ULONG_PTR)Address - MA_GetStartingAddress(MemoryArea));
|
||||
|
||||
MmLockSectionSegment(MemoryArea->Data.SectionData.Segment);
|
||||
|
||||
|
@ -1323,12 +1323,12 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
||||
}
|
||||
|
||||
PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE);
|
||||
Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress
|
||||
Offset.QuadPart = (ULONG_PTR)PAddress - MA_GetStartingAddress(MemoryArea)
|
||||
+ MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
|
||||
Segment = MemoryArea->Data.SectionData.Segment;
|
||||
Section = MemoryArea->Data.SectionData.Section;
|
||||
Region = MmFindRegion((PVOID)MemoryArea->StartingAddress,
|
||||
Region = MmFindRegion((PVOID)MA_GetStartingAddress(MemoryArea),
|
||||
&MemoryArea->Data.SectionData.RegionListHead,
|
||||
Address, NULL);
|
||||
ASSERT(Region != NULL);
|
||||
@ -1700,12 +1700,12 @@ MmAccessFaultSectionView(PMMSUPPORT AddressSpace,
|
||||
* Find the offset of the page
|
||||
*/
|
||||
PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE);
|
||||
Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress
|
||||
Offset.QuadPart = (ULONG_PTR)PAddress - MA_GetStartingAddress(MemoryArea)
|
||||
+ MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
|
||||
Segment = MemoryArea->Data.SectionData.Segment;
|
||||
Section = MemoryArea->Data.SectionData.Section;
|
||||
Region = MmFindRegion((PVOID)MemoryArea->StartingAddress,
|
||||
Region = MmFindRegion((PVOID)MA_GetStartingAddress(MemoryArea),
|
||||
&MemoryArea->Data.SectionData.RegionListHead,
|
||||
Address, NULL);
|
||||
ASSERT(Region != NULL);
|
||||
@ -1895,7 +1895,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||
Context.SectionEntry = Entry;
|
||||
Context.CallingProcess = Process;
|
||||
|
||||
Context.Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
||||
Context.Offset.QuadPart = (ULONG_PTR)Address - MA_GetStartingAddress(MemoryArea)
|
||||
+ MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
|
||||
DirectMapped = FALSE;
|
||||
@ -2294,7 +2294,7 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
|
||||
|
||||
Address = (PVOID)PAGE_ROUND_DOWN(Address);
|
||||
|
||||
Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
||||
Offset.QuadPart = (ULONG_PTR)Address - MA_GetStartingAddress(MemoryArea)
|
||||
+ MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
|
||||
/*
|
||||
@ -2478,7 +2478,7 @@ MmAlterViewAttributes(PMMSUPPORT AddressSpace,
|
||||
ULONG_PTR Entry;
|
||||
PFN_NUMBER Page;
|
||||
|
||||
Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
||||
Offset.QuadPart = (ULONG_PTR)Address - MA_GetStartingAddress(MemoryArea)
|
||||
+ MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
Entry = MmGetPageEntrySectionSegment(Segment, &Offset);
|
||||
/*
|
||||
@ -2524,7 +2524,7 @@ MmProtectSectionView(PMMSUPPORT AddressSpace,
|
||||
if (Length > MaxLength)
|
||||
Length = (ULONG)MaxLength;
|
||||
|
||||
Region = MmFindRegion((PVOID)MemoryArea->StartingAddress,
|
||||
Region = MmFindRegion((PVOID)MA_GetStartingAddress(MemoryArea),
|
||||
&MemoryArea->Data.SectionData.RegionListHead,
|
||||
BaseAddress, NULL);
|
||||
ASSERT(Region != NULL);
|
||||
@ -2536,7 +2536,7 @@ MmProtectSectionView(PMMSUPPORT AddressSpace,
|
||||
}
|
||||
|
||||
*OldProtect = Region->Protect;
|
||||
Status = MmAlterRegion(AddressSpace, (PVOID)MemoryArea->StartingAddress,
|
||||
Status = MmAlterRegion(AddressSpace, (PVOID)MA_GetStartingAddress(MemoryArea),
|
||||
&MemoryArea->Data.SectionData.RegionListHead,
|
||||
BaseAddress, Length, Region->Type, Protect,
|
||||
MmAlterViewAttributes);
|
||||
@ -2555,7 +2555,7 @@ MmQuerySectionView(PMEMORY_AREA MemoryArea,
|
||||
PROS_SECTION_OBJECT Section;
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
|
||||
Region = MmFindRegion((PVOID)MemoryArea->StartingAddress,
|
||||
Region = MmFindRegion((PVOID)MA_GetStartingAddress(MemoryArea),
|
||||
&MemoryArea->Data.SectionData.RegionListHead,
|
||||
Address, &RegionBaseAddress);
|
||||
if (Region == NULL)
|
||||
@ -2567,12 +2567,12 @@ MmQuerySectionView(PMEMORY_AREA MemoryArea,
|
||||
if (Section->AllocationAttributes & SEC_IMAGE)
|
||||
{
|
||||
Segment = MemoryArea->Data.SectionData.Segment;
|
||||
Info->AllocationBase = (PUCHAR)MemoryArea->StartingAddress - Segment->Image.VirtualAddress;
|
||||
Info->AllocationBase = (PUCHAR)MA_GetStartingAddress(MemoryArea) - Segment->Image.VirtualAddress;
|
||||
Info->Type = MEM_IMAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info->AllocationBase = (PVOID)MemoryArea->StartingAddress;
|
||||
Info->AllocationBase = (PVOID)MA_GetStartingAddress(MemoryArea);
|
||||
Info->Type = MEM_MAPPED;
|
||||
}
|
||||
Info->BaseAddress = RegionBaseAddress;
|
||||
@ -4008,7 +4008,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
|
||||
Address = (PVOID)PAGE_ROUND_DOWN(Address);
|
||||
|
||||
Offset.QuadPart = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) +
|
||||
Offset.QuadPart = ((ULONG_PTR)Address - MA_GetStartingAddress(MemoryArea)) +
|
||||
MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
|
||||
Section = MemoryArea->Data.SectionData.Section;
|
||||
|
Loading…
Reference in New Issue
Block a user