/* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */
UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds)
/* Stalls the CPU for the number of nanoseconds specified by NanoSeconds. */
UINTN EFIAPI NanoSecondDelay(IN UINTN NanoSeconds)
{
  EMU_THUNK_PPI       *ThunkPpi;
  EFI_STATUS          Status;
  EMU_THUNK_PROTOCOL  *Thunk;
  Status = PeiServicesLocatePpi (
             &gEmuThunkPpiGuid,
             0,
             NULL,
             (VOID **)&ThunkPpi
             );
  if (!EFI_ERROR (Status)) {
    Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
    Thunk->Sleep (NanoSeconds);
    return NanoSeconds;
  }
  return 0;
}