VirtualBox

Ignore:
Timestamp:
Jul 16, 2024 11:21:19 AM (6 months ago)
Author:
vboxsync
Message:

VMM/VMR3Req,iprt/cdefs.h: Adjustments of VMR3ReqCallUV family to fit darwin/arm64 restrictions. bugref:10725

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/VMReq.cpp

    r98103 r105352  
    7171 * @param   pfnFunction     Pointer to the function to call.
    7272 * @param   cArgs           Number of arguments following in the ellipsis.
     73 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     74 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     75 *                          is ORed in.
    7376 * @param   ...             Function arguments.
    7477 *
     
    108111 * @param   pfnFunction     Pointer to the function to call.
    109112 * @param   cArgs           Number of arguments following in the ellipsis.
     113 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     114 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     115 *                          is ORed in.
    110116 * @param   ...             Function arguments.
    111117 *
     
    142148 * @param   pfnFunction     Pointer to the function to call.
    143149 * @param   cArgs           Number of arguments following in the ellipsis.
     150 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     151 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     152 *                          is ORed in.
    144153 * @param   ...             Function arguments.
    145154 *
     
    172181 * @param   pfnFunction     Pointer to the function to call.
    173182 * @param   cArgs           Number of arguments following in the ellipsis.
     183 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     184 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     185 *                          is ORed in.
    174186 * @param   ...             Function arguments.
    175187 *
     
    201213 * @param   pfnFunction     Pointer to the function to call.
    202214 * @param   cArgs           Number of arguments following in the ellipsis.
     215 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     216 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     217 *                          is ORed in.
    203218 * @param   ...             Function arguments.
    204219 *
     
    233248 * @param   pfnFunction     Pointer to the function to call.
    234249 * @param   cArgs           Number of arguments following in the ellipsis.
     250 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     251 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     252 *                          is ORed in.
    235253 * @param   ...             Function arguments.
    236254 *
     
    264282 * @param   pfnFunction     Pointer to the function to call.
    265283 * @param   cArgs           Number of arguments following in the ellipsis.
     284 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     285 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     286 *                          is ORed in.
    266287 * @param   ...             Function arguments.
    267288 *
     
    300321 * @param   pfnFunction     Pointer to the function to call.
    301322 * @param   cArgs           Number of arguments following in the ellipsis.
     323 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     324 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     325 *                          is ORed in.
    302326 * @param   ...             Function arguments.
    303327 *
     
    338362 * @param   pfnFunction     Pointer to the function to call.
    339363 * @param   cArgs           Number of arguments following in the ellipsis.
     364 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     365 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     366 *                          is ORed in.
    340367 * @param   ...             Function arguments.
    341368 *
     
    372399 * @param   pfnFunction     Pointer to the function to call.
    373400 * @param   cArgs           Number of arguments following in the ellipsis.
     401 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     402 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     403 *                          is ORed in.
    374404 * @param   ...             Function arguments.
    375405 *
     
    414444 * @param   pfnFunction     Pointer to the function to call.
    415445 * @param   cArgs           Number of arguments following in the ellipsis.
     446 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     447 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     448 *                          is ORed in.
    416449 * @param   ...             Function arguments.
    417450 *
     
    454487 * @param   fFlags          A combination of the VMREQFLAGS values.
    455488 * @param   cArgs           Number of arguments following in the ellipsis.
     489 *                          The max is VMREQ_MAX_ARGS (9) (ARM64/darwin
     490 *                          peculiarities), unless VMREQ_F_EXTRA_ARGS_ALL_PTRS
     491 *                          is ORed in.
    456492 *                          Stuff which differs in size from uintptr_t is gonna make trouble, so don't try!
    457493 * @param   Args            Argument vector.
     
    465501 *                hosts because 'int' is 32-bit.
    466502 *                Use (void *)NULL or (uintptr_t)0 instead of NULL.
     503 *              - The max number of arguments is currently limited to 9, because
     504 *                on macOS/arm64 arguments passed on the stack that are 32-bit
     505 *                or smaller will not get a full 64-bit stack slot.  So,
     506 *                we cannot pretend @a pfnFunction takes a list of @a cArgs
     507 *                uintptr_t parameters, unless all parameters above 9 actually
     508 *                are more than 32 bits wide.   (This would've kind of worked
     509 *                iff the variadict functions didn't use different size round up
     510 *                and alignment rules.)  See @bugref{10725}.
    467511 */
    468512VMMR3DECL(int) VMR3ReqCallVU(PUVM pUVM, VMCPUID idDstCpu, PVMREQ *ppReq, RTMSINTERVAL cMillies, uint32_t fFlags,
    469513                             PFNRT pfnFunction, unsigned cArgs, va_list Args)
    470514{
    471     LogFlow(("VMR3ReqCallV: idDstCpu=%u cMillies=%d fFlags=%#x pfnFunction=%p cArgs=%d\n", idDstCpu, cMillies, fFlags, pfnFunction, cArgs));
     515    LogFlow(("VMR3ReqCallV: idDstCpu=%u cMillies=%d fFlags=%#x pfnFunction=%p cArgs=%#x\n", idDstCpu, cMillies, fFlags, pfnFunction, cArgs));
    472516
    473517    /*
     
    482526        *ppReq = NULL;
    483527    }
     528    AssertMsgReturn(   cArgs <= VMREQ_MAX_ARGS
     529                    || (   (cArgs & VMREQ_F_EXTRA_ARGS_ALL_PTRS)
     530                        && (cArgs & ~(unsigned)VMREQ_F_EXTRA_ARGS_ALL_PTRS) <= VMREQ_MAX_ARGS_EXTENDED),
     531                    ("cArgs=%#x\n", cArgs),
     532                    VERR_TOO_MUCH_DATA);
     533    cArgs &= ~(unsigned)VMREQ_F_EXTRA_ARGS_ALL_PTRS;
     534
     535    /*
     536     * Allocate request
     537     */
    484538    PVMREQ pReq = NULL;
    485     AssertMsgReturn(cArgs * sizeof(uintptr_t) <= sizeof(pReq->u.Internal.aArgs),
    486                     ("cArg=%d\n", cArgs),
    487                     VERR_TOO_MUCH_DATA);
    488 
    489     /*
    490      * Allocate request
    491      */
     539    AssertCompile(VMREQ_MAX_ARGS_EXTENDED * sizeof(uintptr_t) <= sizeof(pReq->u.Internal.aArgs));
    492540    int rc = VMR3ReqAlloc(pUVM, &pReq, VMREQTYPE_INTERNAL, idDstCpu);
    493541    if (RT_FAILURE(rc))
     
    497545     * Initialize the request data.
    498546     */
    499     pReq->fFlags         = fFlags;
    500     pReq->u.Internal.pfn = pfnFunction;
    501     pReq->u.Internal.cArgs = cArgs;
     547    pReq->fFlags            = fFlags;
     548    pReq->u.Internal.pfn    = pfnFunction;
     549    pReq->u.Internal.cArgs  = cArgs;
    502550    for (unsigned iArg = 0; iArg < cArgs; iArg++)
    503551        pReq->u.Internal.aArgs[iArg] = va_arg(Args, uintptr_t);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette