632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/* $Id$ */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/** @file
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * PDM Asynchronous Completion Testcase.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync *
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * This testcase is for testing the async completion interface.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * It implements a file copy program which uses the interface to copy the data.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync *
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Use: ./tstPDMAsyncCompletion <source> <destination>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2008-2013 Oracle Corporation
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync *
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * available from http://www.virtualbox.org. This file is free software;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * you can redistribute it and/or modify it under the terms of the GNU
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * General Public License (GPL) as published by the Free Software
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync */
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/*******************************************************************************
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync* Header Files *
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync*******************************************************************************/
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#define LOG_GROUP LOG_GROUP_PDM_ASYNC_COMPLETION
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
0c437bb10c61b229407a7517efde04dfe3b1e4a1vboxsync#include "VMInternal.h" /* UVM */
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync#include <VBox/vmm/vm.h>
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync#include <VBox/vmm/uvm.h>
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync#include <VBox/vmm/pdmasynccompletion.h>
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync#include <VBox/vmm/vmm.h>
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync#include <VBox/vmm/cpum.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/err.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <VBox/log.h>
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync#include <VBox/vmm/pdmapi.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/alloc.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/asm.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/assert.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/file.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/initterm.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/semaphore.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/stream.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/string.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#include <iprt/thread.h>
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#define TESTCASE "tstPDMAsyncCompletion"
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Number of simultaneous active tasks.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync#define NR_TASKS 80
0493c79a1867f7760af6bc330c8c42a09da852abvboxsync#define BUFFER_SIZE (64*_1K)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync/* Buffers to store data in .*/
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncuint8_t *g_AsyncCompletionTasksBuffer[NR_TASKS];
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncPPDMASYNCCOMPLETIONTASK g_AsyncCompletionTasks[NR_TASKS];
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncvolatile uint32_t g_cTasksLeft;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsyncRTSEMEVENT g_FinishedEventSem;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
22ec733a5e041fcdfe02fce2eafc9faf8b0077ddvboxsyncvoid pfnAsyncTaskCompleted(PVM pVM, void *pvUser, void *pvUser2, int rc)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync{
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync LogFlow((TESTCASE ": %s: pVM=%p pvUser=%p pvUser2=%p\n", __FUNCTION__, pVM, pvUser, pvUser2));
54211a0f33e1613ca0f749141ee8ec6fc0ea5c68vboxsync NOREF(rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync uint32_t cTasksStillLeft = ASMAtomicDecU32(&g_cTasksLeft);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (!cTasksStillLeft)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* All tasks processed. Wakeup main. */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTSemEventSignal(g_FinishedEventSem);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync}
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync/**
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync * Entry point.
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync */
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsyncextern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync{
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync int rcRet = 0; /* error count */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PPDMASYNCCOMPLETIONENDPOINT pEndpointSrc, pEndpointDst;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
230bd8589bba39933ac5ec21482d6186d675e604vboxsync RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (argc != 3)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": Usage is ./tstPDMAsyncCompletion <source> <dest>\n");
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync return 1;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PVM pVM;
021c939a9e3f688c0c3bbd759354be906bb2dcabvboxsync PUVM pUVM;
021c939a9e3f688c0c3bbd759354be906bb2dcabvboxsync int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM, &pUVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_SUCCESS(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Little hack to avoid the VM_ASSERT_EMT assertion.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTTlsSet(pVM->pUVM->vm.s.idxTLS, &pVM->pUVM->aCpus[0]);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync pVM->pUVM->aCpus[0].pUVM = pVM->pUVM;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync pVM->pUVM->aCpus[0].vm.s.NativeThreadEMT = RTThreadNativeSelf();
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Create the template.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
021c939a9e3f688c0c3bbd759354be906bb2dcabvboxsync PPDMASYNCCOMPLETIONTEMPLATE pTemplate;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = PDMR3AsyncCompletionTemplateCreateInternal(pVM, &pTemplate, pfnAsyncTaskCompleted, NULL, "Test");
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_FAILURE(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": Error while creating the template!! rc=%d\n", rc);
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync return 1;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * Create event semaphore.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = RTSemEventCreate(&g_FinishedEventSem);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertRC(rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Create the temporary buffers.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
b4fc07ae3f394595370fc5ed6ab1c353a87259dbvboxsync for (unsigned i=0; i < NR_TASKS; i++)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync g_AsyncCompletionTasksBuffer[i] = (uint8_t *)RTMemAllocZ(BUFFER_SIZE);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (!g_AsyncCompletionTasksBuffer[i])
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": out of memory!\n");
b4fc07ae3f394595370fc5ed6ab1c353a87259dbvboxsync return ++rcRet;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* Create the destination as the async completion API can't do this. */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTFILE FileTmp;
8bed792bc65abd39393889351f22263ce6c289bfvboxsync rc = RTFileOpen(&FileTmp, argv[2], RTFILE_O_READWRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_NONE);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_FAILURE(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": Error while creating the destination!! rc=%d\n", rc);
b4fc07ae3f394595370fc5ed6ab1c353a87259dbvboxsync return ++rcRet;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTFileClose(FileTmp);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* Create our file endpoint */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = PDMR3AsyncCompletionEpCreateForFile(&pEndpointSrc, argv[1], 0, pTemplate);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_SUCCESS(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = PDMR3AsyncCompletionEpCreateForFile(&pEndpointDst, argv[2], 0, pTemplate);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_SUCCESS(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMR3PowerOn(pVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* Wait for all threads to finish initialization. */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTThreadSleep(100);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync int fReadPass = true;
9ee436b6765f11cddb90819b9c4fc67899ba479bvboxsync uint64_t cbSrc;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync size_t offSrc = 0;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync size_t offDst = 0;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync uint32_t cTasksUsed = 0;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = PDMR3AsyncCompletionEpGetSize(pEndpointSrc, &cbSrc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (RT_SUCCESS(rc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /* Copy the data. */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync for (;;)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync if (fReadPass)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync cTasksUsed = (BUFFER_SIZE * NR_TASKS) <= (cbSrc - offSrc)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync ? NR_TASKS
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync : ((cbSrc - offSrc) / BUFFER_SIZE)
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync + ((cbSrc - offSrc) % BUFFER_SIZE) > 0
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync ? 1
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync : 0;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync g_cTasksLeft = cTasksUsed;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync for (uint32_t i = 0; i < cTasksUsed; i++)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync size_t cbRead = ((size_t)offSrc + BUFFER_SIZE) <= cbSrc ? BUFFER_SIZE : cbSrc - offSrc;
a9f41cb889f53e8407561a6155052c441eb0fc5fvboxsync RTSGSEG DataSeg;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync DataSeg.pvSeg = g_AsyncCompletionTasksBuffer[i];
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync DataSeg.cbSeg = cbRead;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync rc = PDMR3AsyncCompletionEpRead(pEndpointSrc, offSrc, &DataSeg, 1, cbRead, NULL,
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync &g_AsyncCompletionTasks[i]);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertRC(rc);
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync offSrc += cbRead;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync if (offSrc == cbSrc)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync break;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync g_cTasksLeft = cTasksUsed;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync for (uint32_t i = 0; i < cTasksUsed; i++)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync size_t cbWrite = (offDst + BUFFER_SIZE) <= cbSrc ? BUFFER_SIZE : cbSrc - offDst;
a9f41cb889f53e8407561a6155052c441eb0fc5fvboxsync RTSGSEG DataSeg;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync DataSeg.pvSeg = g_AsyncCompletionTasksBuffer[i];
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync DataSeg.cbSeg = cbWrite;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync rc = PDMR3AsyncCompletionEpWrite(pEndpointDst, offDst, &DataSeg, 1, cbWrite, NULL,
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync &g_AsyncCompletionTasks[i]);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertRC(rc);
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync offDst += cbWrite;
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync if (offDst == cbSrc)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync break;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rc = RTSemEventWait(g_FinishedEventSem, RT_INDEFINITE_WAIT);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertRC(rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0f8619bc2bbe3614578c21b5b50a88d2841e7aavboxsync if (!fReadPass && (offDst == cbSrc))
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync break;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else if (fReadPass)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync fReadPass = false;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync cTasksUsed = 0;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync fReadPass = true;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": Error querying size of the endpoint!! rc=%d\n", rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rcRet++;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMR3PowerOff(pVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMR3AsyncCompletionEpClose(pEndpointDst);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync PDMR3AsyncCompletionEpClose(pEndpointSrc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
021c939a9e3f688c0c3bbd759354be906bb2dcabvboxsync rc = VMR3Destroy(pUVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync AssertMsg(rc == VINF_SUCCESS, ("%s: Destroying VM failed rc=%Rrc!!\n", __FUNCTION__, rc));
021c939a9e3f688c0c3bbd759354be906bb2dcabvboxsync VMR3ReleaseUVM(pUVM);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync /*
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync * Clean up.
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync */
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync for (uint32_t i = 0; i < NR_TASKS; i++)
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTMemFree(g_AsyncCompletionTasksBuffer[i]);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync else
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync {
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync RTPrintf(TESTCASE ": failed to create VM!! rc=%Rrc\n", rc);
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync rcRet++;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync }
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync return rcRet;
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync}
632b4638bd18092c6b8edb4e1028c9be112f5076vboxsync
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync#if !defined(VBOX_WITH_HARDENING) || !defined(RT_OS_WINDOWS)
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync/**
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync * Main entry point.
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync */
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsyncint main(int argc, char **argv, char **envp)
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync{
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync return TrustedMain(argc, argv, envp);
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync}
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync#endif
a0ed9c35186427ae0abbd14b1cfdf43bf2dc8659vboxsync