/* This function sets the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes. */
EFI_STATUS SmmSetMemoryAttributesEx(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
/* This function sets the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes. */
EFI_STATUS SmmSetMemoryAttributesEx(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
{
  EFI_STATUS  Status;
  BOOLEAN     IsModified;
  Status = ConvertMemoryPageAttributes (PageTableBase, PagingMode, BaseAddress, Length, Attributes, TRUE, &IsModified);
  if (!EFI_ERROR (Status)) {
    if (IsModified) {
      FlushTlbForAll ();
    }
  }
  return Status;
}