/* returns all SMI handlers' size associated with SmiEntry. */
UINTN GetSmmSmiHandlerSizeOnSmiEntry(IN SMI_ENTRY *SmiEntry)
/* returns all SMI handlers' size associated with SmiEntry. */
UINTN GetSmmSmiHandlerSizeOnSmiEntry(IN SMI_ENTRY *SmiEntry)
{
  LIST_ENTRY   *ListEntry;
  SMI_HANDLER  *SmiHandler;
  UINTN        Size;
  Size      = 0;
  ListEntry = &SmiEntry->SmiHandlers;
  for (ListEntry = ListEntry->ForwardLink;
       ListEntry != &SmiEntry->SmiHandlers;
       ListEntry = ListEntry->ForwardLink)
  {
    SmiHandler = CR (ListEntry, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
    Size      += sizeof (SMM_CORE_SMI_HANDLER_STRUCTURE) + GET_OCCUPIED_SIZE (SmiHandler->ContextSize, sizeof (UINT64));
  }
  return Size;
}