/* Check whether the input range is in memory map. */
BOOLEAN InMemMap(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
/* Check whether the input range is in memory map. */
BOOLEAN InMemMap(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
{
  LIST_ENTRY            *Link;
  MEMORY_MAP            *Entry;
  EFI_PHYSICAL_ADDRESS  Last;
  Last = Memory + EFI_PAGES_TO_SIZE (NumberOfPages) - 1;
  Link = gMemoryMap.ForwardLink;
  while (Link != &gMemoryMap) {
    Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
    Link  = Link->ForwardLink;
    if ((Entry->Start <= Memory) && (Entry->End >= Last)) {
      return TRUE;
    }
  }
  return FALSE;
}