VirtualBox

Changeset 10724 in vbox for trunk


Ignore:
Timestamp:
Jul 17, 2008 1:08:56 PM (16 years ago)
Author:
vboxsync
Message:

Bumped the SUPDRV_IOC_VERSION major as the changes to the fast path on NT isn't backwards compatible. Made VMMR0EntryFast return void.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm.h

    r10450 r10724  
    370370    /** Official NOP that we use for profiling. */
    371371    VMMR0_DO_NOP = SUP_VMMR0_DO_NOP,
     372    /** Official slow iocl NOP that we use for profiling. */
     373    VMMR0_DO_SLOW_NOP,
    372374
    373375    /** Ask the GVMM to create a new VM. */
     
    493495 * @remarks Assume called with interrupts _enabled_.
    494496 */
    495 VMMR0DECL(int) VMMR0EntryFast(PVM pVM, VMMR0OPERATION enmOperation);
     497VMMR0DECL(void) VMMR0EntryFast(PVM pVM, VMMR0OPERATION enmOperation);
    496498
    497499/**
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r10697 r10724  
    717717int VBOXCALL supdrvIOCtlFast(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
    718718{
    719     int rc;
    720 
    721719    /*
    722720     * We check the two prereqs after doing this only to allow the compiler to optimize things better.
     
    727725        {
    728726            case SUP_IOCTL_FAST_DO_RAW_RUN:
    729                 rc = pDevExt->pfnVMMR0EntryFast(pSession->pVM, SUP_VMMR0_DO_RAW_RUN);
     727                pDevExt->pfnVMMR0EntryFast(pSession->pVM, SUP_VMMR0_DO_RAW_RUN);
    730728                break;
    731729            case SUP_IOCTL_FAST_DO_HWACC_RUN:
    732                 rc = pDevExt->pfnVMMR0EntryFast(pSession->pVM, SUP_VMMR0_DO_HWACC_RUN);
     730                pDevExt->pfnVMMR0EntryFast(pSession->pVM, SUP_VMMR0_DO_HWACC_RUN);
    733731                break;
    734732            case SUP_IOCTL_FAST_DO_NOP:
    735                 rc = pDevExt->pfnVMMR0EntryFast(pSession->pVM, SUP_VMMR0_DO_NOP);
     733                pDevExt->pfnVMMR0EntryFast(pSession->pVM, SUP_VMMR0_DO_NOP);
    736734                break;
    737735            default:
    738                 rc = VERR_INTERNAL_ERROR;
    739                 break;
    740         }
    741     }
    742     else
    743         rc = VERR_INTERNAL_ERROR;
    744 
    745     return rc;
     736                return VERR_INTERNAL_ERROR;
     737        }
     738        return VINF_SUCCESS;
     739    }
     740    return VERR_INTERNAL_ERROR;
    746741}
    747742
  • trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h

    r10680 r10724  
    182182 * The upper 16-bit is the major version, the the lower the minor version.
    183183 * When incompatible changes are made, the upper major number has to be changed. */
    184 #define SUPDRV_IOC_VERSION                              0x00070005
     184#define SUPDRV_IOC_VERSION                              0x00080000
    185185
    186186/** SUP_IOCTL_COOKIE. */
  • trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h

    r10377 r10724  
    615615    DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryInt, (PVM pVM, unsigned uOperation, void *pvArg));
    616616    /** VMMR0EntryFast() pointer. */
    617     DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryFast, (PVM pVM, unsigned uOperation));
     617    DECLR0CALLBACKMEMBER(void, pfnVMMR0EntryFast, (PVM pVM, unsigned uOperation));
    618618    /** VMMR0EntryEx() pointer. */
    619619    DECLR0CALLBACKMEMBER(int, pfnVMMR0EntryEx, (PVM pVM, unsigned uOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg));
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r10720 r10724  
    212212        strcpy(CookieReq.u.In.szMagic, SUPCOOKIE_MAGIC);
    213213        CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION;
    214         const uint32_t MinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00070000
    215                                   ? 0x00070005 /* need new exports */
    216                                   : SUPDRV_IOC_VERSION & 0xffff0000;
     214        const uint32_t MinVersion = /*(SUPDRV_IOC_VERSION & 0xffff0000) == 0x000y0000
     215                                  ? 0x000y000x
     216                                  : */SUPDRV_IOC_VERSION & 0xffff0000;
    217217        CookieReq.u.In.u32MinVersion = MinVersion;
    218218        rc = suplibOsIOCtl(SUP_IOCTL_COOKIE, &CookieReq, SUP_IOCTL_COOKIE_SIZE);
  • trunk/src/VBox/HostDrivers/Support/testcase/tstInt.cpp

    r8155 r10724  
    111111                pVM->paVMPagesR3 = paPages;
    112112                pVM->pSession = pSession;
     113                pVM->enmVMState = VMSTATE_CREATED;
    113114
    114115                rc = SUPSetVMForFastIOCtl(pVMR0);
     
    121122                    for (i = cIterations; i > 0; i--)
    122123                    {
    123                         rc = SUPCallVMMR0(pVMR0, VMMR0_DO_NOP, NULL);
     124                        rc = SUPCallVMMR0(pVMR0, VMMR0_DO_SLOW_NOP, NULL);
    124125                        if (rc != VINF_SUCCESS)
    125126                        {
     
    132133
    133134                    /*
    134                      * Profile it.
     135                     * The fast path.
    135136                     */
    136                     if (!rc)
     137                    if (rc == VINF_SUCCESS)
    137138                    {
    138139                        RTTimeNanoTS();
     
    143144                        {
    144145                            uint64_t OneStartTick = ASMReadTSC();
    145                             rc = SUPCallVMMR0(pVMR0, VMMR0_DO_NOP, NULL);
     146                            rc = SUPCallVMMR0Fast(pVMR0, VMMR0_DO_NOP);
    146147                            uint64_t Ticks = ASMReadTSC() - OneStartTick;
    147148                            if (Ticks < MinTicks)
     
    150151                            if (RT_UNLIKELY(rc != VINF_SUCCESS))
    151152                            {
    152                                 RTPrintf("tstInt: SUPCallVMMR0 -> rc=%Vrc i=%d Expected VINF_SUCCESS!\n", rc, i);
     153                                RTPrintf("tstInt: SUPCallVMMR0Fast -> rc=%Vrc i=%d Expected VINF_SUCCESS!\n", rc, i);
    153154                                rcRet++;
    154155                                break;
     
    158159                        uint64_t NanoSecs = RTTimeNanoTS() - StartTS;
    159160
    160                         RTPrintf("tstInt: SUPCallVMMR0    - %d iterations in %llu ns / %llu ticks. %llu ns / %#llu ticks per iteration. Min %llu ticks.\n",
     161                        RTPrintf("tstInt: SUPCallVMMR0Fast - %d iterations in %llu ns / %llu ticks. %llu ns / %#llu ticks per iteration. Min %llu ticks.\n",
    161162                                 i, NanoSecs, Ticks, NanoSecs / i, Ticks / i, MinTicks);
    162163
     
    172173                        {
    173174                            uint64_t OneStartTick = ASMReadTSC();
    174                             rc = SUPCallVMMR0Fast(pVMR0, VMMR0_DO_NOP);
     175                            rc = SUPCallVMMR0(pVMR0, VMMR0_DO_NOP, NULL);
    175176                            uint64_t Ticks = ASMReadTSC() - OneStartTick;
    176177                            if (Ticks < MinTicks)
     
    179180                            if (RT_UNLIKELY(rc != VINF_SUCCESS))
    180181                            {
    181                                 RTPrintf("tstInt: SUPCallVMMR0 -> rc=%Vrc i=%d Expected VINF_SUCCESS!\n", rc, i);
     182                                RTPrintf("tstInt: SUPCallVMMR0/idt -> rc=%Vrc i=%d Expected VINF_SUCCESS!\n", rc, i);
    182183                                rcRet++;
    183184                                break;
     
    187188                        NanoSecs = RTTimeNanoTS() - StartTS;
    188189
    189                         RTPrintf("tstInt: SUPCallVMMR0Fast - %d iterations in %llu ns / %llu ticks. %llu ns / %#llu ticks per iteration. Min %llu ticks.\n",
     190                        RTPrintf("tstInt: SUPCallVMMR0/idt - %d iterations in %llu ns / %llu ticks. %llu ns / %#llu ticks per iteration. Min %llu ticks.\n",
    190191                                 i, NanoSecs, Ticks, NanoSecs / i, Ticks / i, MinTicks);
    191192#endif /* VBOX_WITH_IDT_PATCHING */
     
    201202                        {
    202203                            uint64_t OneStartTick = ASMReadTSC();
    203                             rc = SUPCallVMMR0Ex(pVMR0, VMMR0_DO_NOP, 0, NULL);
     204                            rc = SUPCallVMMR0Ex(pVMR0, VMMR0_DO_SLOW_NOP, 0, NULL);
    204205                            uint64_t Ticks = ASMReadTSC() - OneStartTick;
    205206                            if (Ticks < MinTicks)
     
    208209                            if (RT_UNLIKELY(rc != VINF_SUCCESS))
    209210                            {
    210                                 RTPrintf("tstInt: SUPCallVMMR0 -> rc=%Vrc i=%d Expected VINF_SUCCESS!\n", rc, i);
     211                                RTPrintf("tstInt: SUPCallVMMR0Ex -> rc=%Vrc i=%d Expected VINF_SUCCESS!\n", rc, i);
    211212                                rcRet++;
    212213                                break;
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r10720 r10724  
    287287     * Deal with the two high-speed IOCtl that takes it's arguments from
    288288     * the session and iCmd, and only returns a VBox status code.
     289     *
     290     * Note: The previous method of returning the rc prior to IDC version
     291     *       7.4 has been abandond, we're no longer compatible with that
     292     *       interface.
    289293     */
    290294    ULONG ulCmd = pStack->Parameters.DeviceIoControl.IoControlCode;
     
    293297        ||  ulCmd == SUP_IOCTL_FAST_DO_NOP)
    294298    {
    295         KIRQL oldIrql;
    296         int   rc;
    297 
    298         /* We're here with METHOD_NEITHER, which means no parameter validation has been performed. Do not use input
    299          * or write to output parameters!
    300          */
    301 
    302299        /* Raise the IRQL to DISPATCH_LEVEl to prevent Windows from rescheduling us to another CPU/core. */
    303300        Assert(KeGetCurrentIrql() <= DISPATCH_LEVEL);
     301        KIRQL oldIrql;
    304302        KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);
    305         rc = supdrvIOCtlFast(ulCmd, pDevExt, pSession);
     303        int rc = supdrvIOCtlFast(ulCmd, pDevExt, pSession);
    306304        KeLowerIrql(oldIrql);
    307305
    308306        /* Complete the I/O request. */
    309         NTSTATUS rcNt = pIrp->IoStatus.Status = STATUS_SUCCESS;
     307        NTSTATUS rcNt = pIrp->IoStatus.Status = RT_SUCCESS(rc) ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER;
    310308        IoCompleteRequest(pIrp, IO_NO_INCREMENT);
    311309        return rcNt;
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r10721 r10724  
    568568 * The Ring 0 entry point, called by the fast-ioctl path.
    569569 *
    570  * @returns VBox status code.
    571570 * @param   pVM             The VM to operate on.
     571 *                          The return code is stored in pVM->vmm.s.iLastGCRc.
    572572 * @param   enmOperation    Which operation to execute.
    573573 * @remarks Assume called with interrupts _enabled_.
    574574 */
    575 VMMR0DECL(int) VMMR0EntryFast(PVM pVM, VMMR0OPERATION enmOperation)
     575VMMR0DECL(void) VMMR0EntryFast(PVM pVM, VMMR0OPERATION enmOperation)
    576576{
    577577    switch (enmOperation)
     
    601601                vmmR0RecordRC(pVM, rc);
    602602#endif
    603                 return rc;
    604603            }
    605 
    606             Assert(!pVM->vmm.s.fSwitcherDisabled);
    607             pVM->vmm.s.iLastGCRc = VERR_NOT_SUPPORTED;
    608             break;
    609        }
     604            else
     605            {
     606                Assert(!pVM->vmm.s.fSwitcherDisabled);
     607                pVM->vmm.s.iLastGCRc = VERR_NOT_SUPPORTED;
     608            }
     609            break;
     610        }
    610611
    611612        /*
     
    639640#endif
    640641            /* No special action required for external interrupts, just return. */
    641             return rc;
     642            break;
    642643        }
    643644
     
    647648        case VMMR0_DO_NOP:
    648649            pVM->vmm.s.iLastGCRc = VINF_SUCCESS;
    649             return VINF_SUCCESS;
     650            break;
    650651
    651652        /*
     
    657658            break;
    658659    }
    659     /* Error case, but the error was written to pVM->vmm.s.iLastGCRc */
    660     return VINF_SUCCESS;
    661660}
    662661
     
    910909         */
    911910        case VMMR0_DO_NOP:
     911        case VMMR0_DO_SLOW_NOP:
    912912            return VINF_SUCCESS;
    913913
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