VMReq.cpp revision d099ccfb66d26601f93e7967e8e73cee4b9c62df
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VM - Virtual Machine
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * available from http://www.virtualbox.org. This file is free software;
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * General Public License (GPL) as published by the Free Software
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * additional information or have any questions.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync/*******************************************************************************
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync* Header Files *
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync*******************************************************************************/
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync/*******************************************************************************
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync* Internal Functions *
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync*******************************************************************************/
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncstatic int vmR3ReqProcessOneU(PUVM pUVM, PVMREQ pReq);
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Allocate and queue a call request.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * If it's desired to poll on the completion of the request set cMillies
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * to 0 and use VMR3ReqWait() to check for completation. In the other case
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * use RT_INDEFINITE_WAIT.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * The returned request packet must be freed using VMR3ReqFree().
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Will not return VERR_INTERRUPTED.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
2b114c590cf5a19f8047cd7bde9c7e5ae00aa22bvboxsync * @param pVM The VM handle.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ppReq Where to store the pointer to the request.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This will be NULL or a valid request pointer not matter what happends.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cMillies Number of milliseconds to wait for the request to
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * be completed. Use RT_INDEFINITE_WAIT to only
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * wait till it's completed.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param fFlags A combination of the VMREQFLAGS values.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCall(PVM pVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, ppReq, cMillies, fFlags, pfnFunction, cArgs, va);
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Convenience wrapper for VMR3ReqCallU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This assumes (1) you're calling a function that returns an VBox status code,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * (2) that you want it's return code on success, and (3) that you wish to wait
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * for ever for it to return.
9beef4ee5d54e5730fddfc924490944218af58a7vboxsync * @returns VBox status code. In the unlikely event that VMR3ReqCallVU fails,
9beef4ee5d54e5730fddfc924490944218af58a7vboxsync * its status code is return. Otherwise, the status of pfnFunction is
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * returned.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pVM Pointer to the shared VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Convenience wrapper for VMR3ReqCallU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This assumes (1) you're calling a function that returns an VBox status code,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * (2) that you want it's return code on success, and (3) that you wish to wait
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * for ever for it to return.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code. In the unlikely event that VMR3ReqCallVU fails,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * its status code is return. Otherwise, the status of pfnFunction is
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * returned.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pUVM Pointer to the user mode VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Convenience wrapper for VMR3ReqCallU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This assumes (1) you're calling a function that returns an VBox status code
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * and that you do not wish to wait for it to complete.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code returned by VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pVM Pointer to the shared VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Convenience wrapper for VMR3ReqCallU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This assumes (1) you're calling a function that returns an VBox status code
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * and that you do not wish to wait for it to complete.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code returned by VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pUVM Pointer to the user mode VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Convenience wrapper for VMR3ReqCallU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This assumes (1) you're calling a function that returns void, and (2) that
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * you wish to wait for ever for it to return.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code of VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pVM Pointer to the shared VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Convenience wrapper for VMR3ReqCallU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This assumes (1) you're calling a function that returns void, and (2) that
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * you wish to wait for ever for it to return.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code of VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pUVM Pointer to the user mode VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Convenience wrapper for VMR3ReqCallU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This assumes (1) you're calling a function that returns void, and (2) that
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * you do not wish to wait for it to complete.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code of VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pVM Pointer to the shared VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_NO_WAIT,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Convenience wrapper for VMR3ReqCallU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This assumes (1) you're calling a function that returns void, and (2) that
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * you do not wish to wait for it to complete.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code of VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pUVM Pointer to the user mode VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallVoidNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...)
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_NO_WAIT,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Allocate and queue a call request to a void function.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * If it's desired to poll on the completion of the request set cMillies
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * to 0 and use VMR3ReqWait() to check for completation. In the other case
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * use RT_INDEFINITE_WAIT.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * The returned request packet must be freed using VMR3ReqFree().
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Will not return VERR_INTERRUPTED.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pUVM Pointer to the user mode VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ppReq Where to store the pointer to the request.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This will be NULL or a valid request pointer not matter what happends, unless fFlags
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * contains VMREQFLAGS_NO_WAIT when it will be optional and always NULL.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cMillies Number of milliseconds to wait for the request to
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * be completed. Use RT_INDEFINITE_WAIT to only
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * wait till it's completed.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param fFlags A combination of the VMREQFLAGS values.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pfnFunction Pointer to the function to call.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param cArgs Number of arguments following in the ellipsis.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ... Function arguments.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @remarks See remarks on VMR3ReqCallVU.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsyncVMMR3DECL(int) VMR3ReqCallU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags,
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync int rc = VMR3ReqCallVU(pUVM, idDstCpu, ppReq, cMillies, fFlags, pfnFunction, cArgs, va);
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * Allocate and queue a call request.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * If it's desired to poll on the completion of the request set cMillies
ecb98c0e709a5cebd8877fb39f61a821804024bcvboxsync * to 0 and use VMR3ReqWait() to check for completation. In the other case
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * use RT_INDEFINITE_WAIT.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * The returned request packet must be freed using VMR3ReqFree().
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VBox status code.
b1ac43a82a2e4114bc44feb83007a10c99077085vboxsync * Will not return VERR_INTERRUPTED.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param pUVM Pointer to the user mode VM structure.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param idDstCpu The destination CPU(s). Either a specific CPU ID or
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * one of the following special values:
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * @param ppReq Where to store the pointer to the request.
1e0e13b23ace43d2fe93d45953b123f63b7e547cvboxsync * This will be NULL or a valid request pointer not matter what happends, unless fFlags
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;
#ifdef RT_LOCK_STRICT
return VINF_SUCCESS;
if (!pReq)
return VERR_NO_MEMORY;
return rc;
#ifdef RT_LOCK_STRICT
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);
} while (!ASMAtomicCmpXchgPtr((void * volatile *)&pUVCpu->vm.s.pReqs, (void *)pReq, (void *)pNext));
return rc;
int rc;
return rc;
static PVMREQ vmR3ReqProcessUTooManyHelper(PUVM pUVM, VMCPUID idDstCpu, PVMREQ pReqList, void * volatile *ppvReqs)
ASMNopPause();
if (pReqList2)
return pReqRet;
LogFlow(("VMR3ReqProcessU: (enmVMState=%d) idDstCpu=%d\n", pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING, idDstCpu));
void * volatile *ppvReqs;
if (!pReq)
* and VMR3ReqProcessU in EM.cpp. */
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);
#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;
# ifdef __GNUC__
LogFlow(("vmR3ReqProcessOneU: Completed request %p: rcReq=%Rrc rcRet=%Rrc - notifying waiting thread\n",
return rcRet;