/* Check whether the start address of buffer is within any of the SMRAM ranges. */
BOOLEAN EFIAPI BufferInSmram(IN VOID *Buffer)
/* Check whether the start address of buffer is within any of the SMRAM ranges. */
BOOLEAN EFIAPI BufferInSmram(IN VOID *Buffer)
{
  UINTN  Index;
  for (Index = 0; Index < mSmmCoreMemoryAllocLibSmramRangeCount; Index++) {
    if (((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer >= mSmmCoreMemoryAllocLibSmramRanges[Index].CpuStart) &&
        ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer < (mSmmCoreMemoryAllocLibSmramRanges[Index].CpuStart + mSmmCoreMemoryAllocLibSmramRanges[Index].PhysicalSize)))
    {
      return TRUE;
    }
  }
  return FALSE;
}