/* If this function is not called from within an enabled periodic SMI handler, then 0 is returned. */
UINT64 EFIAPI PeriodicSmiYield(VOID)
/* If this function is not called from within an enabled periodic SMI handler, then 0 is returned. */
UINT64 EFIAPI PeriodicSmiYield(VOID)
{
  PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT  *PeriodicSmiLibraryHandler;
  UINTN                                 SetJumpFlag;
  PeriodicSmiLibraryHandler = GetActivePeriodicSmiLibraryHandler ();
  if (PeriodicSmiLibraryHandler == NULL) {
    return 0;
  }
  if (PeriodicSmiLibraryHandler->Stack == NULL) {
    return 0;
  }
  PeriodicSmiLibraryHandler->YieldFlag = TRUE;
  SetJumpFlag = SetJump (&PeriodicSmiLibraryHandler->YieldJumpBuffer);
  if (SetJumpFlag == 0) {
    PeriodicSmiExit ();
  }
  PeriodicSmiLibraryHandler->YieldFlag = FALSE;
  return PeriodicSmiLibraryHandler->ElapsedTime;
}