)
{
PVOID Entry = NULL;
- ULONG Index = 0;
+ ULONG Index;
BOOLEAN Result;
/* Check for invalid parameters */
- if (!(Table) || !(EntryIndex) || !(Count))
+ if (!(Table) || !(EntryIndex))
{
return Entry;
}
/* Loop each entry in the table */
- while (Index < Count)
+ for (Index = 0; Index < Count; Index++)
{
/* Check if this entry is filled out */
if (Table[Index])
/* Bail out if the type doesn't match */
if (Descriptor->Type != MemoryType)
{
- //EarlyPrint(L"Incorrect descriptor type\r\n");
+ //EfiPrintf(L"Incorrect descriptor type: %lx %lx\r\n", Descriptor->Type, MemoryType);
return FALSE;
}
NewDescriptor->Type = Descriptor->Type;
NewDescriptor->VirtualPage = VirtualPage;
NewDescriptor->Flags = Descriptor->Flags;
- //EarlyPrint(L"Found a matching descriptor: %08I64X with %08I64X pages\r\n", BasePage, Pages);
+ //EfiPrintf(L"Found a matching descriptor: %08I64X with %08I64X pages\r\n", BasePage, Pages);
return TRUE;
}
}
/* Save the links */
- OldFlink = OldDescriptor->ListEntry.Blink;
- OldBlink = OldDescriptor->ListEntry.Flink;
+ OldBlink = OldDescriptor->ListEntry.Blink;
+ OldFlink = OldDescriptor->ListEntry.Flink;
/* Make the copy */
*Descriptor = *OldDescriptor;
ListHead = CurrentList->First;
if (Request->Type & BL_MM_REQUEST_TOP_DOWN_TYPE)
{
- NextEntry = ListHead->Flink;
- TopDown = FALSE;
+ NextEntry = ListHead->Blink;
+ TopDown = TRUE;
}
else
{
- NextEntry = ListHead->Blink;
- TopDown = TRUE;
+ NextEntry = ListHead->Flink;
+ TopDown = FALSE;
}
/* Loop through the list */