/* Check if the memory address will be mapped by 4KB-page. */
BOOLEAN IsAddressValid(IN EFI_PHYSICAL_ADDRESS Address, IN BOOLEAN *Nx)
/* Check if the memory address will be mapped by 4KB-page. */
BOOLEAN IsAddressValid(IN EFI_PHYSICAL_ADDRESS Address, IN BOOLEAN *Nx)
{
  UINTN  Index;
  if (FeaturePcdGet (PcdCpuSmmProfileEnable)) {
    for (Index = 0; Index < mProtectionMemRangeCount; Index++) {
      if ((Address >= mProtectionMemRange[Index].Range.Base) && (Address < mProtectionMemRange[Index].Range.Top)) {
        *Nx = mProtectionMemRange[Index].Nx;
        return mProtectionMemRange[Index].Present;
      }
    }
    *Nx = TRUE;
    return FALSE;
  } else {
    *Nx = TRUE;
    if (IsInSmmRanges (Address)) {
      *Nx = FALSE;
    }
    return TRUE;
  }
}