-/* $Id:$
+/* $Id$
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
else
{
PMEMORY_AREA TempNode = NULL;
-
+
do
{
/* Check if we're at the end of tree. */
if (Node->Parent == NULL)
return NULL;
-
+
TempNode = Node;
Node = Node->Parent;
}
else
{
PMEMORY_AREA TempNode = NULL;
-
+
do
{
/* Check if we're at the end of tree. */
if (Node->Parent == NULL)
return NULL;
-
+
TempNode = Node;
Node = Node->Parent;
}
PMEMORY_AREA Node;
ASSERT(AddressSpace != NULL);
-
+
/* Special case for empty tree. */
if (AddressSpace->MemoryAreaRoot == NULL)
return;
}
}
#else
-#define MmVerifyMemoryAreas(x)
+#define MmVerifyMemoryAreas(x)
#endif
VOID STDCALL
PMEMORY_AREA Node;
DbgPrint("MmDumpMemoryAreas()\n");
-
+
/* Special case for empty tree. */
if (AddressSpace->MemoryAreaRoot == NULL)
return;
* @name MmCompressHelper
*
* This is helper of MmRebalanceTree. Performs a compression transformation
- * count times, starting at root.
+ * count times, starting at root.
*/
static VOID
MmCompressHelper(
PMADDRESS_SPACE AddressSpace,
- ULONG Count)
+ ULONG Count)
{
PMEMORY_AREA Root = NULL;
PMEMORY_AREA Red = AddressSpace->MemoryAreaRoot;
CurrentNode = AddressSpace->MemoryAreaRoot;
while (CurrentNode != NULL)
{
- if (CurrentNode->RightChild == NULL)
+ if (CurrentNode->RightChild == NULL)
{
PreviousNode = CurrentNode;
CurrentNode = CurrentNode->LeftChild;
NodeCount++;
}
- else
+ else
{
TempNode = CurrentNode->RightChild;
/* Transform Vine back into a balanced tree. */
Leaves = NodeCount + 1;
- for (;;)
+ for (;;)
{
ULONG Next = Leaves & (Leaves - 1);
if (Next == 0)
Vine = NodeCount - Leaves;
Height = 1 + (Leaves > 0);
- while (Vine > 1)
+ while (Vine > 1)
{
MmCompressHelper(AddressSpace, Vine / 2);
Vine /= 2;
ASSERT(marea->EndingAddress <= Node->StartingAddress ||
marea->StartingAddress >= Node->EndingAddress);
ASSERT(marea->StartingAddress != Node->StartingAddress);
-
+
PreviousNode = Node;
-
+
if (marea->StartingAddress < Node->StartingAddress)
Node = Node->LeftChild;
else
Node = Node->RightChild;
-
+
if (Node)
{
Depth++;
/* Check for overflow. */
if (AlignedAddress > PreviousNode->StartingAddress)
return NULL;
-
+
if (Node->EndingAddress <= AlignedAddress)
{
DPRINT("MmFindGapTopDown: %p\n", AlignedAddress);
*
* Free an existing memory area.
*
- * @param AddressSpace
+ * @param AddressSpace
* Address space to free the area from.
* @param MemoryArea
* Memory area we're about to free.
KeAttachProcess(&AddressSpace->Process->Pcb);
}
- EndAddress = MM_ROUND_UP(MemoryArea->EndingAddress, PAGE_SIZE);
+ EndAddress = MM_ROUND_UP(MemoryArea->EndingAddress, PAGE_SIZE);
for (Address = (ULONG_PTR)MemoryArea->StartingAddress;
Address < (ULONG_PTR)EndAddress;
Address += PAGE_SIZE)
KeDetachProcess();
}
- /* Remove the tree item. */
+ /* Remove the tree item. */
{
if (MemoryArea->Parent != NULL)
{
*
* Free an existing memory area given a pointer inside it.
*
- * @param AddressSpace
+ * @param AddressSpace
* Address space to free the area from.
* @param BaseAddress
* Address in the memory area we're about to free.
*
* Create a memory area.
*
- * @param AddressSpace
+ * @param AddressSpace
* Address space to create the area in.
* @param Type
* Type of the memory area.
PLIST_ENTRY Entry;
PMM_REGION Region;
BOOLEAN Reserved;
-
+
MmVerifyMemoryAreas(AddressSpace);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, BaseAddress);