- Change storage of ReactOS-specific virtual address space from VadRoot to Vm EPROCESS structure member. Change containing "structure" from MM_AVL_TABLE to MMSUPPORT respectively .

svn path=/trunk/; revision=40713
This commit is contained in:
Aleksey Bragin 2009-04-27 10:12:57 +00:00
parent 86b82cf4d6
commit 59b86554ee
11 changed files with 136 additions and 136 deletions

View File

@ -388,7 +388,7 @@ extern MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM];
typedef VOID
(*PMM_ALTER_REGION_FUNC)(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID BaseAddress,
ULONG Length,
ULONG OldType,
@ -412,7 +412,7 @@ typedef VOID
NTSTATUS
NTAPI
MmCreateMemoryArea(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
ULONG Type,
PVOID *BaseAddress,
ULONG_PTR Length,
@ -426,21 +426,21 @@ MmCreateMemoryArea(
PMEMORY_AREA
NTAPI
MmLocateMemoryAreaByAddress(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID Address
);
ULONG_PTR
NTAPI
MmFindGapAtAddress(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID Address
);
NTSTATUS
NTAPI
MmFreeMemoryArea(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PMM_FREE_PAGE_FUNC FreePage,
PVOID FreePageContext
@ -449,7 +449,7 @@ MmFreeMemoryArea(
NTSTATUS
NTAPI
MmFreeMemoryAreaByPtr(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID BaseAddress,
PMM_FREE_PAGE_FUNC FreePage,
PVOID FreePageContext
@ -457,12 +457,12 @@ MmFreeMemoryAreaByPtr(
VOID
NTAPI
MmDumpMemoryAreas(PMM_AVL_TABLE AddressSpace);
MmDumpMemoryAreas(PMMSUPPORT AddressSpace);
PMEMORY_AREA
NTAPI
MmLocateMemoryAreaByRegion(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID Address,
ULONG_PTR Length
);
@ -470,7 +470,7 @@ MmLocateMemoryAreaByRegion(
PVOID
NTAPI
MmFindGap(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
ULONG_PTR Length,
ULONG_PTR Granularity,
BOOLEAN TopDown
@ -480,7 +480,7 @@ VOID
NTAPI
MmReleaseMemoryAreaIfDecommitted(
struct _EPROCESS *Process,
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID BaseAddress
);
@ -746,7 +746,7 @@ MmAccessFault(
NTSTATUS
NTAPI
MmNotPresentFaultVirtualMemory(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked
@ -755,7 +755,7 @@ MmNotPresentFaultVirtualMemory(
NTSTATUS
NTAPI
MmPageOutVirtualMemory(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID Address,
struct _MM_PAGEOP* PageOp
@ -780,7 +780,7 @@ MmFreeVirtualMemory(
NTSTATUS
NTAPI
MmProtectAnonMem(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID BaseAddress,
ULONG Length,
@ -791,7 +791,7 @@ MmProtectAnonMem(
NTSTATUS
NTAPI
MmWritePageVirtualMemory(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA MArea,
PVOID Address,
PMM_PAGEOP PageOp
@ -1390,7 +1390,7 @@ MmTrimUserMemory(
NTSTATUS
NTAPI
MmAlterRegion(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID BaseAddress,
PLIST_ENTRY RegionListHead,
PVOID StartAddress,
@ -1458,7 +1458,7 @@ MmQuerySectionView(
NTSTATUS
NTAPI
MmProtectSectionView(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID BaseAddress,
ULONG Length,
@ -1469,7 +1469,7 @@ MmProtectSectionView(
NTSTATUS
NTAPI
MmWritePageSectionView(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA MArea,
PVOID Address,
PMM_PAGEOP PageOp
@ -1482,7 +1482,7 @@ MmInitSectionImplementation(VOID);
NTSTATUS
NTAPI
MmNotPresentFaultSectionView(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked
@ -1491,7 +1491,7 @@ MmNotPresentFaultSectionView(
NTSTATUS
NTAPI
MmPageOutSectionView(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID Address,
struct _MM_PAGEOP *PageOp
@ -1504,7 +1504,7 @@ MmCreatePhysicalMemorySection(VOID);
NTSTATUS
NTAPI
MmAccessFaultSectionView(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked
@ -1608,39 +1608,39 @@ MiSyncForContextSwitch(
IN PKTHREAD Thread
);
extern PMM_AVL_TABLE MmKernelAddressSpace;
extern PMMSUPPORT MmKernelAddressSpace;
FORCEINLINE
VOID
MmLockAddressSpace(PMM_AVL_TABLE AddressSpace)
MmLockAddressSpace(PMMSUPPORT AddressSpace)
{
KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, VadRoot)->AddressCreationLock);
KeAcquireGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
}
FORCEINLINE
VOID
MmUnlockAddressSpace(PMM_AVL_TABLE AddressSpace)
MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
{
KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, VadRoot)->AddressCreationLock);
KeReleaseGuardedMutex(&CONTAINING_RECORD(AddressSpace, EPROCESS, Vm)->AddressCreationLock);
}
FORCEINLINE
PEPROCESS
MmGetAddressSpaceOwner(IN PMM_AVL_TABLE AddressSpace)
MmGetAddressSpaceOwner(IN PMMSUPPORT AddressSpace)
{
if (AddressSpace == MmKernelAddressSpace) return NULL;
return CONTAINING_RECORD(AddressSpace, EPROCESS, VadRoot);
return CONTAINING_RECORD(AddressSpace, EPROCESS, Vm);
}
FORCEINLINE
PMM_AVL_TABLE
PMMSUPPORT
MmGetCurrentAddressSpace(VOID)
{
return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->VadRoot;
return &((PEPROCESS)KeGetCurrentThread()->ApcState.Process)->Vm;
}
FORCEINLINE
PMM_AVL_TABLE
PMMSUPPORT
MmGetKernelAddressSpace(VOID)
{
return MmKernelAddressSpace;

View File

@ -47,7 +47,7 @@
NTSTATUS
NTAPI
MmWritePageVirtualMemory(PMM_AVL_TABLE AddressSpace,
MmWritePageVirtualMemory(PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID Address,
PMM_PAGEOP PageOp)
@ -130,7 +130,7 @@ MmWritePageVirtualMemory(PMM_AVL_TABLE AddressSpace,
NTSTATUS
NTAPI
MmPageOutVirtualMemory(PMM_AVL_TABLE AddressSpace,
MmPageOutVirtualMemory(PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID Address,
PMM_PAGEOP PageOp)
@ -239,7 +239,7 @@ MmPageOutVirtualMemory(PMM_AVL_TABLE AddressSpace,
NTSTATUS
NTAPI
MmNotPresentFaultVirtualMemory(PMM_AVL_TABLE AddressSpace,
MmNotPresentFaultVirtualMemory(PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked)
@ -446,7 +446,7 @@ MmNotPresentFaultVirtualMemory(PMM_AVL_TABLE AddressSpace,
}
static VOID
MmModifyAttributes(PMM_AVL_TABLE AddressSpace,
MmModifyAttributes(PMMSUPPORT AddressSpace,
PVOID BaseAddress,
ULONG RegionSize,
ULONG OldType,
@ -562,7 +562,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
ULONG_PTR MemoryAreaLength;
ULONG Type;
NTSTATUS Status;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
PVOID BaseAddress;
ULONG RegionSize;
PVOID PBaseAddress;
@ -713,7 +713,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
Type = (AllocationType & MEM_COMMIT) ? MEM_COMMIT : MEM_RESERVE;
DPRINT("Type %x\n", Type);
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
MmLockAddressSpace(AddressSpace);
if (PBaseAddress != 0)
@ -888,7 +888,7 @@ MmFreeVirtualMemory(PEPROCESS Process,
if (PageOp != NULL)
{
NTSTATUS Status;
MmUnlockAddressSpace(&Process->VadRoot);
MmUnlockAddressSpace(&Process->Vm);
Status = KeWaitForSingleObject(&PageOp->CompletionEvent,
0,
KernelMode,
@ -899,7 +899,7 @@ MmFreeVirtualMemory(PEPROCESS Process,
DPRINT1("Failed to wait for page op\n");
KeBugCheck(MEMORY_MANAGEMENT);
}
MmLockAddressSpace(&Process->VadRoot);
MmLockAddressSpace(&Process->Vm);
MmReleasePageOp(PageOp);
}
}
@ -915,7 +915,7 @@ MmFreeVirtualMemory(PEPROCESS Process,
}
/* Actually free the memory area. */
MmFreeMemoryArea(&Process->VadRoot,
MmFreeMemoryArea(&Process->Vm,
MemoryArea,
MmFreeVirtualMemoryPage,
(PVOID)Process);
@ -945,7 +945,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
MEMORY_AREA* MemoryArea;
NTSTATUS Status;
PEPROCESS Process;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
PVOID BaseAddress;
ULONG RegionSize;
@ -974,7 +974,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
return(Status);
}
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
MmLockAddressSpace(AddressSpace);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, BaseAddress);
@ -1024,7 +1024,7 @@ unlock_deref_and_return:
NTSTATUS
NTAPI
MmProtectAnonMem(PMM_AVL_TABLE AddressSpace,
MmProtectAnonMem(PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID BaseAddress,
ULONG Length,

View File

@ -172,7 +172,7 @@ MmInitializeHandBuiltProcess(IN PEPROCESS Process,
/* Initialize the Addresss Space */
KeInitializeGuardedMutex(&Process->AddressCreationLock);
Process->VadRoot.BalancedRoot.u1.Parent = NULL;
Process->Vm.WorkingSetExpansionLinks.Flink = NULL;
/* The process now has an address space */
Process->HasAddressSpace = TRUE;

View File

@ -160,18 +160,18 @@ static PMEMORY_AREA MmIteratePrevNode(PMEMORY_AREA Node)
}
#ifdef VALIDATE_MEMORY_AREAS
static VOID MmVerifyMemoryAreas(PMM_AVL_TABLE AddressSpace)
static VOID MmVerifyMemoryAreas(PMMSUPPORT AddressSpace)
{
PMEMORY_AREA Node;
ASSERT(AddressSpace != NULL);
/* Special case for empty tree. */
if (AddressSpace->BalancedRoot.u1.Parent == NULL)
if (AddressSpace->WorkingSetExpansionLinks.Flink == NULL)
return;
/* Traverse the tree from left to right. */
for (Node = MmIterateFirstNode(AddressSpace->BalancedRoot.u1.Parent);
for (Node = MmIterateFirstNode(AddressSpace->WorkingSetExpansionLinks.Flink);
Node != NULL;
Node = MmIterateNextNode(Node))
{
@ -186,18 +186,18 @@ static VOID MmVerifyMemoryAreas(PMM_AVL_TABLE AddressSpace)
#endif
VOID NTAPI
MmDumpMemoryAreas(PMM_AVL_TABLE AddressSpace)
MmDumpMemoryAreas(PMMSUPPORT AddressSpace)
{
PMEMORY_AREA Node;
DbgPrint("MmDumpMemoryAreas()\n");
/* Special case for empty tree. */
if (AddressSpace->BalancedRoot.u1.Parent == NULL)
if (AddressSpace->WorkingSetExpansionLinks.Flink == NULL)
return;
/* Traverse the tree from left to right. */
for (Node = MmIterateFirstNode((PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent);
for (Node = MmIterateFirstNode((PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink);
Node != NULL;
Node = MmIterateNextNode(Node))
{
@ -211,10 +211,10 @@ MmDumpMemoryAreas(PMM_AVL_TABLE AddressSpace)
PMEMORY_AREA NTAPI
MmLocateMemoryAreaByAddress(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID Address)
{
PMEMORY_AREA Node = (PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent;
PMEMORY_AREA Node = (PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink;
DPRINT("MmLocateMemoryAreaByAddress(AddressSpace %p, Address %p)\n",
AddressSpace, Address);
@ -241,7 +241,7 @@ MmLocateMemoryAreaByAddress(
PMEMORY_AREA NTAPI
MmLocateMemoryAreaByRegion(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID Address,
ULONG_PTR Length)
{
@ -251,11 +251,11 @@ MmLocateMemoryAreaByRegion(
MmVerifyMemoryAreas(AddressSpace);
/* Special case for empty tree. */
if (AddressSpace->BalancedRoot.u1.Parent == NULL)
if (AddressSpace->WorkingSetExpansionLinks.Flink == NULL)
return NULL;
/* Traverse the tree from left to right. */
for (Node = MmIterateFirstNode((PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent);
for (Node = MmIterateFirstNode((PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink);
Node != NULL;
Node = MmIterateNextNode(Node))
{
@ -302,11 +302,11 @@ MmLocateMemoryAreaByRegion(
static VOID
MmCompressHelper(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
ULONG Count)
{
PMEMORY_AREA Root = NULL;
PMEMORY_AREA Red = (PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent;
PMEMORY_AREA Red = (PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink;
PMEMORY_AREA Black = Red->LeftChild;
while (Count--)
@ -314,7 +314,7 @@ MmCompressHelper(
if (Root)
Root->LeftChild = Black;
else
AddressSpace->BalancedRoot.u1.Parent = (PVOID)Black;
AddressSpace->WorkingSetExpansionLinks.Flink = (PVOID)Black;
Black->Parent = Root;
Red->LeftChild = Black->RightChild;
if (Black->RightChild)
@ -341,7 +341,7 @@ MmCompressHelper(
static VOID
MmRebalanceTree(
PMM_AVL_TABLE AddressSpace)
PMMSUPPORT AddressSpace)
{
PMEMORY_AREA PreviousNode;
PMEMORY_AREA CurrentNode;
@ -354,7 +354,7 @@ MmRebalanceTree(
/* Transform the tree into Vine. */
PreviousNode = NULL;
CurrentNode = (PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent;
CurrentNode = (PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink;
while (CurrentNode != NULL)
{
if (CurrentNode->RightChild == NULL)
@ -379,7 +379,7 @@ MmRebalanceTree(
if (PreviousNode != NULL)
PreviousNode->LeftChild = TempNode;
else
AddressSpace->BalancedRoot.u1.Parent = (PVOID)TempNode;
AddressSpace->WorkingSetExpansionLinks.Flink = (PVOID)TempNode;
TempNode->Parent = PreviousNode;
}
}
@ -410,7 +410,7 @@ MmRebalanceTree(
static VOID
MmInsertMemoryArea(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA marea)
{
PMEMORY_AREA Node;
@ -419,14 +419,14 @@ MmInsertMemoryArea(
MmVerifyMemoryAreas(AddressSpace);
if (AddressSpace->BalancedRoot.u1.Parent == NULL)
if (AddressSpace->WorkingSetExpansionLinks.Flink == NULL)
{
AddressSpace->BalancedRoot.u1.Parent = (PVOID)marea;
AddressSpace->WorkingSetExpansionLinks.Flink = (PVOID)marea;
marea->LeftChild = marea->RightChild = marea->Parent = NULL;
return;
}
Node = (PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent;
Node = (PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink;
do
{
DPRINT("marea->EndingAddress: %p Node->StartingAddress: %p\n",
@ -466,7 +466,7 @@ MmInsertMemoryArea(
static PVOID
MmFindGapBottomUp(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
ULONG_PTR Length,
ULONG_PTR Granularity)
{
@ -486,7 +486,7 @@ MmFindGapBottomUp(
AlignedAddress = MM_ROUND_UP(LowestAddress, Granularity);
/* Special case for empty tree. */
if (AddressSpace->BalancedRoot.u1.Parent == NULL)
if (AddressSpace->WorkingSetExpansionLinks.Flink == NULL)
{
if ((ULONG_PTR)HighestAddress - (ULONG_PTR)AlignedAddress >= Length)
{
@ -498,7 +498,7 @@ MmFindGapBottomUp(
}
/* Go to the node with lowest address in the tree. */
FirstNode = Node = MmIterateFirstNode((PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent);
FirstNode = Node = MmIterateFirstNode((PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink);
/* Traverse the tree from left to right. */
PreviousNode = Node;
@ -544,7 +544,7 @@ MmFindGapBottomUp(
static PVOID
MmFindGapTopDown(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
ULONG_PTR Length,
ULONG_PTR Granularity)
{
@ -567,7 +567,7 @@ MmFindGapTopDown(
return NULL;
/* Special case for empty tree. */
if (AddressSpace->BalancedRoot.u1.Parent == NULL)
if (AddressSpace->WorkingSetExpansionLinks.Flink == NULL)
{
if (AlignedAddress >= LowestAddress)
{
@ -579,7 +579,7 @@ MmFindGapTopDown(
}
/* Go to the node with highest address in the tree. */
Node = MmIterateLastNode((PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent);
Node = MmIterateLastNode((PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink);
/* Check if there is enough space after the last memory area. */
if (Node->EndingAddress <= AlignedAddress)
@ -630,7 +630,7 @@ MmFindGapTopDown(
PVOID NTAPI
MmFindGap(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
ULONG_PTR Length,
ULONG_PTR Granularity,
BOOLEAN TopDown)
@ -643,10 +643,10 @@ MmFindGap(
ULONG_PTR NTAPI
MmFindGapAtAddress(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID Address)
{
PMEMORY_AREA Node = (PMEMORY_AREA)AddressSpace->BalancedRoot.u1.Parent;
PMEMORY_AREA Node = (PMEMORY_AREA)AddressSpace->WorkingSetExpansionLinks.Flink;
PMEMORY_AREA RightNeighbour = NULL;
PVOID LowestAddress = MmGetAddressSpaceOwner(AddressSpace) ? MM_LOWEST_USER_ADDRESS : MmSystemRangeStart;
PVOID HighestAddress = MmGetAddressSpaceOwner(AddressSpace) ?
@ -725,7 +725,7 @@ MmFindGapAtAddress(
NTSTATUS NTAPI
MmFreeMemoryArea(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PMM_FREE_PAGE_FUNC FreePage,
PVOID FreePageContext)
@ -789,7 +789,7 @@ MmFreeMemoryArea(
ParentReplace = &MemoryArea->Parent->RightChild;
}
else
ParentReplace = (PMEMORY_AREA*)&AddressSpace->BalancedRoot.u1.Parent;
ParentReplace = (PMEMORY_AREA*)&AddressSpace->WorkingSetExpansionLinks.Flink;
if (MemoryArea->RightChild == NULL)
{
@ -867,7 +867,7 @@ MmFreeMemoryArea(
NTSTATUS NTAPI
MmFreeMemoryAreaByPtr(
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID BaseAddress,
PMM_FREE_PAGE_FUNC FreePage,
PVOID FreePageContext)
@ -918,7 +918,7 @@ MmFreeMemoryAreaByPtr(
*/
NTSTATUS NTAPI
MmCreateMemoryArea(PMM_AVL_TABLE AddressSpace,
MmCreateMemoryArea(PMMSUPPORT AddressSpace,
ULONG Type,
PVOID *BaseAddress,
ULONG_PTR Length,
@ -1042,7 +1042,7 @@ MmMapMemoryArea(PVOID BaseAddress,
VOID NTAPI
MmReleaseMemoryAreaIfDecommitted(PEPROCESS Process,
PMM_AVL_TABLE AddressSpace,
PMMSUPPORT AddressSpace,
PVOID BaseAddress)
{
PMEMORY_AREA MemoryArea;

View File

@ -366,12 +366,12 @@ MmUnmapLockedPages(IN PVOID BaseAddress,
ASSERT(Mdl->Process == PsGetCurrentProcess());
/* Find the memory area */
MemoryArea = MmLocateMemoryAreaByAddress(&Mdl->Process->VadRoot,
MemoryArea = MmLocateMemoryAreaByAddress(&Mdl->Process->Vm,
BaseAddress);
ASSERT(MemoryArea);
/* Free it */
MmFreeMemoryArea(&Mdl->Process->VadRoot,
MmFreeMemoryArea(&Mdl->Process->Vm,
MemoryArea,
NULL,
NULL);
@ -395,7 +395,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
PFN_TYPE Page;
PEPROCESS CurrentProcess;
PETHREAD Thread;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
KIRQL OldIrql = KeGetCurrentIrql();
DPRINT("Probing MDL: %p\n", Mdl);
@ -480,7 +480,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
Mdl->Process = CurrentProcess;
/* Use the process lock */
AddressSpace = &CurrentProcess->VadRoot;
AddressSpace = &CurrentProcess->Vm;
}
@ -758,8 +758,8 @@ MmMapLockedPagesSpecifyCache(IN PMDL Mdl,
CurrentProcess = PsGetCurrentProcess();
MmLockAddressSpace(&CurrentProcess->VadRoot);
Status = MmCreateMemoryArea(&CurrentProcess->VadRoot,
MmLockAddressSpace(&CurrentProcess->Vm);
Status = MmCreateMemoryArea(&CurrentProcess->Vm,
MEMORY_AREA_MDL_MAPPING,
&Base,
PageCount * PAGE_SIZE,
@ -768,7 +768,7 @@ MmMapLockedPagesSpecifyCache(IN PMDL Mdl,
(Base != NULL),
0,
BoundaryAddressMultiple);
MmUnlockAddressSpace(&CurrentProcess->VadRoot);
MmUnlockAddressSpace(&CurrentProcess->Vm);
if (!NT_SUCCESS(Status))
{
if (Mdl->MdlFlags & MDL_MAPPING_CAN_FAIL)

View File

@ -22,7 +22,7 @@ ULONG MmReadClusterSize;
MM_STATS MmStats;
PMM_AVL_TABLE MmKernelAddressSpace;
PMMSUPPORT MmKernelAddressSpace;
/* FUNCTIONS ****************************************************************/
@ -81,7 +81,7 @@ BOOLEAN NTAPI MmIsAddressValid(PVOID VirtualAddress)
*/
{
MEMORY_AREA* MemoryArea;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
if (VirtualAddress >= MmSystemRangeStart)
{
@ -89,7 +89,7 @@ BOOLEAN NTAPI MmIsAddressValid(PVOID VirtualAddress)
}
else
{
AddressSpace = &PsGetCurrentProcess()->VadRoot;
AddressSpace = &PsGetCurrentProcess()->Vm;
}
MmLockAddressSpace(AddressSpace);
@ -111,7 +111,7 @@ MmpAccessFault(KPROCESSOR_MODE Mode,
ULONG_PTR Address,
BOOLEAN FromMdl)
{
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
MEMORY_AREA* MemoryArea;
NTSTATUS Status;
BOOLEAN Locked = FromMdl;
@ -146,7 +146,7 @@ MmpAccessFault(KPROCESSOR_MODE Mode,
}
else
{
AddressSpace = &PsGetCurrentProcess()->VadRoot;
AddressSpace = &PsGetCurrentProcess()->Vm;
}
if (!FromMdl)
@ -211,7 +211,7 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
ULONG_PTR Address,
BOOLEAN FromMdl)
{
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
MEMORY_AREA* MemoryArea;
NTSTATUS Status;
BOOLEAN Locked = FromMdl;
@ -242,7 +242,7 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
}
else
{
AddressSpace = &PsGetCurrentProcess()->VadRoot;
AddressSpace = &PsGetCurrentProcess()->Vm;
}
if (!FromMdl)

View File

@ -80,7 +80,7 @@ MiCreatePebOrTeb(PEPROCESS Process,
PVOID BaseAddress)
{
NTSTATUS Status;
PMM_AVL_TABLE ProcessAddressSpace = &Process->VadRoot;
PMMSUPPORT ProcessAddressSpace = &Process->Vm;
PMEMORY_AREA MemoryArea;
PHYSICAL_ADDRESS BoundaryAddressMultiple;
PVOID AllocatedBase = BaseAddress;
@ -163,7 +163,7 @@ NTAPI
MmDeleteTeb(PEPROCESS Process,
PTEB Teb)
{
PMM_AVL_TABLE ProcessAddressSpace = &Process->VadRoot;
PMMSUPPORT ProcessAddressSpace = &Process->Vm;
PMEMORY_AREA MemoryArea;
/* Lock the Address Space */
@ -486,7 +486,7 @@ MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
PMEMORY_AREA MemoryArea;
PHYSICAL_ADDRESS BoundaryAddressMultiple;
NTSTATUS Status;
PMM_AVL_TABLE ProcessAddressSpace = &Process->VadRoot;
PMMSUPPORT ProcessAddressSpace = &Process->Vm;
BoundaryAddressMultiple.QuadPart = 0;
/* Create the shared data page */
@ -512,7 +512,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
{
NTSTATUS Status;
PMM_AVL_TABLE ProcessAddressSpace = &Process->VadRoot;
PMMSUPPORT ProcessAddressSpace = &Process->Vm;
PVOID BaseAddress;
PMEMORY_AREA MemoryArea;
PHYSICAL_ADDRESS BoundaryAddressMultiple;
@ -523,7 +523,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
/* Initialize the Addresss Space lock */
KeInitializeGuardedMutex(&Process->AddressCreationLock);
Process->VadRoot.BalancedRoot.u1.Parent = NULL;
Process->Vm.WorkingSetExpansionLinks.Flink = NULL;
/* Acquire the Lock */
MmLockAddressSpace(ProcessAddressSpace);
@ -684,17 +684,17 @@ MmDeleteProcessAddressSpace(PEPROCESS Process)
DPRINT("MmDeleteProcessAddressSpace(Process %x (%s))\n", Process,
Process->ImageFileName);
MmLockAddressSpace(&Process->VadRoot);
MmLockAddressSpace(&Process->Vm);
while ((MemoryArea = (PMEMORY_AREA)Process->VadRoot.BalancedRoot.u1.Parent) != NULL)
while ((MemoryArea = (PMEMORY_AREA)Process->Vm.WorkingSetExpansionLinks.Flink) != NULL)
{
switch (MemoryArea->Type)
{
case MEMORY_AREA_SECTION_VIEW:
Address = (PVOID)MemoryArea->StartingAddress;
MmUnlockAddressSpace(&Process->VadRoot);
MmUnlockAddressSpace(&Process->Vm);
MmUnmapViewOfSection(Process, Address);
MmLockAddressSpace(&Process->VadRoot);
MmLockAddressSpace(&Process->Vm);
break;
case MEMORY_AREA_VIRTUAL_MEMORY:
@ -704,7 +704,7 @@ MmDeleteProcessAddressSpace(PEPROCESS Process)
case MEMORY_AREA_SHARED_DATA:
case MEMORY_AREA_NO_ACCESS:
MmFreeMemoryArea(&Process->VadRoot,
MmFreeMemoryArea(&Process->Vm,
MemoryArea,
NULL,
NULL);
@ -721,7 +721,7 @@ MmDeleteProcessAddressSpace(PEPROCESS Process)
Mmi386ReleaseMmInfo(Process);
MmUnlockAddressSpace(&Process->VadRoot);
MmUnlockAddressSpace(&Process->Vm);
DPRINT("Finished MmReleaseMmInfo()\n");
return(STATUS_SUCCESS);

View File

@ -33,7 +33,7 @@ InsertAfterEntry(PLIST_ENTRY Previous,
static PMM_REGION
MmSplitRegion(PMM_REGION InitialRegion, PVOID InitialBaseAddress,
PVOID StartAddress, ULONG Length, ULONG NewType,
ULONG NewProtect, PMM_AVL_TABLE AddressSpace,
ULONG NewProtect, PMMSUPPORT AddressSpace,
PMM_ALTER_REGION_FUNC AlterFunc)
{
PMM_REGION NewRegion1;
@ -105,7 +105,7 @@ MmSplitRegion(PMM_REGION InitialRegion, PVOID InitialBaseAddress,
NTSTATUS
NTAPI
MmAlterRegion(PMM_AVL_TABLE AddressSpace, PVOID BaseAddress,
MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress,
PLIST_ENTRY RegionListHead, PVOID StartAddress, ULONG Length,
ULONG NewType, ULONG NewProtect, PMM_ALTER_REGION_FUNC AlterFunc)
{

View File

@ -58,7 +58,7 @@ MmWritePagePhysicalAddress(PFN_TYPE Page)
{
PMM_RMAP_ENTRY entry;
PMEMORY_AREA MemoryArea;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
ULONG Type;
PVOID Address;
PEPROCESS Process;
@ -91,7 +91,7 @@ MmWritePagePhysicalAddress(PFN_TYPE Page)
{
return Status;
}
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
}
else
{
@ -192,7 +192,7 @@ MmPageOutPhysicalAddress(PFN_TYPE Page)
{
PMM_RMAP_ENTRY entry;
PMEMORY_AREA MemoryArea;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
ULONG Type;
PVOID Address;
PEPROCESS Process;
@ -222,7 +222,7 @@ MmPageOutPhysicalAddress(PFN_TYPE Page)
{
return Status;
}
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
}
else
{

View File

@ -152,7 +152,7 @@ MmGetFileNameForAddress(IN PVOID Address,
{
PROS_SECTION_OBJECT Section;
PMEMORY_AREA MemoryArea;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
POBJECT_NAME_INFORMATION ModuleNameInformation;
NTSTATUS Status = STATUS_ADDRESS_NOT_ASSOCIATED;
@ -163,7 +163,7 @@ MmGetFileNameForAddress(IN PVOID Address,
}
else
{
AddressSpace = &PsGetCurrentProcess()->VadRoot;
AddressSpace = &PsGetCurrentProcess()->Vm;
}
/* Lock address space */
@ -753,7 +753,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
NTSTATUS
NTAPI
MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked)
@ -1273,7 +1273,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
NTSTATUS
NTAPI
MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace,
MmAccessFaultSectionView(PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked)
@ -1458,7 +1458,7 @@ MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address)
PageOutContext = (MM_SECTION_PAGEOUT_CONTEXT*)Context;
if (Process)
{
MmLockAddressSpace(&Process->VadRoot);
MmLockAddressSpace(&Process->Vm);
}
MmDeleteVirtualMapping(Process,
@ -1482,7 +1482,7 @@ MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address)
}
if (Process)
{
MmUnlockAddressSpace(&Process->VadRoot);
MmUnlockAddressSpace(&Process->Vm);
}
if (PageOutContext->Private)
@ -1495,7 +1495,7 @@ MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address)
NTSTATUS
NTAPI
MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
MmPageOutSectionView(PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
PMM_PAGEOP PageOp)
@ -1849,7 +1849,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
NTSTATUS
NTAPI
MmWritePageSectionView(PMM_AVL_TABLE AddressSpace,
MmWritePageSectionView(PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID Address,
PMM_PAGEOP PageOp)
@ -1996,7 +1996,7 @@ MmWritePageSectionView(PMM_AVL_TABLE AddressSpace,
}
static VOID
MmAlterViewAttributes(PMM_AVL_TABLE AddressSpace,
MmAlterViewAttributes(PMMSUPPORT AddressSpace,
PVOID BaseAddress,
ULONG RegionSize,
ULONG OldType,
@ -2061,7 +2061,7 @@ MmAlterViewAttributes(PMM_AVL_TABLE AddressSpace,
NTSTATUS
NTAPI
MmProtectSectionView(PMM_AVL_TABLE AddressSpace,
MmProtectSectionView(PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID BaseAddress,
ULONG Length,
@ -3611,7 +3611,7 @@ NtOpenSection(PHANDLE SectionHandle,
}
static NTSTATUS
MmMapViewOfSegment(PMM_AVL_TABLE AddressSpace,
MmMapViewOfSegment(PMMSUPPORT AddressSpace,
PROS_SECTION_OBJECT Section,
PMM_SECTION_SEGMENT Segment,
PVOID* BaseAddress,
@ -3722,7 +3722,7 @@ NtMapViewOfSection(IN HANDLE SectionHandle,
PROS_SECTION_OBJECT Section;
PEPROCESS Process;
KPROCESSOR_MODE PreviousMode;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
NTSTATUS Status = STATUS_SUCCESS;
ULONG tmpProtect;
@ -3801,7 +3801,7 @@ NtMapViewOfSection(IN HANDLE SectionHandle,
return(Status);
}
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
Status = ObReferenceObjectByHandle(SectionHandle,
SECTION_MAP_READ,
@ -3883,10 +3883,10 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
NTSTATUS Status;
PROS_SECTION_OBJECT Section;
PMM_SECTION_SEGMENT Segment;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
PEPROCESS Process;
AddressSpace = (PMM_AVL_TABLE)Context;
AddressSpace = (PMMSUPPORT)Context;
Process = MmGetAddressSpaceOwner(AddressSpace);
Address = (PVOID)PAGE_ROUND_DOWN(Address);
@ -3980,7 +3980,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
}
static NTSTATUS
MmUnmapViewOfSegment(PMM_AVL_TABLE AddressSpace,
MmUnmapViewOfSegment(PMMSUPPORT AddressSpace,
PVOID BaseAddress)
{
NTSTATUS Status;
@ -4040,7 +4040,7 @@ MmUnmapViewOfSection(PEPROCESS Process,
{
NTSTATUS Status;
PMEMORY_AREA MemoryArea;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
PROS_SECTION_OBJECT Section;
PMM_PAGEOP PageOp;
ULONG_PTR Offset;
@ -4051,7 +4051,7 @@ MmUnmapViewOfSection(PEPROCESS Process,
ASSERT(Process);
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
MmLockAddressSpace(AddressSpace);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
@ -4441,7 +4441,7 @@ MmAllocateSection (IN ULONG Length, PVOID BaseAddress)
PVOID Result;
MEMORY_AREA* marea;
NTSTATUS Status;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
PHYSICAL_ADDRESS BoundaryAddressMultiple;
DPRINT("MmAllocateSection(Length %x)\n",Length);
@ -4537,7 +4537,7 @@ MmMapViewOfSection(IN PVOID SectionObject,
IN ULONG Protect)
{
PROS_SECTION_OBJECT Section;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
ULONG ViewOffset;
NTSTATUS Status = STATUS_SUCCESS;
@ -4550,7 +4550,7 @@ MmMapViewOfSection(IN PVOID SectionObject,
Section = (PROS_SECTION_OBJECT)SectionObject;
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
AllocationType |= (Section->AllocationAttributes & SEC_NO_CHANGE);
@ -4815,7 +4815,7 @@ MmMapViewInSystemSpace (IN PVOID SectionObject,
IN OUT PULONG ViewSize)
{
PROS_SECTION_OBJECT Section;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
NTSTATUS Status;
DPRINT("MmMapViewInSystemSpace() called\n");
@ -4875,7 +4875,7 @@ MmMapViewInSessionSpace (
NTSTATUS NTAPI
MmUnmapViewInSystemSpace (IN PVOID MappedBase)
{
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
NTSTATUS Status;
DPRINT("MmUnmapViewInSystemSpace() called\n");

View File

@ -421,7 +421,7 @@ MiQueryVirtualMemory(IN HANDLE ProcessHandle,
NTSTATUS Status;
PEPROCESS Process;
MEMORY_AREA* MemoryArea;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
@ -436,7 +436,7 @@ MiQueryVirtualMemory(IN HANDLE ProcessHandle,
return(Status);
}
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
MmLockAddressSpace(AddressSpace);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
@ -576,7 +576,7 @@ MiProtectVirtualMemory(IN PEPROCESS Process,
OUT PULONG OldAccessProtection OPTIONAL)
{
PMEMORY_AREA MemoryArea;
PMM_AVL_TABLE AddressSpace;
PMMSUPPORT AddressSpace;
ULONG OldAccessProtection_;
NTSTATUS Status;
@ -585,7 +585,7 @@ MiProtectVirtualMemory(IN PEPROCESS Process,
PAGE_ROUND_DOWN(*BaseAddress);
*BaseAddress = (PVOID)PAGE_ROUND_DOWN(*BaseAddress);
AddressSpace = &Process->VadRoot;
AddressSpace = &Process->Vm;
MmLockAddressSpace(AddressSpace);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, *BaseAddress);