/* Check if the combination for Attribute and Mask is valid for non-present entry. 1.Mask.Present is 0 but some other attributes is provided. This case should be invalid. 2.Map non-present range to present. In this case, all attributes should be provided. */
RETURN_STATUS IsAttributesAndMaskValidForNonPresentEntry(IN IA32_MAP_ATTRIBUTE *Attribute, IN IA32_MAP_ATTRIBUTE *Mask)
/* Check if the combination for Attribute and Mask is valid for non-present entry. 1.Mask.Present is 0 but some other attributes is provided. This case should be invalid. 2.Map non-present range to present. In this case, all attributes should be provided. */
RETURN_STATUS IsAttributesAndMaskValidForNonPresentEntry(IN IA32_MAP_ATTRIBUTE *Attribute, IN IA32_MAP_ATTRIBUTE *Mask)
{
  if ((Mask->Bits.Present == 1) && (Attribute->Bits.Present == 1)) {
    if ((Mask->Bits.ReadWrite == 0) || (Mask->Bits.UserSupervisor == 0) || (Mask->Bits.WriteThrough == 0) || (Mask->Bits.CacheDisabled == 0) ||
        (Mask->Bits.Accessed == 0) || (Mask->Bits.Dirty == 0) || (Mask->Bits.Pat == 0) || (Mask->Bits.Global == 0) ||
        ((Mask->Bits.PageTableBaseAddressLow == 0) && (Mask->Bits.PageTableBaseAddressHigh == 0)) || (Mask->Bits.ProtectionKey == 0) || (Mask->Bits.Nx == 0))
    {
      return RETURN_INVALID_PARAMETER;
    }
  } else if ((Mask->Bits.Present == 0) && (Mask->Uint64 > 1)) {
    return RETURN_INVALID_PARAMETER;
  }
  return RETURN_SUCCESS;
}