VMReq.cpp revision 31df2136509ef13563384599000b68849b4dbdfb
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VM - Virtual Machine
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Copyright (C) 2006-2007 Oracle Corporation
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
26456d1900aba0e903e6e1beec552396618322e2vboxsync * available from http://www.virtualbox.org. This file is free software;
26456d1900aba0e903e6e1beec552396618322e2vboxsync * you can redistribute it and/or modify it under the terms of the GNU
26456d1900aba0e903e6e1beec552396618322e2vboxsync * General Public License (GPL) as published by the Free Software
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
26456d1900aba0e903e6e1beec552396618322e2vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
26456d1900aba0e903e6e1beec552396618322e2vboxsync/*******************************************************************************
26456d1900aba0e903e6e1beec552396618322e2vboxsync* Header Files *
26456d1900aba0e903e6e1beec552396618322e2vboxsync*******************************************************************************/
6a4c7474dbecb411cc7288459141b7cdd654ab3bvboxsync/*******************************************************************************
26456d1900aba0e903e6e1beec552396618322e2vboxsync* Internal Functions *
26456d1900aba0e903e6e1beec552396618322e2vboxsync*******************************************************************************/
26456d1900aba0e903e6e1beec552396618322e2vboxsyncstatic int vmR3ReqProcessOneU(PUVM pUVM, PVMREQ pReq);
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Allocate and queue a call request.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * If it's desired to poll on the completion of the request set cMillies
26456d1900aba0e903e6e1beec552396618322e2vboxsync * to 0 and use VMR3ReqWait() to check for completion. In the other case
26456d1900aba0e903e6e1beec552396618322e2vboxsync * use RT_INDEFINITE_WAIT.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * The returned request packet must be freed using VMR3ReqFree().
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Will not return VERR_INTERRUPTED.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pVM The VM handle.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ppReq Where to store the pointer to the request.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This will be NULL or a valid request pointer not matter what happens.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cMillies Number of milliseconds to wait for the request to
26456d1900aba0e903e6e1beec552396618322e2vboxsync * be completed. Use RT_INDEFINITE_WAIT to only
26456d1900aba0e903e6e1beec552396618322e2vboxsync * wait till it's completed.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param fFlags A combination of the VMREQFLAGS values.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCall(PVM pVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags,
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, ppReq, cMillies, fFlags, pfnFunction, cArgs, va);
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Convenience wrapper for VMR3ReqCallU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This assumes (1) you're calling a function that returns an VBox status code,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * (2) that you want it's return code on success, and (3) that you wish to wait
26456d1900aba0e903e6e1beec552396618322e2vboxsync * for ever for it to return.
6a4c7474dbecb411cc7288459141b7cdd654ab3bvboxsync * @returns VBox status code. In the unlikely event that VMR3ReqCallVU fails,
6a4c7474dbecb411cc7288459141b7cdd654ab3bvboxsync * its status code is return. Otherwise, the status of pfnFunction is
6a4c7474dbecb411cc7288459141b7cdd654ab3bvboxsync * returned.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pVM Pointer to the shared VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Convenience wrapper for VMR3ReqCallU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This assumes (1) you're calling a function that returns an VBox status code,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * (2) that you want it's return code on success, and (3) that you wish to wait
26456d1900aba0e903e6e1beec552396618322e2vboxsync * for ever for it to return.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code. In the unlikely event that VMR3ReqCallVU fails,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * its status code is return. Otherwise, the status of pfnFunction is
26456d1900aba0e903e6e1beec552396618322e2vboxsync * returned.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pUVM Pointer to the user mode VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
6a4c7474dbecb411cc7288459141b7cdd654ab3bvboxsyncVMMR3DECL(int) VMR3ReqCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Convenience wrapper for VMR3ReqCallU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This assumes (1) you're calling a function that returns an VBox status code
26456d1900aba0e903e6e1beec552396618322e2vboxsync * and that you do not wish to wait for it to complete.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code returned by VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pVM Pointer to the shared VM structure.
6a4c7474dbecb411cc7288459141b7cdd654ab3bvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
6a4c7474dbecb411cc7288459141b7cdd654ab3bvboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Convenience wrapper for VMR3ReqCallU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This assumes (1) you're calling a function that returns an VBox status code
26456d1900aba0e903e6e1beec552396618322e2vboxsync * and that you do not wish to wait for it to complete.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code returned by VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pUVM Pointer to the user mode VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
6a4c7474dbecb411cc7288459141b7cdd654ab3bvboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCallNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Convenience wrapper for VMR3ReqCallU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This assumes (1) you're calling a function that returns void, and (2) that
26456d1900aba0e903e6e1beec552396618322e2vboxsync * you wish to wait for ever for it to return.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code of VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pVM Pointer to the shared VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Convenience wrapper for VMR3ReqCallU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This assumes (1) you're calling a function that returns void, and (2) that
26456d1900aba0e903e6e1beec552396618322e2vboxsync * you wish to wait for ever for it to return.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code of VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pUVM Pointer to the user mode VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Convenience wrapper for VMR3ReqCallU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This assumes (1) you're calling a function that returns void, and (2) that
26456d1900aba0e903e6e1beec552396618322e2vboxsync * you do not wish to wait for it to complete.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code of VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pVM Pointer to the shared VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_NO_WAIT,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Convenience wrapper for VMR3ReqCallU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This assumes (1) you're calling a function that returns void, and (2) that
26456d1900aba0e903e6e1beec552396618322e2vboxsync * you do not wish to wait for it to complete.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code of VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pUVM Pointer to the user mode VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCallVoidNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_NO_WAIT,
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Allocate and queue a call request to a void function.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * If it's desired to poll on the completion of the request set cMillies
26456d1900aba0e903e6e1beec552396618322e2vboxsync * to 0 and use VMR3ReqWait() to check for completion. In the other case
26456d1900aba0e903e6e1beec552396618322e2vboxsync * use RT_INDEFINITE_WAIT.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * The returned request packet must be freed using VMR3ReqFree().
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code.
742ee7392dfc0ce0b48216189ce26534208b3f48vboxsync * Will not return VERR_INTERRUPTED.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pUVM Pointer to the user mode VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
742ee7392dfc0ce0b48216189ce26534208b3f48vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ppReq Where to store the pointer to the request.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This will be NULL or a valid request pointer not matter what happens, unless fFlags
26456d1900aba0e903e6e1beec552396618322e2vboxsync * contains VMREQFLAGS_NO_WAIT when it will be optional and always NULL.
742ee7392dfc0ce0b48216189ce26534208b3f48vboxsync * @param cMillies Number of milliseconds to wait for the request to
742ee7392dfc0ce0b48216189ce26534208b3f48vboxsync * be completed. Use RT_INDEFINITE_WAIT to only
742ee7392dfc0ce0b48216189ce26534208b3f48vboxsync * wait till it's completed.
742ee7392dfc0ce0b48216189ce26534208b3f48vboxsync * @param fFlags A combination of the VMREQFLAGS values.
742ee7392dfc0ce0b48216189ce26534208b3f48vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ... Function arguments.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @remarks See remarks on VMR3ReqCallVU.
26456d1900aba0e903e6e1beec552396618322e2vboxsyncVMMR3DECL(int) VMR3ReqCallU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags,
26456d1900aba0e903e6e1beec552396618322e2vboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, ppReq, cMillies, fFlags, pfnFunction, cArgs, va);
26456d1900aba0e903e6e1beec552396618322e2vboxsync * Allocate and queue a call request.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * If it's desired to poll on the completion of the request set cMillies
26456d1900aba0e903e6e1beec552396618322e2vboxsync * to 0 and use VMR3ReqWait() to check for completion. In the other case
26456d1900aba0e903e6e1beec552396618322e2vboxsync * use RT_INDEFINITE_WAIT.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * The returned request packet must be freed using VMR3ReqFree().
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @returns VBox status code.
2084a447d1acb619df7c393fac41b79d517e4b3dvboxsync * Will not return VERR_INTERRUPTED.
2084a447d1acb619df7c393fac41b79d517e4b3dvboxsync * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pUVM Pointer to the user mode VM structure.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
26456d1900aba0e903e6e1beec552396618322e2vboxsync * one of the following special values:
26456d1900aba0e903e6e1beec552396618322e2vboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param ppReq Where to store the pointer to the request.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * This will be NULL or a valid request pointer not matter what happens, unless fFlags
26456d1900aba0e903e6e1beec552396618322e2vboxsync * contains VMREQFLAGS_NO_WAIT when it will be optional and always NULL.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cMillies Number of milliseconds to wait for the request to
26456d1900aba0e903e6e1beec552396618322e2vboxsync * be completed. Use RT_INDEFINITE_WAIT to only
26456d1900aba0e903e6e1beec552396618322e2vboxsync * wait till it's completed.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param pfnFunction Pointer to the function to call.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param fFlags A combination of the VMREQFLAGS values.
26456d1900aba0e903e6e1beec552396618322e2vboxsync * @param cArgs Number of arguments following in the ellipsis.
VMMR3DECL(int) VMR3ReqCallVU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags,
LogFlow(("VMR3ReqCallV: idDstCpu=%u cMillies=%d fFlags=%#x pfnFunction=%p cArgs=%d\n", idDstCpu, cMillies, fFlags, pfnFunction, cArgs));
AssertReturn(!(fFlags & ~(VMREQFLAGS_RETURN_MASK | VMREQFLAGS_NO_WAIT | VMREQFLAGS_POKE)), VERR_INVALID_PARAMETER);
return rc;
return rc;
if (!pHead)
vmr3ReqJoinFreeSub(&pVMInt->apReqFree[(i + 2 + (i == pVMInt->iReqFree)) % RT_ELEMENTS(pVMInt->apReqFree)], pTail->pNext);
vmr3ReqJoinFreeSub(&pVMInt->apReqFree[(pVMInt->iReqFree + 2) % RT_ELEMENTS(pVMInt->apReqFree)], pList);
while (--cTries >= 0)
PVMREQ volatile *ppHead = &pUVM->vm.s.apReqFree[ASMAtomicIncU32(&pUVM->vm.s.iReqFree) % RT_ELEMENTS(pUVM->vm.s.apReqFree)];
if ( pReq
if (pReq)
if (pReq)
if ( pNext
return rc;
return VINF_SUCCESS;
if (!pReq)
return VERR_NO_MEMORY;
return rc;
return VINF_SUCCESS;
if (!pReq)
return VINF_SUCCESS;
case VMREQSTATE_ALLOCATED:
case VMREQSTATE_COMPLETED:
return VERR_VM_REQUEST_STATE;
PVMREQ volatile *ppHead = &pUVM->vm.s.apReqFree[ASMAtomicIncU32(&pUVM->vm.s.iReqFree) % RT_ELEMENTS(pUVM->vm.s.apReqFree)];
return VINF_SUCCESS;
AssertMsgReturn(pReq->enmState == VMREQSTATE_ALLOCATED, ("%d\n", pReq->enmState), VERR_VM_REQUEST_STATE);
return rc;
int rc;
return rc;
static PVMREQ vmR3ReqProcessUTooManyHelper(PUVM pUVM, VMCPUID idDstCpu, PVMREQ pReqList, PVMREQ volatile *ppReqs)
ASMNopPause();
if (pReqList2)
return pReqRet;
LogFlow(("VMR3ReqProcessU: (enmVMState=%d) idDstCpu=%d\n", pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING, idDstCpu));
if (!pReq)
LogFlow(("VMR3ReqProcess: returns %Rrc (enmVMState=%d)\n", rc, pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING));
return rc;
case VMREQTYPE_INTERNAL:
DECLCALLBACKMEMBER(int, pfn07)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
DECLCALLBACKMEMBER(int, pfn08)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
DECLCALLBACKMEMBER(int, pfn09)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
DECLCALLBACKMEMBER(int, pfn10)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
DECLCALLBACKMEMBER(int, pfn11)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
DECLCALLBACKMEMBER(int, pfn12)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
DECLCALLBACKMEMBER(int, pfn13)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
DECLCALLBACKMEMBER(int, pfn14)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
DECLCALLBACKMEMBER(int, pfn15)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
#ifdef RT_ARCH_AMD64
case 6: rcRet = u.pfn06(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5]); break;
case 7: rcRet = u.pfn07(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6]); break;
case 8: rcRet = u.pfn08(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6], pauArgs[7]); break;
case 9: rcRet = u.pfn09(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6], pauArgs[7], pauArgs[8]); break;
case 10: rcRet = u.pfn10(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6], pauArgs[7], pauArgs[8], pauArgs[9]); break;
case 11: rcRet = u.pfn11(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6], pauArgs[7], pauArgs[8], pauArgs[9], pauArgs[10]); break;
case 12: rcRet = u.pfn12(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6], pauArgs[7], pauArgs[8], pauArgs[9], pauArgs[10], pauArgs[11]); break;
case 13: rcRet = u.pfn13(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6], pauArgs[7], pauArgs[8], pauArgs[9], pauArgs[10], pauArgs[11], pauArgs[12]); break;
case 14: rcRet = u.pfn14(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6], pauArgs[7], pauArgs[8], pauArgs[9], pauArgs[10], pauArgs[11], pauArgs[12], pauArgs[13]); break;
case 15: rcRet = u.pfn15(pauArgs[0], pauArgs[1], pauArgs[2], pauArgs[3], pauArgs[4], pauArgs[5], pauArgs[6], pauArgs[7], pauArgs[8], pauArgs[9], pauArgs[10], pauArgs[11], pauArgs[12], pauArgs[13], pauArgs[14]); break;
# ifdef __GNUC__
LogFlow(("vmR3ReqProcessOneU: Completed request %p: rcReq=%Rrc rcRet=%Rrc - notifying waiting thread\n",
return rcRet;