/* we need to detect all attempts to write to the EBC entry point argument stack area and adjust the address (which will initially point into the VM stack) to point into the EBC entry point arguments. */
EFI_STATUS VmWriteMem64(IN VM_CONTEXT *VmPtr, IN UINTN Addr, IN UINT64 Data)
/* we need to detect all attempts to write to the EBC entry point argument stack area and adjust the address (which will initially point into the VM stack) to point into the EBC entry point arguments. */
EFI_STATUS VmWriteMem64(IN VM_CONTEXT *VmPtr, IN UINTN Addr, IN UINT64 Data)
{
  EFI_STATUS  Status;
  Addr = ConvertStackAddr (VmPtr, Addr);
  if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) {
    *(UINT64 *)Addr = Data;
  } else {
    MemoryFence ();
    if ((Status = VmWriteMem32 (VmPtr, Addr, (UINT32)Data)) != EFI_SUCCESS) {
      return Status;
    }
    MemoryFence ();
    if ((Status = VmWriteMem32 (VmPtr, Addr + sizeof (UINT32), (UINT32)RShiftU64 (Data, 32))) != EFI_SUCCESS) {
      return Status;
    }
    MemoryFence ();
  }
  return EFI_SUCCESS;
}