Changeset 71198 in vbox for trunk/src/VBox/HostDrivers/Support
- Timestamp:
- Mar 5, 2018 10:59:17 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121103
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.cpp
r71136 r71198 1437 1437 * 1438 1438 * @returns VBox status code that should be passed down to ring-3 unchanged. 1439 * @param u IOCtl Function number.1439 * @param uOperation SUP_VMMR0_DO_XXX (not the I/O control number!). 1440 1440 * @param idCpu VMCPU id. 1441 1441 * @param pDevExt Device extention. 1442 1442 * @param pSession Session data. 1443 1443 */ 1444 int VBOXCALL supdrvIOCtlFast(uintptr_t u IOCtl, VMCPUID idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)1444 int VBOXCALL supdrvIOCtlFast(uintptr_t uOperation, VMCPUID idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession) 1445 1445 { 1446 1446 /* … … 1458 1458 { 1459 1459 /* 1460 * Dothe call.1460 * Make the call. 1461 1461 */ 1462 switch (uIOCtl) 1463 { 1464 case SUP_IOCTL_FAST_DO_RAW_RUN: 1465 pDevExt->pfnVMMR0EntryFast(pGVM, pVM, idCpu, SUP_VMMR0_DO_RAW_RUN); 1466 break; 1467 case SUP_IOCTL_FAST_DO_HM_RUN: 1468 pDevExt->pfnVMMR0EntryFast(pGVM, pVM, idCpu, SUP_VMMR0_DO_HM_RUN); 1469 break; 1470 case SUP_IOCTL_FAST_DO_NOP: 1471 pDevExt->pfnVMMR0EntryFast(pGVM, pVM, idCpu, SUP_VMMR0_DO_NOP); 1472 break; 1473 default: 1474 return VERR_INTERNAL_ERROR; 1475 } 1462 pDevExt->pfnVMMR0EntryFast(pGVM, pVM, idCpu, uOperation); 1476 1463 return VINF_SUCCESS; 1477 1464 } -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r71136 r71198 113 113 #endif 114 114 115 /** @name Fast path I/O control codes. 116 * @note These must run parallel to SUP_VMMR0_DO_XXX 117 * @note Implementations ASSUMES up to 32 I/O controls codes in the fast range. 118 * @{ */ 115 119 /** Fast path IOCtl: VMMR0_DO_RAW_RUN */ 116 120 #define SUP_IOCTL_FAST_DO_RAW_RUN SUP_CTL_CODE_FAST(64) … … 119 123 /** Just a NOP call for profiling the latency of a fast ioctl call to VMMR0. */ 120 124 #define SUP_IOCTL_FAST_DO_NOP SUP_CTL_CODE_FAST(66) 125 /** Fast path IOCtl: VMMR0_DO_NEM_RUN */ 126 #define SUP_IOCTL_FAST_DO_NEM_RUN SUP_CTL_CODE_FAST(67) 127 /** First fast path IOCtl number. */ 128 #define SUP_IOCTL_FAST_DO_FIRST SUP_IOCTL_FAST_DO_RAW_RUN 129 /** @} */ 130 121 131 122 132 #ifdef RT_OS_DARWIN … … 210 220 * 211 221 * @todo Pending work on next major version change: 212 * - nothing.222 * - Move SUP_IOCTL_FAST_DO_NOP and SUP_VMMR0_DO_NEM_RUN after NEM. 213 223 * 214 224 * @remarks 0x002a0000 is used by 5.1. The next version number must be 0x002b0000. 215 225 */ 216 #define SUPDRV_IOC_VERSION 0x0029000 3226 #define SUPDRV_IOC_VERSION 0x00290004 217 227 218 228 /** SUP_IOCTL_COOKIE. */ -
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r71136 r71198 1012 1012 /* SUPDrv.c */ 1013 1013 int VBOXCALL supdrvIOCtl(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr, size_t cbReq); 1014 int VBOXCALL supdrvIOCtlFast(uintptr_t u IOCtl, VMCPUID idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession);1014 int VBOXCALL supdrvIOCtlFast(uintptr_t uOperation, VMCPUID idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession); 1015 1015 int VBOXCALL supdrvIDC(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQHDR pReqHdr); 1016 1016 int VBOXCALL supdrvInitDevExt(PSUPDRVDEVEXT pDevExt, size_t cbSession); -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r71136 r71198 277 277 CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION; 278 278 const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00290000 279 ? 0x0029000 3279 ? 0x00290004 280 280 : SUPDRV_IOC_VERSION & 0xffff0000; 281 281 CookieReq.u.In.u32MinVersion = uMinVersion; … … 613 613 { 614 614 NOREF(pVMR0); 615 if (RT_LIKELY(uOperation == SUP_VMMR0_DO_RAW_RUN)) 616 return suplibOsIOCtlFast(&g_supLibData, SUP_IOCTL_FAST_DO_RAW_RUN, idCpu); 617 if (RT_LIKELY(uOperation == SUP_VMMR0_DO_HM_RUN)) 618 return suplibOsIOCtlFast(&g_supLibData, SUP_IOCTL_FAST_DO_HM_RUN, idCpu); 619 if (RT_LIKELY(uOperation == SUP_VMMR0_DO_NOP)) 620 return suplibOsIOCtlFast(&g_supLibData, SUP_IOCTL_FAST_DO_NOP, idCpu); 621 622 AssertMsgFailed(("%#x\n", uOperation)); 623 return VERR_INTERNAL_ERROR; 615 static const uintptr_t s_auFunctions[4] = 616 { 617 SUP_IOCTL_FAST_DO_RAW_RUN, 618 SUP_IOCTL_FAST_DO_HM_RUN, 619 SUP_IOCTL_FAST_DO_NOP, 620 SUP_IOCTL_FAST_DO_NEM_RUN 621 }; 622 AssertCompile(SUP_VMMR0_DO_RAW_RUN == 0); 623 AssertCompile(SUP_VMMR0_DO_HM_RUN == 1); 624 AssertCompile(SUP_VMMR0_DO_NOP == 2); 625 AssertCompile(SUP_VMMR0_DO_NEM_RUN == 3); 626 AssertMsgReturn(uOperation < RT_ELEMENTS(s_auFunctions), ("%#x\n", uOperation), VERR_INTERNAL_ERROR); 627 return suplibOsIOCtlFast(&g_supLibData, s_auFunctions[uOperation], idCpu); 624 628 } 625 629 -
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
r69500 r71198 633 633 */ 634 634 int rc; 635 if ( ( iCmd == SUP_IOCTL_FAST_DO_RAW_RUN 636 || iCmd == SUP_IOCTL_FAST_DO_HM_RUN 637 || iCmd == SUP_IOCTL_FAST_DO_NOP) 635 AssertCompile((SUP_IOCTL_FAST_DO_FIRST & 0xff) == (SUP_IOCTL_FLAG | 64)); 636 if ( (uintptr_t)(iCmd - SUP_IOCTL_FAST_DO_FIRST) < (uintptr_t)32 638 637 && fUnrestricted) 639 rc = supdrvIOCtlFast(iCmd , *(uint32_t *)pData, &g_DevExt, pSession);638 rc = supdrvIOCtlFast(iCmd - SUP_IOCTL_FAST_DO_FIRST, *(uint32_t *)pData, &g_DevExt, pSession); 640 639 else 641 640 rc = VBoxDrvDarwinIOCtlSlow(pSession, iCmd, pData, pProcess); -
trunk/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
r59217 r71198 315 315 * Deal with the fast ioctl path first. 316 316 */ 317 if ( ( ulCmd == SUP_IOCTL_FAST_DO_RAW_RUN 318 || ulCmd == SUP_IOCTL_FAST_DO_HM_RUN 319 || ulCmd == SUP_IOCTL_FAST_DO_NOP) 320 && pSession->fUnrestricted == true) 321 return supdrvIOCtlFast(ulCmd, *(uint32_t *)pvData, &g_VBoxDrvFreeBSDDevExt, pSession); 317 AssertCompile((SUP_IOCTL_FAST_DO_FIRST & 0xff) == (SUP_IOCTL_FLAG | 64)); 318 if ( (uintptr_t)(iCmd - SUP_IOCTL_FAST_DO_FIRST) < (uintptr_t)32 319 && pSession->fUnrestricted) 320 return supdrvIOCtlFast(ulCmd - SUP_IOCTL_FAST_DO_FIRST, *(uint32_t *)pvData, &g_VBoxDrvFreeBSDDevExt, pSession); 322 321 323 322 return VBoxDrvFreeBSDIOCtlSlow(pSession, ulCmd, pvData, pTd); -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r69500 r71198 582 582 * the session and iCmd, and only returns a VBox status code. 583 583 */ 584 AssertCompile(_IOC_NRSHIFT == 0 && _IOC_NRBITS == 8); 584 585 #ifdef HAVE_UNLOCKED_IOCTL 585 if (RT_LIKELY( ( uCmd == SUP_IOCTL_FAST_DO_RAW_RUN 586 || uCmd == SUP_IOCTL_FAST_DO_HM_RUN 587 || uCmd == SUP_IOCTL_FAST_DO_NOP) 586 if (RT_LIKELY( (unsigned int)(uCmd - SUP_IOCTL_FAST_DO_FIRST) < (unsigned int)32) 588 587 && pSession->fUnrestricted == true)) 589 rc = supdrvIOCtlFast(uCmd , ulArg, &g_DevExt, pSession);588 rc = supdrvIOCtlFast(uCmd - SUP_IOCTL_FAST_DO_FIRST, ulArg, &g_DevExt, pSession); 590 589 else 591 590 rc = VBoxDrvLinuxIOCtlSlow(pFilp, uCmd, ulArg, pSession); 592 591 #else /* !HAVE_UNLOCKED_IOCTL */ 593 592 unlock_kernel(); 594 if (RT_LIKELY( ( uCmd == SUP_IOCTL_FAST_DO_RAW_RUN 595 || uCmd == SUP_IOCTL_FAST_DO_HM_RUN 596 || uCmd == SUP_IOCTL_FAST_DO_NOP) 593 if (RT_LIKELY( (unsigned int)(uCmd - SUP_IOCTL_FAST_DO_FIRST) < (unsigned int)32) 597 594 && pSession->fUnrestricted == true)) 598 rc = supdrvIOCtlFast(uCmd , ulArg, &g_DevExt, pSession);595 rc = supdrvIOCtlFast(uCmd - SUP_IOCTL_FAST_DO_FIRST, ulArg, &g_DevExt, pSession); 599 596 else 600 597 rc = VBoxDrvLinuxIOCtlSlow(pFilp, uCmd, ulArg, pSession); -
trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
r62490 r71198 259 259 * Dispatch the fast IOCtl. 260 260 */ 261 supdrvIOCtlFast(iFunction, 0, &g_DevExt, pSession); 261 int rc; 262 if ((unsigned)(iFunction - SUP_IOCTL_FAST_DO_FIRST) < (unsigned)32) 263 rc = supdrvIOCtlFast(iFunction, 0, &g_DevExt, pSession); 264 else 265 rc = VERR_INVALID_FUNCTION; 262 266 supdrvSessionRelease(pSession); 263 return 0;267 return rc; 264 268 } 265 269 -
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r69500 r71198 664 664 * 665 665 * @param Dev Device number 666 * @param CmdOperation identifier666 * @param iCmd Operation identifier 667 667 * @param pArgs Arguments from user to driver 668 668 * @param Mode Information bitfield (read/write, address space etc.) … … 672 672 * @return corresponding solaris error code. 673 673 */ 674 static int VBoxDrvSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArgs, int Mode, cred_t *pCred, int *pVal)674 static int VBoxDrvSolarisIOCtl(dev_t Dev, int iCmd, intptr_t pArgs, int Mode, cred_t *pCred, int *pVal) 675 675 { 676 676 #ifndef USE_SESSION_HASH … … 708 708 { 709 709 LogRel(("VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x Dev=%#x\n", 710 (int)Process, Cmd, (int)Dev));710 (int)Process, iCmd, (int)Dev)); 711 711 return EINVAL; 712 712 } … … 717 717 * the session and iCmd, and only returns a VBox status code. 718 718 */ 719 if ( ( Cmd == SUP_IOCTL_FAST_DO_RAW_RUN 720 || Cmd == SUP_IOCTL_FAST_DO_HM_RUN 721 || Cmd == SUP_IOCTL_FAST_DO_NOP) 719 AssertCompile((SUP_IOCTL_FAST_DO_FIRST & 0xff) == (SUP_IOCTL_FLAG | 64)); 720 if ( (unsigned)(iCmd - SUP_IOCTL_FAST_DO_FIRST) < (unsigned)32 722 721 && pSession->fUnrestricted) 723 722 { 724 *pVal = supdrvIOCtlFast( Cmd, pArgs, &g_DevExt, pSession);723 *pVal = supdrvIOCtlFast(iCmd - SUP_IOCTL_FAST_DO_FIRST, pArgs, &g_DevExt, pSession); 725 724 return 0; 726 725 } 727 726 728 return VBoxDrvSolarisIOCtlSlow(pSession, Cmd, Mode, pArgs);727 return VBoxDrvSolarisIOCtlSlow(pSession, iCmd, Mode, pArgs); 729 728 } 730 729 -
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r71136 r71198 1129 1129 * the session and iCmd, and does not return anything. 1130 1130 */ 1131 if ( uCmd == SUP_IOCTL_FAST_DO_RAW_RUN 1132 || uCmd == SUP_IOCTL_FAST_DO_HM_RUN 1133 || uCmd == SUP_IOCTL_FAST_DO_NOP) 1134 { 1135 int rc = supdrvIOCtlFast(uCmd, (unsigned)(uintptr_t)pvOutput/* VMCPU id */, pDevExt, pSession); 1131 if ( (uCmd & 3) == METHOD_NEITHER 1132 && (uint32_t)((uCmd - SUP_IOCTL_FAST_DO_FIRST) >> 2) < (uint32_t)32) 1133 { 1134 int rc = supdrvIOCtlFast((uCmd - SUP_IOCTL_FAST_DO_FIRST) >> 2, 1135 (unsigned)(uintptr_t)pvOutput/* VMCPU id */, 1136 pDevExt, pSession); 1136 1137 pIoStatus->Status = RT_SUCCESS(rc) ? STATUS_SUCCESS : STATUS_INVALID_PARAMETER; 1137 1138 pIoStatus->Information = 0; /* Could be used to pass rc if we liked. */ … … 1318 1319 #endif 1319 1320 1320 ULONG ulCmd = pStack->Parameters.DeviceIoControl.IoControlCode; 1321 if ( ulCmd == SUP_IOCTL_FAST_DO_RAW_RUN 1322 || ulCmd == SUP_IOCTL_FAST_DO_HM_RUN 1323 || ulCmd == SUP_IOCTL_FAST_DO_NOP) 1324 { 1325 int rc = supdrvIOCtlFast(ulCmd, (unsigned)(uintptr_t)pIrp->UserBuffer /* VMCPU id */, pDevExt, pSession); 1321 ULONG uCmd = pStack->Parameters.DeviceIoControl.IoControlCode; 1322 if ( (uCmd & 3) == METHOD_NEITHER 1323 && (uint32_t)((uCmd - SUP_IOCTL_FAST_DO_FIRST) >> 2) < (uint32_t)32) 1324 { 1325 int rc = supdrvIOCtlFast((uCmd - SUP_IOCTL_FAST_DO_FIRST) >> 2, 1326 (unsigned)(uintptr_t)pIrp->UserBuffer /* VMCPU id */, 1327 pDevExt, pSession); 1326 1328 1327 1329 /* Complete the I/O request. */ -
trunk/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp
r69500 r71198 673 673 Assert(cbReq == RT_MAX(pHdr->cbIn, pHdr->cbOut)); 674 674 # ifdef USE_NT_DEVICE_IO_CONTROL_FILE 675 IO_STATUS_BLOCK Ios; 676 Ios.Status = -1; 677 Ios.Information = 0; 675 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 678 676 NTSTATUS rcNt = NtDeviceIoControlFile((HANDLE)pThis->hDevice, NULL /*hEvent*/, NULL /*pfnApc*/, NULL /*pvApcCtx*/, &Ios, 679 677 (ULONG)uFunction, … … 703 701 */ 704 702 # ifdef USE_NT_DEVICE_IO_CONTROL_FILE 705 IO_STATUS_BLOCK Ios; 706 Ios.Status = -1; 707 Ios.Information = 0; 703 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 708 704 NTSTATUS rcNt = NtDeviceIoControlFile((HANDLE)pThis->hDevice, NULL /*hEvent*/, NULL /*pfnApc*/, NULL /*pvApcCtx*/, &Ios, 709 705 (ULONG)uFunction,
Note:
See TracChangeset
for help on using the changeset viewer.