/* Internal worker function that transfers control to an enabled periodic SMI handler on the specified logical CPU. This function determines if the periodic SMI handler yielded and needs to be resumed. It also and switches to an allocated stack if one was allocated in  */
VOID EFIAPI PeriodicSmiDispatchFunctionOnCpu(PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler)
/* Internal worker function that transfers control to an enabled periodic SMI handler on the specified logical CPU. This function determines if the periodic SMI handler yielded and needs to be resumed. It also and switches to an allocated stack if one was allocated in  */
VOID EFIAPI PeriodicSmiDispatchFunctionOnCpu(PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler)
{
  if (SetJump (&PeriodicSmiLibraryHandler->DispatchJumpBuffer) != 0) {
    return;
  }
  PeriodicSmiLibraryHandler->DispatchTotalTime      = 0;
  PeriodicSmiLibraryHandler->DispatchCheckPointTime = GetPerformanceCounter ();
  if (PeriodicSmiLibraryHandler->YieldFlag) {
    LongJump (&PeriodicSmiLibraryHandler->YieldJumpBuffer, 1);
  } else if (PeriodicSmiLibraryHandler->Stack == NULL) {
    PeriodicSmiLibraryHandler->DispatchFunction (
                                 PeriodicSmiLibraryHandler->Context,
                                 PeriodicSmiLibraryHandler->ElapsedTime
                                 );
    PeriodicSmiExit ();
  } else {
    SwitchStack (
      PeriodicSmiDispatchFunctionSwitchStack,
      PeriodicSmiLibraryHandler,
      NULL,
      (UINT8 *)PeriodicSmiLibraryHandler->Stack + PeriodicSmiLibraryHandler->StackSize
      );
  }
  ASSERT (FALSE);
  CpuDeadLoop ();
}