/* Sets the necessary fields of the GHCB, invokes the VMGEXIT instruction and then handles the return actions. */
UINT64 EFIAPI CcExitVmgExit(IN OUT GHCB *Ghcb, IN UINT64 ExitCode, IN UINT64 ExitInfo1, IN UINT64 ExitInfo2)
/* Sets the necessary fields of the GHCB, invokes the VMGEXIT instruction and then handles the return actions. */
UINT64 EFIAPI CcExitVmgExit(IN OUT GHCB *Ghcb, IN UINT64 ExitCode, IN UINT64 ExitInfo1, IN UINT64 ExitInfo2)
{
  Ghcb->SaveArea.SwExitCode  = ExitCode;
  Ghcb->SaveArea.SwExitInfo1 = ExitInfo1;
  Ghcb->SaveArea.SwExitInfo2 = ExitInfo2;
  CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitCode);
  CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitInfo1);
  CcExitVmgSetOffsetValid (Ghcb, GhcbSwExitInfo2);
  MemoryFence ();
  AsmVmgExit ();
  MemoryFence ();
  return VmgExitErrorCheck (Ghcb);
}