- Timestamp:
- Mar 3, 2015 8:28:01 PM (10 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxDev-haiku.c
r43409 r54608 5 5 6 6 /* 7 * Copyright (C) 2012 Oracle Corporation7 * Copyright (C) 2012-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 113 113 * Create a new session. 114 114 */ 115 rc = V BoxGuestCreateUserSession(&g_DevExt, &pSession);115 rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession); 116 116 if (RT_SUCCESS(rc)) 117 117 { … … 172 172 if (VALID_PTR(pSession)) 173 173 { 174 V BoxGuestCloseSession(&g_DevExt, pSession);174 VbgdCommonCloseSession(&g_DevExt, pSession); 175 175 ASMAtomicDecU32(&cUsers); 176 176 } … … 255 255 */ 256 256 size_t cbDataReturned; 257 rc = V BoxGuestCommonIOCtl(op, &g_DevExt, pSession, pvBuf, len, &cbDataReturned);257 rc = VbgdCommonIoCtl(op, &g_DevExt, pSession, pvBuf, len, &cbDataReturned); 258 258 if (RT_SUCCESS(rc)) 259 259 { … … 276 276 else 277 277 { 278 Log((DRIVER_NAME ":VBoxGuestHaikuIOCtl: V BoxGuestCommonIOCtl failed. rc=%d\n", rc));278 Log((DRIVER_NAME ":VBoxGuestHaikuIOCtl: VbgdCommonIoCtl failed. rc=%d\n", rc)); 279 279 rc = EFAULT; 280 280 } -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-darwin.cpp
r52618 r54608 5 5 6 6 /* 7 * Copyright (C) 2006-201 4Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 560 560 */ 561 561 size_t cbReqRet = 0; 562 int rc = V BoxGuestCommonIOCtl(iCmd, &g_DevExt, pSession, pvReqData, cbReq, &cbReqRet);562 int rc = VbgdCommonIoCtl(iCmd, &g_DevExt, pSession, pvReqData, cbReq, &cbReqRet); 563 563 if (RT_SUCCESS(rc)) 564 564 { … … 617 617 618 618 619 void V BoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)619 void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt) 620 620 { 621 621 NOREF(pDevExt); … … 725 725 NOREF(pOwner); NOREF(pSrc); NOREF(cInts); 726 726 727 V BoxGuestWaitDoWakeUps(&g_DevExt);727 VbgdCommonWaitDoWakeUps(&g_DevExt); 728 728 } 729 729 … … 737 737 return false; 738 738 739 bool fTaken = V BoxGuestCommonISR(&g_DevExt);739 bool fTaken = VbgdCommonISR(&g_DevExt); 740 740 if (!fTaken) /** @todo r=bird: This looks bogus as we might actually be sharing interrupts with someone. */ 741 PDEBUG("V BoxGuestCommonISR error\n");741 PDEBUG("VbgdCommonISR error\n"); 742 742 743 743 return fTaken; … … 848 848 } 849 849 850 int rc = V BoxGuestInitDevExt(&g_DevExt,851 IOPortBase,852 pvMMIOBase,853 cbMMIO,850 int rc = VbgdCommonInitDevExt(&g_DevExt, 851 IOPortBase, 852 pvMMIOBase, 853 cbMMIO, 854 854 #if ARCH_BITS == 64 855 VBOXOSTYPE_MacOS_x64,855 VBOXOSTYPE_MacOS_x64, 856 856 #else 857 VBOXOSTYPE_MacOS,857 VBOXOSTYPE_MacOS, 858 858 #endif 859 0);859 0); 860 860 if (RT_SUCCESS(rc)) 861 861 { … … 877 877 LogRel(("VBoxGuest: Failed to initialize character device (rc=%d).\n", rc)); 878 878 879 V BoxGuestDeleteDevExt(&g_DevExt);879 VbgdCommonDeleteDevExt(&g_DevExt); 880 880 } 881 881 else … … 923 923 924 924 VbgdDarwinCharDevRemove(); 925 V BoxGuestDeleteDevExt(&g_DevExt);925 VbgdCommonDeleteDevExt(&g_DevExt); 926 926 927 927 if (m_pMap) … … 1020 1020 * Create a new session. 1021 1021 */ 1022 int rc = V BoxGuestCreateUserSession(&g_DevExt, &m_pSession);1022 int rc = VbgdCommonCreateUserSession(&g_DevExt, &m_pSession); 1023 1023 if (RT_SUCCESS(rc)) 1024 1024 { … … 1058 1058 1059 1059 LogFlow(("org_virtualbox_VBoxGuestClient::start: already got a session for this process (%p)\n", pCur)); 1060 V BoxGuestCloseSession(&g_DevExt, m_pSession);1060 VbgdCommonCloseSession(&g_DevExt, m_pSession); 1061 1061 } 1062 1062 … … 1134 1134 * Close the session. 1135 1135 */ 1136 V BoxGuestCloseSession(&g_DevExt, pSession);1136 VbgdCommonCloseSession(&g_DevExt, pSession); 1137 1137 } 1138 1138 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c
r44529 r54608 5 5 6 6 /* 7 * Copyright (C) 2007-201 1Oracle Corporation7 * Copyright (C) 2007-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 220 220 * Create a new session. 221 221 */ 222 rc = V BoxGuestCreateUserSession(&g_DevExt, &pSession);222 rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession); 223 223 if (RT_SUCCESS(rc)) 224 224 { … … 230 230 } 231 231 232 V BoxGuestCloseSession(&g_DevExt, pSession);232 VbgdCommonCloseSession(&g_DevExt, pSession); 233 233 } 234 234 … … 251 251 if (VALID_PTR(pSession)) 252 252 { 253 V BoxGuestCloseSession(&g_DevExt, pSession);253 VbgdCommonCloseSession(&g_DevExt, pSession); 254 254 if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, NULL, pSession)) 255 255 Log(("VBoxGuestFreeBSDClose: si_drv1=%p expected %p!\n", pDev->si_drv1, pSession)); … … 332 332 */ 333 333 size_t cbDataReturned; 334 rc = V BoxGuestCommonIOCtl(ulCmd, &g_DevExt, pSession, pvBuf, ReqWrap->cbData, &cbDataReturned);334 rc = VbgdCommonIoCtl(ulCmd, &g_DevExt, pSession, pvBuf, ReqWrap->cbData, &cbDataReturned); 335 335 if (RT_SUCCESS(rc)) 336 336 { … … 353 353 else 354 354 { 355 Log((DEVICE_NAME ":VBoxGuestFreeBSDIOCtl: V BoxGuestCommonIOCtl failed. rc=%d\n", rc));355 Log((DEVICE_NAME ":VBoxGuestFreeBSDIOCtl: VbgdCommonIoCtl failed. rc=%d\n", rc)); 356 356 rc = EFAULT; 357 357 } … … 420 420 bus_release_resource(pDevice, SYS_RES_IOPORT, pState->iIOPortResId, pState->pIOPortRes); 421 421 422 V BoxGuestDeleteDevExt(&g_DevExt);422 VbgdCommonDeleteDevExt(&g_DevExt); 423 423 424 424 RTR0Term(); … … 437 437 LogFlow((DEVICE_NAME ":VBoxGuestFreeBSDISR pvState=%p\n", pvState)); 438 438 439 bool fOurIRQ = V BoxGuestCommonISR(&g_DevExt);439 bool fOurIRQ = VbgdCommonISR(&g_DevExt); 440 440 441 441 return fOurIRQ ? 0 : 1; 442 442 } 443 443 444 void V BoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)444 void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt) 445 445 { 446 446 LogFlow((DEVICE_NAME "::NativeISRMousePollEvent:\n")); … … 546 546 * Call the common device extension initializer. 547 547 */ 548 rc = V BoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase,549 pState->pMMIOBase, pState->VMMDevMemSize,548 rc = VbgdCommonInitDevExt(&g_DevExt, pState->uIOPortBase, 549 pState->pMMIOBase, pState->VMMDevMemSize, 550 550 #if ARCH_BITS == 64 551 VBOXOSTYPE_FreeBSD_x64,551 VBOXOSTYPE_FreeBSD_x64, 552 552 #else 553 VBOXOSTYPE_FreeBSD,553 VBOXOSTYPE_FreeBSD, 554 554 #endif 555 VMMDEV_EVENT_MOUSE_POSITION_CHANGED);555 VMMDEV_EVENT_MOUSE_POSITION_CHANGED); 556 556 if (RT_SUCCESS(rc)) 557 557 { … … 578 578 } 579 579 else 580 printf((DEVICE_NAME ":V BoxGuestInitDevExt failed.\n"));581 V BoxGuestDeleteDevExt(&g_DevExt);580 printf((DEVICE_NAME ":VbgdCommonInitDevExt failed.\n")); 581 VbgdCommonDeleteDevExt(&g_DevExt); 582 582 } 583 583 else -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku-stubs.c
r52618 r54608 5 5 6 6 /* 7 * Copyright (C) 2012-201 4Oracle Corporation7 * Copyright (C) 2012-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 339 339 return g_VBoxGuest->_RTErrConvertToErrno(iErr); 340 340 } 341 int V BoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, void *pvData, size_t cbData, size_t *pcbDataReturned)342 { 343 return g_VBoxGuest->_V BoxGuestCommonIOCtl(iFunction, pDevExt, pSession, pvData, cbData, pcbDataReturned);344 } 345 int V BoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)346 { 347 return g_VBoxGuest->_V BoxGuestCreateUserSession(pDevExt, ppSession);348 } 349 void V BoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)350 { 351 g_VBoxGuest->_V BoxGuestCloseSession(pDevExt, pSession);341 int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, void *pvData, size_t cbData, size_t *pcbDataReturned) 342 { 343 return g_VBoxGuest->_VbgdCommonIoCtl(iFunction, pDevExt, pSession, pvData, cbData, pcbDataReturned); 344 } 345 int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession) 346 { 347 return g_VBoxGuest->_VbgdCommonCreateUserSession(pDevExt, ppSession); 348 } 349 void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) 350 { 351 g_VBoxGuest->_VbgdCommonCloseSession(pDevExt, pSession); 352 352 } 353 353 void* VBoxGuestIDCOpen(uint32_t *pu32Version) -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c
r52618 r54608 5 5 6 6 /* 7 * Copyright (C) 2012-201 4Oracle Corporation7 * Copyright (C) 2012-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 179 179 RTLogRelDefaultInstance, 180 180 RTErrConvertToErrno, 181 V BoxGuestCommonIOCtl,182 V BoxGuestCreateUserSession,183 V BoxGuestCloseSession,181 VbgdCommonIoCtl, 182 VbgdCommonCreateUserSession, 183 VbgdCommonCloseSession, 184 184 VBoxGuestIDCOpen, 185 185 VBoxGuestIDCClose, … … 278 278 delete_area(pState->iVMMDevMemAreaId); 279 279 280 V BoxGuestDeleteDevExt(&g_DevExt);280 VbgdCommonDeleteDevExt(&g_DevExt); 281 281 282 282 #ifdef DO_LOG … … 304 304 LogFlow((MODULE_NAME ":VBoxGuestHaikuISR pvState=%p\n", pvState)); 305 305 306 bool fOurIRQ = V BoxGuestCommonISR(&g_DevExt);306 bool fOurIRQ = VbgdCommonISR(&g_DevExt); 307 307 if (fOurIRQ) 308 308 return B_HANDLED_INTERRUPT; … … 311 311 312 312 313 void V BoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)313 void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt) 314 314 { 315 315 LogFlow((MODULE_NAME "::NativeISRMousePollEvent:\n")); … … 446 446 * Call the common device extension initializer. 447 447 */ 448 rc = V BoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, pState->VMMDevMemSize,448 rc = VbgdCommonInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, pState->VMMDevMemSize, 449 449 #if ARCH_BITS == 64 450 VBOXOSTYPE_Haiku_x64,450 VBOXOSTYPE_Haiku_x64, 451 451 #else 452 VBOXOSTYPE_Haiku,452 VBOXOSTYPE_Haiku, 453 453 #endif 454 VMMDEV_EVENT_MOUSE_POSITION_CHANGED);454 VMMDEV_EVENT_MOUSE_POSITION_CHANGED); 455 455 if (RT_SUCCESS(rc)) 456 456 { … … 466 466 } 467 467 468 LogRel((MODULE_NAME ":V BoxGuestInitDevExt failed.\n"));469 V BoxGuestDeleteDevExt(&g_DevExt);468 LogRel((MODULE_NAME ":VbgdCommonInitDevExt failed.\n")); 469 VbgdCommonDeleteDevExt(&g_DevExt); 470 470 } 471 471 else -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.h
r52618 r54608 5 5 6 6 /* 7 * Copyright (C) 2012-201 4Oracle Corporation7 * Copyright (C) 2012-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 182 182 PRTLOGGER(*_RTLogRelDefaultInstance)(void); 183 183 int (*_RTErrConvertToErrno)(int iErr); 184 int (*_V BoxGuestCommonIOCtl)(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,184 int (*_VbgdCommonIoCtl)(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 185 185 void *pvData, size_t cbData, size_t *pcbDataReturned); 186 int (*_V BoxGuestCreateUserSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);187 void (*_V BoxGuestCloseSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);186 int (*_VbgdCommonCreateUserSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession); 187 void (*_VbgdCommonCloseSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession); 188 188 void* (*_VBoxGuestIDCOpen)(uint32_t *pu32Version); 189 189 int (*_VBoxGuestIDCClose)(void *pvSession); -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
r54606 r54608 8 8 9 9 /* 10 * Copyright (C) 2006-201 3Oracle Corporation10 * Copyright (C) 2006-2015 Oracle Corporation 11 11 * 12 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 341 341 #endif 342 342 { 343 bool fTaken = V BoxGuestCommonISR(&g_DevExt);343 bool fTaken = VbgdCommonISR(&g_DevExt); 344 344 return IRQ_RETVAL(fTaken); 345 345 } … … 386 386 static int vboxguestLinuxSetMouseStatus(uint32_t fStatus) 387 387 { 388 return V BoxGuestCommonIOCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &g_DevExt,389 390 388 return VbgdCommonIoCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &g_DevExt, 389 g_pKernelSession, &fStatus, sizeof(fStatus), 390 NULL); 391 391 } 392 392 … … 595 595 VBOXOSTYPE enmOsType = VBOXOSTYPE_Linux; 596 596 #endif 597 rc = V BoxGuestInitDevExt(&g_DevExt,598 g_IOPortBase,599 g_pvMMIOBase,600 g_cbMMIO,601 enmOSType,602 VMMDEV_EVENT_MOUSE_POSITION_CHANGED);597 rc = VbgdCommonInitDevExt(&g_DevExt, 598 g_IOPortBase, 599 g_pvMMIOBase, 600 g_cbMMIO, 601 enmOSType, 602 VMMDEV_EVENT_MOUSE_POSITION_CHANGED); 603 603 if (RT_SUCCESS(rc)) 604 604 { … … 606 606 * Create the kernel session for this driver. 607 607 */ 608 rc = V BoxGuestCreateKernelSession(&g_DevExt,608 rc = VbgdCommonCreateKernelSession(&g_DevExt, 609 609 &g_pKernelSession); 610 610 if (RT_SUCCESS(rc)) … … 642 642 } 643 643 #endif 644 V BoxGuestCloseSession(&g_DevExt, g_pKernelSession);644 VbgdCommonCloseSession(&g_DevExt, g_pKernelSession); 645 645 } 646 V BoxGuestDeleteDevExt(&g_DevExt);646 VbgdCommonDeleteDevExt(&g_DevExt); 647 647 } 648 648 else 649 649 { 650 LogRel((DEVICE_NAME ": V BoxGuestInitDevExt failed with rc=%Rrc\n", rc));650 LogRel((DEVICE_NAME ": VbgdCommonInitDevExt failed with rc=%Rrc\n", rc)); 651 651 rc = RTErrConvertFromErrno(rc); 652 652 } … … 679 679 vboxguestLinuxTermInputDevice(); 680 680 #endif 681 V BoxGuestCloseSession(&g_DevExt, g_pKernelSession);682 V BoxGuestDeleteDevExt(&g_DevExt);681 VbgdCommonCloseSession(&g_DevExt, g_pKernelSession); 682 VbgdCommonDeleteDevExt(&g_DevExt); 683 683 vboxguestLinuxTermISR(); 684 684 pci_unregister_driver(&g_PciDriver); … … 705 705 * the file so we can access it in the other methods. 706 706 */ 707 rc = V BoxGuestCreateUserSession(&g_DevExt, &pSession);707 rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession); 708 708 if (RT_SUCCESS(rc)) 709 709 { … … 736 736 vboxguestFAsync(-1, pFilp, 0); 737 737 #endif 738 V BoxGuestCloseSession(&g_DevExt, (PVBOXGUESTSESSION)pFilp->private_data);738 VbgdCommonCloseSession(&g_DevExt, (PVBOXGUESTSESSION)pFilp->private_data); 739 739 pFilp->private_data = NULL; 740 740 return 0; … … 787 787 */ 788 788 size_t cbDataReturned; 789 rc = V BoxGuestCommonIOCtl(uCmd, &g_DevExt, pSession, pvBuf, cbData, &cbDataReturned);789 rc = VbgdCommonIoCtl(uCmd, &g_DevExt, pSession, pvBuf, cbData, &cbDataReturned); 790 790 791 791 /* … … 882 882 * @remarks This is probably not really used as X11 lets the driver do its own 883 883 * event reading. The poll condition is therefore also cleared when we 884 * see VMMDevReq_GetMouseStatus in V BoxGuestCommonIOCtl_VMMRequest.884 * see VMMDevReq_GetMouseStatus in VbgdCommonIoCtl_VMMRequest. 885 885 */ 886 886 static ssize_t vboxguestRead(struct file *pFile, char *pbBuf, size_t cbRead, loff_t *poff) … … 906 906 907 907 908 void V BoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)908 void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt) 909 909 { 910 910 #ifdef VBOXGUEST_WITH_INPUT_DRIVER … … 917 917 * subscribed to async notifications. 918 918 */ 919 Log3(("V BoxGuestNativeISRMousePollEvent: wake_up_all\n"));919 Log3(("VbgdNativeISRMousePollEvent: wake_up_all\n")); 920 920 wake_up_all(&g_PollEventQueue); 921 Log3(("V BoxGuestNativeISRMousePollEvent: kill_fasync\n"));921 Log3(("VbgdNativeISRMousePollEvent: kill_fasync\n")); 922 922 kill_fasync(&g_pFAsyncQueue, SIGIO, POLL_IN); 923 923 #ifdef VBOXGUEST_WITH_INPUT_DRIVER … … 938 938 } 939 939 #endif 940 Log3(("V BoxGuestNativeISRMousePollEvent: done\n"));940 Log3(("VbgdNativeISRMousePollEvent: done\n")); 941 941 } 942 942 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp
r54521 r54608 150 150 */ 151 151 if (g_MemMapMMIO != NIL_RTR0MEMOBJ) 152 rc = V BoxGuestInitDevExt(&g_DevExt, g_IOPortBase,153 RTR0MemObjAddress(g_MemMapMMIO),154 RTR0MemObjSize(g_MemMapMMIO),155 vboxGuestOS2DetectVersion(),156 0);152 rc = VbgdCommonInitDevExt(&g_DevExt, g_IOPortBase, 153 RTR0MemObjAddress(g_MemMapMMIO), 154 RTR0MemObjSize(g_MemMapMMIO), 155 vboxGuestOS2DetectVersion(), 156 0); 157 157 else 158 rc = VBoxGuestInitDevExt(&g_DevExt, g_IOPortBase, NULL, 0, 159 vboxGuestOS2DetectVersion(), 160 0); 158 rc = VbgdCommonInitDevExt(&g_DevExt, g_IOPortBase, NULL, 0, vboxGuestOS2DetectVersion(), 0); 161 159 if (RT_SUCCESS(rc)) 162 160 { … … 201 199 else 202 200 g_cchInitText = RTStrPrintf(&g_szInitText[0], g_cchInitTextMax, "VBoxGuest.sys: RTSpinlockCreate failed, rc=%Rrc\n", rc); 203 V BoxGuestDeleteDevExt(&g_DevExt);201 VbgdCommonDeleteDevExt(&g_DevExt); 204 202 } 205 203 else … … 361 359 * Create a new session. 362 360 */ 363 rc = V BoxGuestCreateUserSession(&g_DevExt, &pSession);361 rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession); 364 362 if (RT_SUCCESS(rc)) 365 363 { … … 432 430 * Close the session. 433 431 */ 434 V BoxGuestCloseSession(&g_DevExt, pSession);432 VbgdCommonCloseSession(&g_DevExt, pSession); 435 433 return 0; 436 434 } … … 465 463 * Dispatch the fast IOCtl. 466 464 */ 467 *prc = V BoxGuestCommonIOCtlFast(iFunction, &g_DevExt, pSession);465 *prc = VbgdCommonIoCtlFast(iFunction, &g_DevExt, pSession); 468 466 return 0; 469 467 } … … 497 495 { 498 496 default: 499 rc = V BoxGuestCommonIOCtl(iFunction, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);497 rc = VbgdCommonIoCtl(iFunction, &g_DevExt, pSession, pvData, cbData, pcbDataReturned); 500 498 break; 501 499 502 500 case VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT: 503 501 pSession->sfn = 0; 504 V BoxGuestCloseSession(&g_DevExt, pSession);502 VbgdCommonCloseSession(&g_DevExt, pSession); 505 503 rc = VINF_SUCCESS; 506 504 break; … … 518 516 { 519 517 PVBOXGUESTSESSION pSession; 520 int rc = V BoxGuestCreateKernelSession(&g_DevExt, &pSession);518 int rc = VbgdCommonCreateKernelSession(&g_DevExt, &pSession); 521 519 if (RT_SUCCESS(rc)) 522 520 { … … 600 598 */ 601 599 size_t cbDataReturned; 602 rc = V BoxGuestCommonIOCtl(iFunction, &g_DevExt, pSession, pvParm, *pcbParm, &cbDataReturned);600 rc = VbgdCommonIoCtl(iFunction, &g_DevExt, pSession, pvParm, *pcbParm, &cbDataReturned); 603 601 604 602 /* … … 639 637 Log(("VBoxGuestOS2ISR\n")); 640 638 641 return V BoxGuestCommonISR(&g_DevExt);642 } 643 644 645 void V BoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)639 return VbgdCommonISR(&g_DevExt); 640 } 641 642 643 void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt) 646 644 { 647 645 /* No polling on OS/2 */ -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c
r50753 r54608 5 5 6 6 /* 7 * Copyright (C) 2007-201 2Oracle Corporation7 * Copyright (C) 2007-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 329 329 * Call the common device extension initializer. 330 330 */ 331 rc = V BoxGuestInitDevExt(&g_DevExt, g_uIOPortBase, g_pMMIOBase, g_cbMMIO,331 rc = VbgdCommonInitDevExt(&g_DevExt, g_uIOPortBase, g_pMMIOBase, g_cbMMIO, 332 332 #if ARCH_BITS == 64 333 VBOXOSTYPE_Solaris_x64,333 VBOXOSTYPE_Solaris_x64, 334 334 #else 335 VBOXOSTYPE_Solaris,335 VBOXOSTYPE_Solaris, 336 336 #endif 337 VMMDEV_EVENT_MOUSE_POSITION_CHANGED);337 VMMDEV_EVENT_MOUSE_POSITION_CHANGED); 338 338 if (RT_SUCCESS(rc)) 339 339 { … … 347 347 348 348 LogRel((DEVICE_NAME "::Attach: ddi_create_minor_node failed.\n")); 349 V BoxGuestDeleteDevExt(&g_DevExt);349 VbgdCommonDeleteDevExt(&g_DevExt); 350 350 } 351 351 else 352 LogRel((DEVICE_NAME "::Attach: V BoxGuestInitDevExt failed.\n"));352 LogRel((DEVICE_NAME "::Attach: VbgdCommonInitDevExt failed.\n")); 353 353 VBoxGuestSolarisRemoveIRQ(pDip); 354 354 } … … 404 404 ddi_regs_map_free(&g_PciMMIOHandle); 405 405 ddi_remove_minor_node(pDip, NULL); 406 V BoxGuestDeleteDevExt(&g_DevExt);406 VbgdCommonDeleteDevExt(&g_DevExt); 407 407 g_pDip = NULL; 408 408 return DDI_SUCCESS; … … 515 515 * Create a new session. 516 516 */ 517 rc = V BoxGuestCreateUserSession(&g_DevExt, &pSession);517 rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession); 518 518 if (RT_SUCCESS(rc)) 519 519 { … … 528 528 ddi_soft_state_free(g_pVBoxGuestSolarisState, iOpenInstance); 529 529 530 LogRel((DEVICE_NAME "::Open: V BoxGuestCreateUserSession failed. rc=%d\n", rc));530 LogRel((DEVICE_NAME "::Open: VbgdCommonCreateUserSession failed. rc=%d\n", rc)); 531 531 return EFAULT; 532 532 } … … 559 559 * Close the session. 560 560 */ 561 V BoxGuestCloseSession(&g_DevExt, pSession);561 VbgdCommonCloseSession(&g_DevExt, pSession); 562 562 return 0; 563 563 } … … 694 694 */ 695 695 size_t cbDataReturned = 0; 696 rc = V BoxGuestCommonIOCtl(Cmd, &g_DevExt, pSession, pvBuf, ReqWrap.cbData, &cbDataReturned);696 rc = VbgdCommonIoCtl(Cmd, &g_DevExt, pSession, pvBuf, ReqWrap.cbData, &cbDataReturned); 697 697 if (RT_SUCCESS(rc)) 698 698 { … … 721 721 * which are not really failures that require logging. 722 722 */ 723 Log((DEVICE_NAME "::IOCtl: V BoxGuestCommonIOCtl failed. Cmd=%#x rc=%d\n", Cmd, rc));723 Log((DEVICE_NAME "::IOCtl: VbgdCommonIoCtl failed. Cmd=%#x rc=%d\n", Cmd, rc)); 724 724 if (rc == VERR_PERMISSION_DENIED) /* RTErrConvertToErrno() below will ring-0 debug assert if we don't do this. */ 725 725 rc = VERR_ACCESS_DENIED; … … 894 894 895 895 mutex_enter(&g_IrqMtx); 896 bool fOurIRQ = V BoxGuestCommonISR(&g_DevExt);896 bool fOurIRQ = VbgdCommonISR(&g_DevExt); 897 897 mutex_exit(&g_IrqMtx); 898 898 … … 901 901 902 902 903 void V BoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)903 void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt) 904 904 { 905 905 LogFlow((DEVICE_NAME "::NativeISRMousePollEvent:\n")); -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp
r44988 r54608 5 5 6 6 /* 7 * Copyright (C) 2010-201 3Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp
r45013 r54608 5 5 6 6 /* 7 * Copyright (C) 2010-201 3Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 276 276 277 277 /* Destroy device extension and clean up everything else. */ 278 V BoxGuestDeleteDevExt(&pDevExt->Core);278 VbgdCommonDeleteDevExt(&pDevExt->Core); 279 279 280 280 /* Remove DOS device + symbolic link. */ … … 467 467 { 468 468 Log(("VBoxGuest::vbgdNtGuestPower: Returning from hibernation!\n")); 469 int rc = V BoxGuestReinitDevExtAfterHibernation(&pDevExt->Core,469 int rc = VbgdCommonReinitDevExtAfterHibernation(&pDevExt->Core, 470 470 vbgdNtVersionToOSType(g_enmVbgdNtVer)); 471 471 if (RT_FAILURE(rc)) -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
r54241 r54608 5 5 6 6 /* 7 * Copyright (C) 2010-201 3Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 426 426 pvMMIOBase, pDevExt, pDevExt ? pDevExt->Core.pVMMDevMemory : NULL)); 427 427 428 int vrc = V BoxGuestInitDevExt(&pDevExt->Core,429 pDevExt->Core.IOPortBase,430 pvMMIOBase, cbMMIO,431 vbgdNtVersionToOSType(g_enmVbgdNtVer),432 VMMDEV_EVENT_MOUSE_POSITION_CHANGED);428 int vrc = VbgdCommonInitDevExt(&pDevExt->Core, 429 pDevExt->Core.IOPortBase, 430 pvMMIOBase, cbMMIO, 431 vbgdNtVersionToOSType(g_enmVbgdNtVer), 432 VMMDEV_EVENT_MOUSE_POSITION_CHANGED); 433 433 if (RT_FAILURE(vrc)) 434 434 { … … 515 515 #ifdef VBOX_WITH_HGCM 516 516 LogFunc(("Allocating kernel session data ...\n")); 517 int vrc = V BoxGuestCreateKernelSession(&pDevExt->Core, &pDevExt->pKernelSession);517 int vrc = VbgdCommonCreateKernelSession(&pDevExt->Core, &pDevExt->pKernelSession); 518 518 if (RT_FAILURE(vrc)) 519 519 { … … 568 568 if (pDevExt->pKernelSession) 569 569 { 570 V BoxGuestCloseSession(pDevExt, pDevExt->pKernelSession);570 VbgdCommonCloseSession(pDevExt, pDevExt->pKernelSession); 571 571 pDevExt->pKernelSession = NULL; 572 572 } … … 608 608 /* Destroy device extension and clean up everything else. */ 609 609 if (pDrvObj->DeviceObject && pDrvObj->DeviceObject->DeviceExtension) 610 V BoxGuestDeleteDevExt((PVBOXGUESTDEVEXT)pDrvObj->DeviceObject->DeviceExtension);610 VbgdCommonDeleteDevExt((PVBOXGUESTDEVEXT)pDrvObj->DeviceObject->DeviceExtension); 611 611 612 612 /* … … 673 673 * exists for every R3 process. 674 674 */ 675 vrc = V BoxGuestCreateUserSession(&pDevExt->Core, &pSession);675 vrc = VbgdCommonCreateUserSession(&pDevExt->Core, &pSession); 676 676 } 677 677 else 678 678 { 679 679 /* ... otherwise we've been called from R0! */ 680 vrc = V BoxGuestCreateKernelSession(&pDevExt->Core, &pSession);680 vrc = VbgdCommonCreateKernelSession(&pDevExt->Core, &pSession); 681 681 } 682 682 if (RT_SUCCESS(vrc)) … … 715 715 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pFileObj->FsContext; 716 716 if (pSession) 717 V BoxGuestCloseSession(&pDevExt->Core, pSession);717 VbgdCommonCloseSession(&pDevExt->Core, pSession); 718 718 #endif 719 719 … … 773 773 */ 774 774 size_t cbDataReturned; 775 int vrc = V BoxGuestCommonIOCtl(uCmd, &pDevExt->Core, pSession, pBuf, cbData, &cbDataReturned);775 int vrc = VbgdCommonIoCtl(uCmd, &pDevExt->Core, pSession, pBuf, cbData, &cbDataReturned); 776 776 777 777 LogFlowFunc(("rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n", … … 976 976 /* Process the wake-up list we were asked by the scheduling a DPC 977 977 * in vbgdNtIsrHandler(). */ 978 V BoxGuestWaitDoWakeUps(&pDevExt->Core);978 VbgdCommonWaitDoWakeUps(&pDevExt->Core); 979 979 } 980 980 … … 996 996 997 997 /* Enter the common ISR routine and do the actual work. */ 998 BOOLEAN fIRQTaken = V BoxGuestCommonISR(&pDevExt->Core);998 BOOLEAN fIRQTaken = VbgdCommonISR(&pDevExt->Core); 999 999 1000 1000 /* If we need to wake up some events we do that in a DPC to make … … 1019 1019 * @param pDevExt Device extension structure. 1020 1020 */ 1021 void V BoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)1021 void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt) 1022 1022 { 1023 1023 NOREF(pDevExt); -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h
r53008 r54608 5 5 6 6 /* 7 * Copyright (C) 2010-201 3Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r54606 r54608 87 87 *******************************************************************************/ 88 88 #ifdef VBOX_WITH_HGCM 89 static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User);89 static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User); 90 90 #endif 91 static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);91 static int vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession); 92 92 static void vbgdBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker); 93 93 static uint32_t vbgdGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession); … … 109 109 * Global Variables * 110 110 *******************************************************************************/ 111 static const uint32_t cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]);111 static const uint32_t g_cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]); 112 112 113 113 #if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) … … 145 145 * @param pDevExt The device extension. 146 146 */ 147 static int vb oxGuestInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)147 static int vbgdInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt) 148 148 { 149 149 /* … … 168 168 */ 169 169 if (pReq->hypervisorSize == 0) 170 Log(("vb oxGuestInitFixateGuestMappings: nothing to do\n"));170 Log(("vbgdInitFixateGuestMappings: nothing to do\n")); 171 171 else 172 172 { … … 180 180 uint32_t iTry; 181 181 bool fBitched = false; 182 Log(("vb oxGuestInitFixateGuestMappings: cbHypervisor=%#x\n", cbHypervisor));182 Log(("vbgdInitFixateGuestMappings: cbHypervisor=%#x\n", cbHypervisor)); 183 183 for (iTry = 0; iTry < RT_ELEMENTS(ahTries); iTry++) 184 184 { … … 275 275 276 276 /** 277 * Undo what vb oxGuestInitFixateGuestMappings did.277 * Undo what vbgdInitFixateGuestMappings did. 278 278 * 279 279 * @param pDevExt The device extension. 280 280 */ 281 static void vb oxGuestTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)281 static void vbgdTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt) 282 282 { 283 283 if (pDevExt->hGuestMappings != NIL_RTR0PTR) … … 302 302 } 303 303 else 304 LogRel(("vb oxGuestTermUnfixGuestMappings: Failed to unfix the guest mappings! rc=%Rrc\n", rc));304 LogRel(("vbgdTermUnfixGuestMappings: Failed to unfix the guest mappings! rc=%Rrc\n", rc)); 305 305 306 306 pDevExt->hGuestMappings = NIL_RTR0MEMOBJ; … … 308 308 } 309 309 310 311 /** @name Memory Ballooning 312 * @{ 313 */ 310 314 311 315 /** … … 318 322 * @param pReq The pre-allocated request for performing the VMMDev call. 319 323 */ 320 static int vb oxGuestBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)324 static int vbgdBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq) 321 325 { 322 326 uint32_t iPage; … … 330 334 331 335 pReq->fInflate = true; 332 pReq->header.size = cbChangeMemBalloonReq;336 pReq->header.size = g_cbChangeMemBalloonReq; 333 337 pReq->cPages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES; 334 338 335 339 rc = VbglGRPerform(&pReq->header); 336 340 if (RT_FAILURE(rc)) 337 LogRel(("vb oxGuestBalloonInflate: VbglGRPerform failed. rc=%Rrc\n", rc));341 LogRel(("vbgdBalloonInflate: VbglGRPerform failed. rc=%Rrc\n", rc)); 338 342 return rc; 339 343 } … … 350 354 * @param pReq The pre-allocated request for performing the VMMDev call. 351 355 */ 352 static int vb oxGuestBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)356 static int vbgdBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq) 353 357 { 354 358 uint32_t iPage; … … 362 366 363 367 pReq->fInflate = false; 364 pReq->header.size = cbChangeMemBalloonReq;368 pReq->header.size = g_cbChangeMemBalloonReq; 365 369 pReq->cPages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES; 366 370 … … 368 372 if (RT_FAILURE(rc)) 369 373 { 370 LogRel(("vb oxGuestBalloonDeflate: VbglGRPerform failed. rc=%Rrc\n", rc));374 LogRel(("vbgdBalloonDeflate: VbglGRPerform failed. rc=%Rrc\n", rc)); 371 375 return rc; 372 376 } … … 375 379 if (RT_FAILURE(rc)) 376 380 { 377 LogRel(("vb oxGuestBalloonDeflate: RTR0MemObjFree(%p,true) -> %Rrc; this is *BAD*!\n", *pMemObj, rc));381 LogRel(("vbgdBalloonDeflate: RTR0MemObjFree(%p,true) -> %Rrc; this is *BAD*!\n", *pMemObj, rc)); 378 382 return rc; 379 383 } … … 387 391 * Inflate/deflate the memory balloon and notify the host. 388 392 * 389 * This is a worker used by VBoxGuestCommonIOCtl_CheckMemoryBalloon - it takes 390 * the mutex. 393 * This is a worker used by vbgdIoCtl_CheckMemoryBalloon - it takes the mutex. 391 394 * 392 395 * @returns VBox status code. … … 397 400 * (VINF_SUCCESS if set). 398 401 */ 399 static int vb oxGuestSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonChunks, uint32_t *pfHandleInR3)402 static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonChunks, uint32_t *pfHandleInR3) 400 403 { 401 404 int rc = VINF_SUCCESS; … … 408 411 if (cBalloonChunks > pDevExt->MemBalloon.cMaxChunks) 409 412 { 410 LogRel(("vb oxGuestSetBalloonSizeKernel: illegal balloon size %u (max=%u)\n",413 LogRel(("vbgdSetBalloonSizeKernel: illegal balloon size %u (max=%u)\n", 411 414 cBalloonChunks, pDevExt->MemBalloon.cMaxChunks)); 412 415 return VERR_INVALID_PARAMETER; … … 422 425 if (!pDevExt->MemBalloon.paMemObj) 423 426 { 424 LogRel(("vb oxGuestSetBalloonSizeKernel: no memory for paMemObj!\n"));427 LogRel(("vbgdSetBalloonSizeKernel: no memory for paMemObj!\n")); 425 428 return VERR_NO_MEMORY; 426 429 } 427 430 } 428 431 429 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);432 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon); 430 433 if (RT_FAILURE(rc)) 431 434 return rc; … … 454 457 } 455 458 456 rc = vb oxGuestBalloonInflate(&pDevExt->MemBalloon.paMemObj[i], pReq);459 rc = vbgdBalloonInflate(&pDevExt->MemBalloon.paMemObj[i], pReq); 457 460 if (RT_FAILURE(rc)) 458 461 { … … 470 473 for (i = pDevExt->MemBalloon.cChunks; i-- > cBalloonChunks;) 471 474 { 472 rc = vb oxGuestBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);475 rc = vbgdBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq); 473 476 if (RT_FAILURE(rc)) 474 477 { … … 494 497 495 498 /** 499 * Inflate/deflate the balloon by one chunk. 500 * 501 * Worker for vbgdIoCtl_ChangeMemoryBalloon - it takes the mutex. 502 * 503 * @returns VBox status code. 504 * @param pDevExt The device extension. 505 * @param pSession The session. 506 * @param u64ChunkAddr The address of the chunk to add to / remove from the 507 * balloon. 508 * @param fInflate Inflate if true, deflate if false. 509 */ 510 static int vbgdSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint64_t u64ChunkAddr, bool fInflate) 511 { 512 VMMDevChangeMemBalloon *pReq; 513 int rc = VINF_SUCCESS; 514 uint32_t i; 515 PRTR0MEMOBJ pMemObj = NULL; 516 517 if (fInflate) 518 { 519 if ( pDevExt->MemBalloon.cChunks > pDevExt->MemBalloon.cMaxChunks - 1 520 || pDevExt->MemBalloon.cMaxChunks == 0 /* If called without first querying. */) 521 { 522 LogRel(("vboxGuestSetBalloonSize: cannot inflate balloon, already have %u chunks (max=%u)\n", 523 pDevExt->MemBalloon.cChunks, pDevExt->MemBalloon.cMaxChunks)); 524 return VERR_INVALID_PARAMETER; 525 } 526 527 if (!pDevExt->MemBalloon.paMemObj) 528 { 529 pDevExt->MemBalloon.paMemObj = (PRTR0MEMOBJ)RTMemAlloc(sizeof(RTR0MEMOBJ) * pDevExt->MemBalloon.cMaxChunks); 530 if (!pDevExt->MemBalloon.paMemObj) 531 { 532 LogRel(("VBoxGuestSetBalloonSizeFromUser: no memory for paMemObj!\n")); 533 return VERR_NO_MEMORY; 534 } 535 for (i = 0; i < pDevExt->MemBalloon.cMaxChunks; i++) 536 pDevExt->MemBalloon.paMemObj[i] = NIL_RTR0MEMOBJ; 537 } 538 } 539 else 540 { 541 if (pDevExt->MemBalloon.cChunks == 0) 542 { 543 AssertMsgFailed(("vboxGuestSetBalloonSize: cannot decrease balloon, already at size 0\n")); 544 return VERR_INVALID_PARAMETER; 545 } 546 } 547 548 /* 549 * Enumerate all memory objects and check if the object is already registered. 550 */ 551 for (i = 0; i < pDevExt->MemBalloon.cMaxChunks; i++) 552 { 553 if ( fInflate 554 && !pMemObj 555 && pDevExt->MemBalloon.paMemObj[i] == NIL_RTR0MEMOBJ) 556 pMemObj = &pDevExt->MemBalloon.paMemObj[i]; /* found free object pointer */ 557 if (RTR0MemObjAddressR3(pDevExt->MemBalloon.paMemObj[i]) == u64ChunkAddr) 558 { 559 if (fInflate) 560 return VERR_ALREADY_EXISTS; /* don't provide the same memory twice */ 561 pMemObj = &pDevExt->MemBalloon.paMemObj[i]; 562 break; 563 } 564 } 565 if (!pMemObj) 566 { 567 if (fInflate) 568 { 569 /* no free object pointer found -- should not happen */ 570 return VERR_NO_MEMORY; 571 } 572 573 /* cannot free this memory as it wasn't provided before */ 574 return VERR_NOT_FOUND; 575 } 576 577 /* 578 * Try inflate / default the balloon as requested. 579 */ 580 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon); 581 if (RT_FAILURE(rc)) 582 return rc; 583 584 if (fInflate) 585 { 586 rc = RTR0MemObjLockUser(pMemObj, (RTR3PTR)u64ChunkAddr, VMMDEV_MEMORY_BALLOON_CHUNK_SIZE, 587 RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS); 588 if (RT_SUCCESS(rc)) 589 { 590 rc = vbgdBalloonInflate(pMemObj, pReq); 591 if (RT_SUCCESS(rc)) 592 pDevExt->MemBalloon.cChunks++; 593 else 594 { 595 Log(("vboxGuestSetBalloonSize(inflate): failed, rc=%Rrc!\n", rc)); 596 RTR0MemObjFree(*pMemObj, true); 597 *pMemObj = NIL_RTR0MEMOBJ; 598 } 599 } 600 } 601 else 602 { 603 rc = vbgdBalloonDeflate(pMemObj, pReq); 604 if (RT_SUCCESS(rc)) 605 pDevExt->MemBalloon.cChunks--; 606 else 607 Log(("vboxGuestSetBalloonSize(deflate): failed, rc=%Rrc!\n", rc)); 608 } 609 610 VbglGRFree(&pReq->header); 611 return rc; 612 } 613 614 615 /** 616 * Cleanup the memory balloon of a session. 617 * 618 * Will request the balloon mutex, so it must be valid and the caller must not 619 * own it already. 620 * 621 * @param pDevExt The device extension. 622 * @param pDevExt The session. Can be NULL at unload. 623 */ 624 static void vbgdCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) 625 { 626 RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx); 627 if ( pDevExt->MemBalloon.pOwner == pSession 628 || pSession == NULL /*unload*/) 629 { 630 if (pDevExt->MemBalloon.paMemObj) 631 { 632 VMMDevChangeMemBalloon *pReq; 633 int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon); 634 if (RT_SUCCESS(rc)) 635 { 636 uint32_t i; 637 for (i = pDevExt->MemBalloon.cChunks; i-- > 0;) 638 { 639 rc = vbgdBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq); 640 if (RT_FAILURE(rc)) 641 { 642 LogRel(("vbgdCloseMemBalloon: Deflate failed with rc=%Rrc. Will leak %u chunks.\n", 643 rc, pDevExt->MemBalloon.cChunks)); 644 break; 645 } 646 pDevExt->MemBalloon.paMemObj[i] = NIL_RTR0MEMOBJ; 647 pDevExt->MemBalloon.cChunks--; 648 } 649 VbglGRFree(&pReq->header); 650 } 651 else 652 LogRel(("vbgdCloseMemBalloon: Failed to allocate VMMDev request buffer (rc=%Rrc). Will leak %u chunks.\n", 653 rc, pDevExt->MemBalloon.cChunks)); 654 RTMemFree(pDevExt->MemBalloon.paMemObj); 655 pDevExt->MemBalloon.paMemObj = NULL; 656 } 657 658 pDevExt->MemBalloon.pOwner = NULL; 659 } 660 RTSemFastMutexRelease(pDevExt->MemBalloon.hMtx); 661 } 662 663 /** @} */ 664 665 666 667 /** @name Heartbeat 668 * @{ 669 */ 670 671 /** 496 672 * Sends heartbeat to host. 497 673 * 498 674 * @returns VBox status code. 499 675 */ 500 static int VBoxGuestHeartbeatSend(PVBOXGUESTDEVEXT pDevExt)676 static int vbgdHeartbeatSend(PVBOXGUESTDEVEXT pDevExt) 501 677 { 502 678 int rc; … … 504 680 { 505 681 rc = VbglGRPerform(pDevExt->pReqGuestHeartbeat); 506 Log((" VBoxGuestHeartbeatSend: VbglGRPerform VBoxGuestHeartbeatSend completed with rc=%Rrc\n", rc));682 Log(("vbgdHeartbeatSend: VbglGRPerform vbgdHeartbeatSend completed with rc=%Rrc\n", rc)); 507 683 } 508 684 else … … 513 689 514 690 /** 691 * Callback for heartbeat timer. 692 */ 693 static DECLCALLBACK(void) vbgdHeartbeatTimerHandler(PRTTIMER hTimer, void *pvUser, uint64_t iTick) 694 { 695 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser; 696 int rc; 697 AssertReturnVoid(pDevExt); 698 699 rc = vbgdHeartbeatSend(pDevExt); 700 if (RT_FAILURE(rc)) 701 Log(("HB Timer: vbgdHeartbeatSend failed: rc=%Rrc\n", rc)); 702 703 NOREF(hTimer); NOREF(iTick); 704 } 705 706 707 /** 515 708 * Configure the host to check guest's heartbeat 516 709 * and get heartbeat interval from the host. … … 520 713 * @param fEnabled Set true to enable guest heartbeat checks on host. 521 714 */ 522 static int VBoxGuestHeartbeatHostConfigure(PVBOXGUESTDEVEXT pDevExt, bool fEnabled)715 static int vbgdHeartbeatHostConfigure(PVBOXGUESTDEVEXT pDevExt, bool fEnabled) 523 716 { 524 717 VMMDevReqHeartbeat *pReq; 525 718 int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_HeartbeatConfigure); 526 Log((" VBoxGuestHeartbeatHostConfigure: VbglGRAlloc VBoxGuestHeartbeatHostConfigure completed with rc=%Rrc\n", rc));719 Log(("vbgdHeartbeatHostConfigure: VbglGRAlloc vbgdHeartbeatHostConfigure completed with rc=%Rrc\n", rc)); 527 720 if (RT_SUCCESS(rc)) 528 721 { … … 530 723 pReq->cNsInterval = 0; 531 724 rc = VbglGRPerform(&pReq->header); 532 Log((" VBoxGuestHeartbeatHostConfigure: VbglGRPerform VBoxGuestHeartbeatHostConfigure completed with rc=%Rrc\n", rc));725 Log(("vbgdHeartbeatHostConfigure: VbglGRPerform vbgdHeartbeatHostConfigure completed with rc=%Rrc\n", rc)); 533 726 pDevExt->cNsHeartbeatInterval = pReq->cNsInterval; 534 727 VbglGRFree(&pReq->header); … … 539 732 540 733 /** 541 * Callback for heartbeat timer.542 */543 static DECLCALLBACK(void) VBoxGuestHeartbeatTimerHandler(PRTTIMER p1, void *pvUser, uint64_t p3)544 {545 NOREF(p1);546 NOREF(p3);547 548 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;549 if (!pDevExt)550 return;551 552 int rc = VBoxGuestHeartbeatSend(pDevExt);553 if (RT_FAILURE(rc))554 {555 Log(("HB Timer: VBoxGuestHeartbeatSend terminated with rc=%Rrc\n", rc));556 }557 }558 559 560 /**561 734 * Initializes the heartbeat timer. 562 735 * … … 571 744 * Make sure that heartbeat checking is disabled. 572 745 */ 573 int rc = VBoxGuestHeartbeatHostConfigure(pDevExt, false);746 int rc = vbgdHeartbeatHostConfigure(pDevExt, false); 574 747 if (RT_SUCCESS(rc)) 575 748 { 576 rc = VBoxGuestHeartbeatHostConfigure(pDevExt, true);749 rc = vbgdHeartbeatHostConfigure(pDevExt, true); 577 750 if (RT_SUCCESS(rc)) 578 751 { … … 586 759 if (RT_SUCCESS(rc)) 587 760 { 588 LogRel(("V BoxGuestInitDevExt: Setting up heartbeat to trigger every %RU64 sec\n",761 LogRel(("VbgdCommonInitDevExt: Setting up heartbeat to trigger every %RU64 sec\n", 589 762 pDevExt->cNsHeartbeatInterval / RT_NS_1SEC)); 590 763 rc = RTTimerCreateEx(&pDevExt->pHeartbeatTimer, pDevExt->cNsHeartbeatInterval, 0 /*fFlags*/, 591 (PFNRTTIMER) VBoxGuestHeartbeatTimerHandler, pDevExt);764 (PFNRTTIMER)vbgdHeartbeatTimerHandler, pDevExt); 592 765 if (RT_SUCCESS(rc)) 593 766 { … … 596 769 return VINF_SUCCESS; 597 770 598 LogRel(("V BoxGuestInitDevExt: Heartbeat timer failed to start, rc=%Rrc\n", rc));771 LogRel(("VbgdCommonInitDevExt: Heartbeat timer failed to start, rc=%Rrc\n", rc)); 599 772 } 600 773 else 601 LogRel(("V BoxGuestInitDevExt: Failed to create heartbeat timer: %Rrc\n", rc));774 LogRel(("VbgdCommonInitDevExt: Failed to create heartbeat timer: %Rrc\n", rc)); 602 775 603 776 VbglGRFree(pDevExt->pReqGuestHeartbeat); … … 605 778 } 606 779 else 607 LogRel(("V BoxGuestInitDevExt: VbglGRAlloc(VMMDevReq_GuestHeartbeat): %Rrc\n", rc));608 609 LogRel(("V BoxGuestInitDevExt: Failed to set up the timer, guest heartbeat is disabled\n"));610 VBoxGuestHeartbeatHostConfigure(pDevExt, false);780 LogRel(("VbgdCommonInitDevExt: VbglGRAlloc(VMMDevReq_GuestHeartbeat): %Rrc\n", rc)); 781 782 LogRel(("VbgdCommonInitDevExt: Failed to set up the timer, guest heartbeat is disabled\n")); 783 vbgdHeartbeatHostConfigure(pDevExt, false); 611 784 } 612 785 else 613 LogRel(("V BoxGuestInitDevExt: Failed to configure host for heartbeat checking: rc=%Rrc\n", rc));786 LogRel(("VbgdCommonInitDevExt: Failed to configure host for heartbeat checking: rc=%Rrc\n", rc)); 614 787 } 615 788 return rc; 616 789 } 617 790 618 619 /** 620 * Helper to reinit the VBoxVMM communication after hibernation. 791 /** @} */ 792 793 794 /** 795 * Helper to reinit the VMMDev communication after hibernation. 621 796 * 622 797 * @returns VBox status code. 623 798 * @param pDevExt The device extension. 624 799 * @param enmOSType The OS type. 625 */ 626 int VBoxGuestReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType) 800 * 801 * @todo Call this on all platforms, not just windows. 802 */ 803 int VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType) 627 804 { 628 805 int rc = VBoxGuestReportGuestInfo(enmOSType); … … 631 808 rc = VBoxGuestReportDriverStatus(true /* Driver is active */); 632 809 if (RT_FAILURE(rc)) 633 Log(("V BoxGuestReinitDevExtAfterHibernation: could not report guest driver status, rc=%Rrc\n", rc));810 Log(("VbgdCommonReinitDevExtAfterHibernation: could not report guest driver status, rc=%Rrc\n", rc)); 634 811 } 635 812 else 636 Log(("V BoxGuestReinitDevExtAfterHibernation: could not report guest information to host, rc=%Rrc\n", rc));637 LogFlow(("V BoxGuestReinitDevExtAfterHibernation: returned with rc=%Rrc\n", rc));813 Log(("VbgdCommonReinitDevExtAfterHibernation: could not report guest information to host, rc=%Rrc\n", rc)); 814 LogFlow(("VbgdCommonReinitDevExtAfterHibernation: returned with rc=%Rrc\n", rc)); 638 815 return rc; 639 }640 641 642 /**643 * Inflate/deflate the balloon by one chunk.644 *645 * Worker for VBoxGuestCommonIOCtl_ChangeMemoryBalloon - it takes the mutex.646 *647 * @returns VBox status code.648 * @param pDevExt The device extension.649 * @param pSession The session.650 * @param u64ChunkAddr The address of the chunk to add to / remove from the651 * balloon.652 * @param fInflate Inflate if true, deflate if false.653 */654 static int vboxGuestSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,655 uint64_t u64ChunkAddr, bool fInflate)656 {657 VMMDevChangeMemBalloon *pReq;658 int rc = VINF_SUCCESS;659 uint32_t i;660 PRTR0MEMOBJ pMemObj = NULL;661 662 if (fInflate)663 {664 if ( pDevExt->MemBalloon.cChunks > pDevExt->MemBalloon.cMaxChunks - 1665 || pDevExt->MemBalloon.cMaxChunks == 0 /* If called without first querying. */)666 {667 LogRel(("vboxGuestSetBalloonSize: cannot inflate balloon, already have %u chunks (max=%u)\n",668 pDevExt->MemBalloon.cChunks, pDevExt->MemBalloon.cMaxChunks));669 return VERR_INVALID_PARAMETER;670 }671 672 if (!pDevExt->MemBalloon.paMemObj)673 {674 pDevExt->MemBalloon.paMemObj = (PRTR0MEMOBJ)RTMemAlloc(sizeof(RTR0MEMOBJ) * pDevExt->MemBalloon.cMaxChunks);675 if (!pDevExt->MemBalloon.paMemObj)676 {677 LogRel(("VBoxGuestSetBalloonSizeFromUser: no memory for paMemObj!\n"));678 return VERR_NO_MEMORY;679 }680 for (i = 0; i < pDevExt->MemBalloon.cMaxChunks; i++)681 pDevExt->MemBalloon.paMemObj[i] = NIL_RTR0MEMOBJ;682 }683 }684 else685 {686 if (pDevExt->MemBalloon.cChunks == 0)687 {688 AssertMsgFailed(("vboxGuestSetBalloonSize: cannot decrease balloon, already at size 0\n"));689 return VERR_INVALID_PARAMETER;690 }691 }692 693 /*694 * Enumerate all memory objects and check if the object is already registered.695 */696 for (i = 0; i < pDevExt->MemBalloon.cMaxChunks; i++)697 {698 if ( fInflate699 && !pMemObj700 && pDevExt->MemBalloon.paMemObj[i] == NIL_RTR0MEMOBJ)701 pMemObj = &pDevExt->MemBalloon.paMemObj[i]; /* found free object pointer */702 if (RTR0MemObjAddressR3(pDevExt->MemBalloon.paMemObj[i]) == u64ChunkAddr)703 {704 if (fInflate)705 return VERR_ALREADY_EXISTS; /* don't provide the same memory twice */706 pMemObj = &pDevExt->MemBalloon.paMemObj[i];707 break;708 }709 }710 if (!pMemObj)711 {712 if (fInflate)713 {714 /* no free object pointer found -- should not happen */715 return VERR_NO_MEMORY;716 }717 718 /* cannot free this memory as it wasn't provided before */719 return VERR_NOT_FOUND;720 }721 722 /*723 * Try inflate / default the balloon as requested.724 */725 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);726 if (RT_FAILURE(rc))727 return rc;728 729 if (fInflate)730 {731 rc = RTR0MemObjLockUser(pMemObj, (RTR3PTR)u64ChunkAddr, VMMDEV_MEMORY_BALLOON_CHUNK_SIZE,732 RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS);733 if (RT_SUCCESS(rc))734 {735 rc = vboxGuestBalloonInflate(pMemObj, pReq);736 if (RT_SUCCESS(rc))737 pDevExt->MemBalloon.cChunks++;738 else739 {740 Log(("vboxGuestSetBalloonSize(inflate): failed, rc=%Rrc!\n", rc));741 RTR0MemObjFree(*pMemObj, true);742 *pMemObj = NIL_RTR0MEMOBJ;743 }744 }745 }746 else747 {748 rc = vboxGuestBalloonDeflate(pMemObj, pReq);749 if (RT_SUCCESS(rc))750 pDevExt->MemBalloon.cChunks--;751 else752 Log(("vboxGuestSetBalloonSize(deflate): failed, rc=%Rrc!\n", rc));753 }754 755 VbglGRFree(&pReq->header);756 return rc;757 }758 759 760 /**761 * Cleanup the memory balloon of a session.762 *763 * Will request the balloon mutex, so it must be valid and the caller must not764 * own it already.765 *766 * @param pDevExt The device extension.767 * @param pDevExt The session. Can be NULL at unload.768 */769 static void vboxGuestCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)770 {771 RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);772 if ( pDevExt->MemBalloon.pOwner == pSession773 || pSession == NULL /*unload*/)774 {775 if (pDevExt->MemBalloon.paMemObj)776 {777 VMMDevChangeMemBalloon *pReq;778 int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);779 if (RT_SUCCESS(rc))780 {781 uint32_t i;782 for (i = pDevExt->MemBalloon.cChunks; i-- > 0;)783 {784 rc = vboxGuestBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);785 if (RT_FAILURE(rc))786 {787 LogRel(("vboxGuestCloseMemBalloon: Deflate failed with rc=%Rrc. Will leak %u chunks.\n",788 rc, pDevExt->MemBalloon.cChunks));789 break;790 }791 pDevExt->MemBalloon.paMemObj[i] = NIL_RTR0MEMOBJ;792 pDevExt->MemBalloon.cChunks--;793 }794 VbglGRFree(&pReq->header);795 }796 else797 LogRel(("vboxGuestCloseMemBalloon: Failed to allocate VMMDev request buffer (rc=%Rrc). Will leak %u chunks.\n",798 rc, pDevExt->MemBalloon.cChunks));799 RTMemFree(pDevExt->MemBalloon.paMemObj);800 pDevExt->MemBalloon.paMemObj = NULL;801 }802 803 pDevExt->MemBalloon.pOwner = NULL;804 }805 RTSemFastMutexRelease(pDevExt->MemBalloon.hMtx);806 816 } 807 817 … … 828 838 * will ever be allowed to mask. 829 839 */ 830 int V BoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,831 void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fFixedEvents)840 int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, 841 void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fFixedEvents) 832 842 { 833 843 int rc, rc2; … … 913 923 { 914 924 pDevExt->pVMMDevMemory = pVMMDev; 915 Log(("V BoxGuestInitDevExt: VMMDevMemory: mapping=%p size=%#RX32 (%#RX32) version=%#RX32\n",925 Log(("VbgdCommonInitDevExt: VMMDevMemory: mapping=%p size=%#RX32 (%#RX32) version=%#RX32\n", 916 926 pVMMDev, pVMMDev->u32Size, cbMMIO, pVMMDev->u32Version)); 917 927 } 918 928 else /* try live without it. */ 919 LogRel(("V BoxGuestInitDevExt: Bogus VMMDev memory; u32Version=%RX32 (expected %RX32) u32Size=%RX32 (expected <= %RX32)\n",929 LogRel(("VbgdCommonInitDevExt: Bogus VMMDev memory; u32Version=%RX32 (expected %RX32) u32Size=%RX32 (expected <= %RX32)\n", 920 930 pVMMDev->u32Version, VMMDEV_MEMORY_VERSION, pVMMDev->u32Size, cbMMIO)); 921 931 } … … 929 939 if (RT_FAILURE(rc)) 930 940 { 931 LogRel(("V BoxGuestInitDevExt: failed to create spinlock, rc=%Rrc!\n", rc));941 LogRel(("VbgdCommonInitDevExt: failed to create spinlock, rc=%Rrc!\n", rc)); 932 942 if (pDevExt->EventSpinlock != NIL_RTSPINLOCK) 933 943 RTSpinlockDestroy(pDevExt->EventSpinlock); … … 938 948 if (RT_FAILURE(rc)) 939 949 { 940 LogRel(("V BoxGuestInitDevExt: failed to create mutex, rc=%Rrc!\n", rc));950 LogRel(("VbgdCommonInitDevExt: failed to create mutex, rc=%Rrc!\n", rc)); 941 951 RTSpinlockDestroy(pDevExt->SessionSpinlock); 942 952 RTSpinlockDestroy(pDevExt->EventSpinlock); … … 973 983 * Initialize stuff which may fail without requiring the driver init to fail. 974 984 */ 975 vb oxGuestInitFixateGuestMappings(pDevExt);985 vbgdInitFixateGuestMappings(pDevExt); 976 986 vbgdHeartbeatInit(pDevExt); 977 987 … … 981 991 rc = VBoxGuestReportDriverStatus(true /* Driver is active */); 982 992 if (RT_FAILURE(rc)) 983 LogRel(("V BoxGuestInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc));984 985 LogFlowFunc(("V BoxGuestInitDevExt: returns success\n"));993 LogRel(("VbgdCommonInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc)); 994 995 LogFlowFunc(("VbgdCommonInitDevExt: returns success\n")); 986 996 return VINF_SUCCESS; 987 997 } 988 998 } 989 999 990 LogRel(("V BoxGuestInitDevExt: failed to set host flags, rc=%Rrc\n", rc));1000 LogRel(("VbgdCommonInitDevExt: failed to set host flags, rc=%Rrc\n", rc)); 991 1001 } 992 1002 else 993 LogRel(("V BoxGuestInitDevExt: VBoxReportGuestInfo failed, rc=%Rrc\n", rc));1003 LogRel(("VbgdCommonInitDevExt: VBoxReportGuestInfo failed, rc=%Rrc\n", rc)); 994 1004 VbglGRFree((VMMDevRequestHeader *)pDevExt->pIrqAckEvents); 995 1005 } 996 1006 else 997 LogRel(("V BoxGuestInitDevExt: VBoxGRAlloc failed, rc=%Rrc\n", rc));1007 LogRel(("VbgdCommonInitDevExt: VBoxGRAlloc failed, rc=%Rrc\n", rc)); 998 1008 999 1009 VbglTerminate(); 1000 1010 } 1001 1011 else 1002 LogRel(("V BoxGuestInitDevExt: VbglInit failed, rc=%Rrc\n", rc));1012 LogRel(("VbgdCommonInitDevExt: VbglInit failed, rc=%Rrc\n", rc)); 1003 1013 1004 1014 rc2 = RTSemFastMutexDestroy(pDevExt->MemBalloon.hMtx); AssertRC(rc2); … … 1018 1028 * @param pList The head of the chain. 1019 1029 */ 1020 static void VBoxGuestDeleteWaitList(PRTLISTNODE pList)1030 static void vbgdDeleteWaitList(PRTLISTNODE pList) 1021 1031 { 1022 1032 while (!RTListIsEmpty(pList)) … … 1042 1052 * @param pDevExt The device extension. 1043 1053 */ 1044 void V BoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)1054 void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt) 1045 1055 { 1046 1056 int rc2; 1047 Log(("V BoxGuestDeleteDevExt:\n"));1057 Log(("VbgdCommonDeleteDevExt:\n")); 1048 1058 Log(("VBoxGuest: The additions driver is terminating.\n")); 1049 1059 … … 1055 1065 { 1056 1066 RTTimerDestroy(pDevExt->pHeartbeatTimer); 1057 VBoxGuestHeartbeatHostConfigure(pDevExt, false);1067 vbgdHeartbeatHostConfigure(pDevExt, false); 1058 1068 } 1059 1069 … … 1064 1074 * Clean up the bits that involves the host first. 1065 1075 */ 1066 vb oxGuestTermUnfixGuestMappings(pDevExt);1076 vbgdTermUnfixGuestMappings(pDevExt); 1067 1077 if (!RTListIsEmpty(&pDevExt->SessionList)) 1068 1078 { … … 1076 1086 vbgdResetMouseStatusOnHost(pDevExt); 1077 1087 1078 vb oxGuestCloseMemBalloon(pDevExt, (PVBOXGUESTSESSION)NULL);1088 vbgdCloseMemBalloon(pDevExt, (PVBOXGUESTSESSION)NULL); 1079 1089 1080 1090 /* … … 1085 1095 rc2 = RTSemFastMutexDestroy(pDevExt->MemBalloon.hMtx); AssertRC(rc2); 1086 1096 1087 VBoxGuestDeleteWaitList(&pDevExt->WaitList);1097 vbgdDeleteWaitList(&pDevExt->WaitList); 1088 1098 #ifdef VBOX_WITH_HGCM 1089 VBoxGuestDeleteWaitList(&pDevExt->HGCMWaitList);1099 vbgdDeleteWaitList(&pDevExt->HGCMWaitList); 1090 1100 #endif 1091 1101 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP 1092 VBoxGuestDeleteWaitList(&pDevExt->WakeUpList);1102 vbgdDeleteWaitList(&pDevExt->WakeUpList); 1093 1103 #endif 1094 VBoxGuestDeleteWaitList(&pDevExt->WokenUpList);1095 VBoxGuestDeleteWaitList(&pDevExt->FreeList);1104 vbgdDeleteWaitList(&pDevExt->WokenUpList); 1105 vbgdDeleteWaitList(&pDevExt->FreeList); 1096 1106 1097 1107 VbglTerminate(); … … 1114 1124 * 1115 1125 * The native code calls this when a ring-3 client opens the device. 1116 * Use V BoxGuestCreateKernelSession when a ring-0 client connects.1126 * Use VbgdCommonCreateKernelSession when a ring-0 client connects. 1117 1127 * 1118 1128 * @returns VBox status code. … … 1120 1130 * @param ppSession Where to store the session on success. 1121 1131 */ 1122 int V BoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)1132 int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession) 1123 1133 { 1124 1134 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)RTMemAllocZ(sizeof(*pSession)); 1125 1135 if (RT_UNLIKELY(!pSession)) 1126 1136 { 1127 LogRel(("V BoxGuestCreateUserSession: no memory!\n"));1137 LogRel(("VbgdCommonCreateUserSession: no memory!\n")); 1128 1138 return VERR_NO_MEMORY; 1129 1139 } … … 1138 1148 1139 1149 *ppSession = pSession; 1140 LogFlow(("V BoxGuestCreateUserSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",1150 LogFlow(("VbgdCommonCreateUserSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n", 1141 1151 pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */ 1142 1152 return VINF_SUCCESS; … … 1148 1158 * 1149 1159 * The native code calls this when a ring-0 client connects to the device. 1150 * Use V BoxGuestCreateUserSession when a ring-3 client opens the device.1160 * Use VbgdCommonCreateUserSession when a ring-3 client opens the device. 1151 1161 * 1152 1162 * @returns VBox status code. … … 1154 1164 * @param ppSession Where to store the session on success. 1155 1165 */ 1156 int V BoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)1166 int VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession) 1157 1167 { 1158 1168 PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)RTMemAllocZ(sizeof(*pSession)); 1159 1169 if (RT_UNLIKELY(!pSession)) 1160 1170 { 1161 LogRel(("V BoxGuestCreateKernelSession: no memory!\n"));1171 LogRel(("VbgdCommonCreateKernelSession: no memory!\n")); 1162 1172 return VERR_NO_MEMORY; 1163 1173 } … … 1172 1182 1173 1183 *ppSession = pSession; 1174 LogFlow(("V BoxGuestCreateKernelSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",1184 LogFlow(("VbgdCommonCreateKernelSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n", 1175 1185 pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */ 1176 1186 return VINF_SUCCESS; … … 1184 1194 * @param pSession The session to close (and free). 1185 1195 */ 1186 void V BoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)1196 void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) 1187 1197 { 1188 1198 #ifdef VBOX_WITH_HGCM 1189 1199 unsigned i; 1190 1200 #endif 1191 LogFlow(("V BoxGuestCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",1201 LogFlow(("VbgdCommonCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n", 1192 1202 pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */ 1193 1203 … … 1202 1212 vbgdSetSessionMouseStatus(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/); 1203 1213 1204 VBoxGuestCommonIOCtl_CancelAllWaitEvents(pDevExt, pSession);1214 vbgdIoCtl_CancelAllWaitEvents(pDevExt, pSession); 1205 1215 1206 1216 #ifdef VBOX_WITH_HGCM … … 1212 1222 Info.u32ClientID = pSession->aHGCMClientIds[i]; 1213 1223 pSession->aHGCMClientIds[i] = 0; 1214 Log(("V BoxGuestCloseSession: disconnecting client id %#RX32\n", Info.u32ClientID));1215 VbglR0HGCMInternalDisconnect(&Info, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);1224 Log(("VbgdCommonCloseSession: disconnecting client id %#RX32\n", Info.u32ClientID)); 1225 VbglR0HGCMInternalDisconnect(&Info, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT); 1216 1226 } 1217 1227 #endif … … 1220 1230 pSession->Process = NIL_RTPROCESS; 1221 1231 pSession->R0Process = NIL_RTR0PROCESS; 1222 vb oxGuestCloseMemBalloon(pDevExt, pSession);1232 vbgdCloseMemBalloon(pDevExt, pSession); 1223 1233 RTMemFree(pSession); 1224 1234 } … … 1232 1242 * @param pSession The session that's allocating this. Can be NULL. 1233 1243 */ 1234 static PVBOXGUESTWAIT VBoxGuestWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)1244 static PVBOXGUESTWAIT vbgdWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) 1235 1245 { 1236 1246 /* … … 1255 1265 if (!pWait) 1256 1266 { 1257 LogRelMax(32, (" VBoxGuestWaitAlloc: out-of-memory!\n"));1267 LogRelMax(32, ("vbgdWaitAlloc: out-of-memory!\n")); 1258 1268 return NULL; 1259 1269 } … … 1262 1272 if (RT_FAILURE(rc)) 1263 1273 { 1264 LogRelMax(32, ("V BoxGuestCommonIOCtl: RTSemEventMultiCreate failed with rc=%Rrc!\n", rc));1274 LogRelMax(32, ("VbgdCommonIoCtl: RTSemEventMultiCreate failed with rc=%Rrc!\n", rc)); 1265 1275 RTMemFree(pWait); 1266 1276 return NULL; … … 1298 1308 * @param pWait The wait-for-event entry to free. 1299 1309 */ 1300 static void VBoxGuestWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)1310 static void vbgdWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait) 1301 1311 { 1302 1312 pWait->fReqEvents = 0; … … 1324 1334 * @param pWait The wait-for-event entry to free. 1325 1335 */ 1326 static void VBoxGuestWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)1336 static void vbgdWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait) 1327 1337 { 1328 1338 RTSpinlockAcquire(pDevExt->EventSpinlock); 1329 VBoxGuestWaitFreeLocked(pDevExt, pWait);1339 vbgdWaitFreeLocked(pDevExt, pWait); 1330 1340 RTSpinlockRelease(pDevExt->EventSpinlock); 1331 1341 } … … 1341 1351 * @param pDevExt The device extension. 1342 1352 */ 1343 void V BoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)1353 void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt) 1344 1354 { 1345 1355 if (!RTListIsEmpty(&pDevExt->WakeUpList)) … … 1368 1378 { 1369 1379 pWait->fFreeMe = false; 1370 VBoxGuestWaitFreeLocked(pDevExt, pWait);1380 vbgdWaitFreeLocked(pDevExt, pWait); 1371 1381 } 1372 1382 } … … 1375 1385 } 1376 1386 #endif /* VBOXGUEST_USE_DEFERRED_WAKE_UP */ 1377 1378 1379 /**1380 * Modifies the guest capabilities.1381 *1382 * Should be called during driver init and termination.1383 *1384 * @returns VBox status code.1385 * @param fOr The Or mask (what to enable).1386 * @param fNot The Not mask (what to disable).1387 */1388 int VBoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot)1389 {1390 VMMDevReqGuestCapabilities2 *pReq;1391 int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetGuestCapabilities);1392 if (RT_FAILURE(rc))1393 {1394 Log(("VBoxGuestSetGuestCapabilities: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",1395 sizeof(*pReq), sizeof(*pReq), rc));1396 return rc;1397 }1398 1399 pReq->u32OrMask = fOr;1400 pReq->u32NotMask = fNot;1401 1402 rc = VbglGRPerform(&pReq->header);1403 if (RT_FAILURE(rc))1404 Log(("VBoxGuestSetGuestCapabilities: VbglGRPerform failed, rc=%Rrc!\n", rc));1405 1406 VbglGRFree(&pReq->header);1407 return rc;1408 }1409 1387 1410 1388 … … 1419 1397 * @param pSession The session. 1420 1398 */ 1421 int V BoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)1422 { 1423 LogFlow(("V BoxGuestCommonIOCtlFast: iFunction=%#x pDevExt=%p pSession=%p\n", iFunction, pDevExt, pSession));1399 int VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) 1400 { 1401 LogFlow(("VbgdCommonIoCtlFast: iFunction=%#x pDevExt=%p pSession=%p\n", iFunction, pDevExt, pSession)); 1424 1402 1425 1403 NOREF(iFunction); … … 1438 1416 * @param pcbDataReturned (out) contains the number of bytes to return. 1439 1417 */ 1440 static int VBoxGuestCommonIOCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *pInfo, size_t *pcbDataReturned)1441 { 1442 LogFlow(("V BoxGuestCommonIOCtl: GETVMMDEVPORT\n"));1418 static int vbgdIoCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *pInfo, size_t *pcbDataReturned) 1419 { 1420 LogFlow(("VbgdCommonIoCtl: GETVMMDEVPORT\n")); 1443 1421 1444 1422 pInfo->portAddress = pDevExt->IOPortBase; … … 1458 1436 * @param pNotify The new callback information. 1459 1437 */ 1460 int VBoxGuestCommonIOCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify)1461 { 1462 LogFlow(("V BoxGuestCommonIOCtl: SET_MOUSE_NOTIFY_CALLBACK\n"));1438 int vbgdIoCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify) 1439 { 1440 LogFlow(("VbgdCommonIoCtl: SET_MOUSE_NOTIFY_CALLBACK\n")); 1463 1441 1464 1442 RTSpinlockAcquire(pDevExt->EventSpinlock); … … 1471 1449 1472 1450 /** 1473 * Worker VBoxGuestCommonIOCtl_WaitEvent.1451 * Worker vbgdIoCtl_WaitEvent. 1474 1452 * 1475 1453 * The caller enters the spinlock, we leave it. … … 1477 1455 * @returns VINF_SUCCESS if we've left the spinlock and can return immediately. 1478 1456 */ 1479 DECLINLINE(int) WaitEventCheckCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestWaitEventInfo *pInfo,1480 int iEvent, const uint32_t fReqEvents)1457 DECLINLINE(int) vbdgCheckWaitEventCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 1458 VBoxGuestWaitEventInfo *pInfo, int iEvent, const uint32_t fReqEvents) 1481 1459 { 1482 1460 uint32_t fMatches = pDevExt->f32PendingEvents & fReqEvents; … … 1491 1469 pInfo->u32Result = VBOXGUEST_WAITEVENT_OK; 1492 1470 if (fReqEvents & ~((uint32_t)1 << iEvent)) 1493 LogFlow(("V BoxGuestCommonIOCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));1471 LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut)); 1494 1472 else 1495 LogFlow(("V BoxGuestCommonIOCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));1473 LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent)); 1496 1474 pSession->fPendingCancelWaitEvents = false; 1497 1475 return VINF_SUCCESS; … … 1503 1481 1504 1482 1505 static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,1506 1483 static int vbgdIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 1484 VBoxGuestWaitEventInfo *pInfo, size_t *pcbDataReturned, bool fInterruptible) 1507 1485 { 1508 1486 const uint32_t fReqEvents = pInfo->u32EventMaskIn; … … 1523 1501 if (RT_UNLIKELY(iEvent < 0)) 1524 1502 { 1525 LogRel(("V BoxGuestCommonIOCtl: WAITEVENT: Invalid input mask %#x!!\n", fReqEvents));1503 LogRel(("VbgdCommonIoCtl: WAITEVENT: Invalid input mask %#x!!\n", fReqEvents)); 1526 1504 return VERR_INVALID_PARAMETER; 1527 1505 } … … 1531 1509 */ 1532 1510 RTSpinlockAcquire(pDevExt->EventSpinlock); 1533 rc = WaitEventCheckCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);1511 rc = vbdgCheckWaitEventCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents); 1534 1512 if (rc == VINF_SUCCESS) 1535 1513 return rc; … … 1538 1516 { 1539 1517 pInfo->u32Result = VBOXGUEST_WAITEVENT_TIMEOUT; 1540 LogFlow(("V BoxGuestCommonIOCtl: WAITEVENT: returns VERR_TIMEOUT\n"));1518 LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns VERR_TIMEOUT\n")); 1541 1519 return VERR_TIMEOUT; 1542 1520 } 1543 1521 1544 pWait = VBoxGuestWaitAlloc(pDevExt, pSession);1522 pWait = vbgdWaitAlloc(pDevExt, pSession); 1545 1523 if (!pWait) 1546 1524 return VERR_NO_MEMORY; … … 1554 1532 RTSpinlockAcquire(pDevExt->EventSpinlock); 1555 1533 RTListAppend(&pDevExt->WaitList, &pWait->ListNode); 1556 rc = WaitEventCheckCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);1534 rc = vbdgCheckWaitEventCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents); 1557 1535 if (rc == VINF_SUCCESS) 1558 1536 { 1559 VBoxGuestWaitFreeUnlocked(pDevExt, pWait);1537 vbgdWaitFreeUnlocked(pDevExt, pWait); 1560 1538 return rc; 1561 1539 } … … 1581 1559 RTSpinlockAcquire(pDevExt->EventSpinlock); 1582 1560 fResEvents = pWait->fResEvents; 1583 VBoxGuestWaitFreeLocked(pDevExt, pWait);1561 vbgdWaitFreeLocked(pDevExt, pWait); 1584 1562 RTSpinlockRelease(pDevExt->EventSpinlock); 1585 1563 … … 1593 1571 pInfo->u32Result = VBOXGUEST_WAITEVENT_OK; 1594 1572 if (fReqEvents & ~((uint32_t)1 << iEvent)) 1595 LogFlow(("V BoxGuestCommonIOCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));1573 LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut)); 1596 1574 else 1597 LogFlow(("V BoxGuestCommonIOCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));1575 LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent)); 1598 1576 rc = VINF_SUCCESS; 1599 1577 } … … 1603 1581 pInfo->u32Result = VBOXGUEST_WAITEVENT_INTERRUPTED; 1604 1582 rc = VERR_INTERRUPTED; 1605 LogFlow(("V BoxGuestCommonIOCtl: WAITEVENT: returns VERR_INTERRUPTED\n"));1583 LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns VERR_INTERRUPTED\n")); 1606 1584 } 1607 1585 else if (rc == VERR_TIMEOUT) 1608 1586 { 1609 1587 pInfo->u32Result = VBOXGUEST_WAITEVENT_TIMEOUT; 1610 LogFlow(("V BoxGuestCommonIOCtl: WAITEVENT: returns VERR_TIMEOUT (2)\n"));1588 LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns VERR_TIMEOUT (2)\n")); 1611 1589 } 1612 1590 else … … 1614 1592 if (RT_SUCCESS(rc)) 1615 1593 { 1616 LogRelMax(32, ("V BoxGuestCommonIOCtl: WAITEVENT: returns %Rrc but no events!\n", rc));1594 LogRelMax(32, ("VbgdCommonIoCtl: WAITEVENT: returns %Rrc but no events!\n", rc)); 1617 1595 rc = VERR_INTERNAL_ERROR; 1618 1596 } 1619 1597 pInfo->u32Result = VBOXGUEST_WAITEVENT_ERROR; 1620 LogFlow(("V BoxGuestCommonIOCtl: WAITEVENT: returns %Rrc\n", rc));1598 LogFlow(("VbgdCommonIoCtl: WAITEVENT: returns %Rrc\n", rc)); 1621 1599 } 1622 1600 … … 1625 1603 1626 1604 1627 static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)1605 static int vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession) 1628 1606 { 1629 1607 PVBOXGUESTWAIT pWait; … … 1636 1614 bool fCancelledOne = false; 1637 1615 1638 LogFlow(("V BoxGuestCommonIOCtl: CANCEL_ALL_WAITEVENTS\n"));1616 LogFlow(("VbgdCommonIoCtl: CANCEL_ALL_WAITEVENTS\n")); 1639 1617 1640 1618 /* … … 1664 1642 1665 1643 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP 1666 V BoxGuestWaitDoWakeUps(pDevExt);1644 VbgdCommonWaitDoWakeUps(pDevExt); 1667 1645 #endif 1668 1646 … … 1678 1656 * @param pReqHdr The request. 1679 1657 */ 1680 static int VBoxGuestCheckIfVMMReqAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VMMDevRequestType enmType,1681 1658 static int vbgdCheckIfVmmReqIsAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VMMDevRequestType enmType, 1659 VMMDevRequestHeader const *pReqHdr) 1682 1660 { 1683 1661 /* … … 1823 1801 } 1824 1802 1825 static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,1826 1803 static int vbgdIoCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 1804 VMMDevRequestHeader *pReqHdr, size_t cbData, size_t *pcbDataReturned) 1827 1805 { 1828 1806 int rc; … … 1836 1814 const uint32_t cbMinSize = (uint32_t)vmmdevGetRequestSize(enmType); 1837 1815 1838 LogFlow(("V BoxGuestCommonIOCtl: VMMREQUEST type %d\n", pReqHdr->requestType));1816 LogFlow(("VbgdCommonIoCtl: VMMREQUEST type %d\n", pReqHdr->requestType)); 1839 1817 1840 1818 if (cbReq < cbMinSize) 1841 1819 { 1842 LogRel(("V BoxGuestCommonIOCtl: VMMREQUEST: invalid hdr size %#x, expected >= %#x; type=%#x!!\n",1820 LogRel(("VbgdCommonIoCtl: VMMREQUEST: invalid hdr size %#x, expected >= %#x; type=%#x!!\n", 1843 1821 cbReq, cbMinSize, enmType)); 1844 1822 return VERR_INVALID_PARAMETER; … … 1846 1824 if (cbReq > cbData) 1847 1825 { 1848 LogRel(("V BoxGuestCommonIOCtl: VMMREQUEST: invalid size %#x, expected >= %#x (hdr); type=%#x!!\n",1826 LogRel(("VbgdCommonIoCtl: VMMREQUEST: invalid size %#x, expected >= %#x (hdr); type=%#x!!\n", 1849 1827 cbData, cbReq, enmType)); 1850 1828 return VERR_INVALID_PARAMETER; … … 1853 1831 if (RT_FAILURE(rc)) 1854 1832 { 1855 Log(("V BoxGuestCommonIOCtl: VMMREQUEST: invalid header: size %#x, expected >= %#x (hdr); type=%#x; rc=%Rrc!!\n",1833 Log(("VbgdCommonIoCtl: VMMREQUEST: invalid header: size %#x, expected >= %#x (hdr); type=%#x; rc=%Rrc!!\n", 1856 1834 cbData, cbReq, enmType, rc)); 1857 1835 return rc; 1858 1836 } 1859 1837 1860 rc = VBoxGuestCheckIfVMMReqAllowed(pDevExt, pSession, enmType, pReqHdr);1838 rc = vbgdCheckIfVmmReqIsAllowed(pDevExt, pSession, enmType, pReqHdr); 1861 1839 if (RT_FAILURE(rc)) 1862 1840 { 1863 Log(("V BoxGuestCommonIOCtl: VMMREQUEST: Operation not allowed! type=%#x rc=%Rrc\n", enmType, rc));1841 Log(("VbgdCommonIoCtl: VMMREQUEST: Operation not allowed! type=%#x rc=%Rrc\n", enmType, rc)); 1864 1842 return rc; 1865 1843 } … … 1875 1853 if (RT_FAILURE(rc)) 1876 1854 { 1877 Log(("V BoxGuestCommonIOCtl: VMMREQUEST: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",1855 Log(("VbgdCommonIoCtl: VMMREQUEST: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n", 1878 1856 cbReq, cbReq, rc)); 1879 1857 return rc; … … 1896 1874 } 1897 1875 else if (RT_FAILURE(rc)) 1898 Log(("V BoxGuestCommonIOCtl: VMMREQUEST: VbglGRPerform - rc=%Rrc!\n", rc));1876 Log(("VbgdCommonIoCtl: VMMREQUEST: VbglGRPerform - rc=%Rrc!\n", rc)); 1899 1877 else 1900 1878 { 1901 Log(("V BoxGuestCommonIOCtl: VMMREQUEST: request execution failed; VMMDev rc=%Rrc!\n", pReqCopy->rc));1879 Log(("VbgdCommonIoCtl: VMMREQUEST: request execution failed; VMMDev rc=%Rrc!\n", pReqCopy->rc)); 1902 1880 rc = pReqCopy->rc; 1903 1881 } … … 1912 1890 AssertCompile(RT_INDEFINITE_WAIT == (uint32_t)RT_INDEFINITE_WAIT); /* assumed by code below */ 1913 1891 1914 /** Worker for VBoxGuestHGCMAsyncWaitCallback*. */1915 static int VBoxGuestHGCMAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHdr, PVBOXGUESTDEVEXT pDevExt,1916 1892 /** Worker for vbgdHgcmAsyncWaitCallback*. */ 1893 static int vbgdHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHdr, PVBOXGUESTDEVEXT pDevExt, 1894 bool fInterruptible, uint32_t cMillies) 1917 1895 { 1918 1896 int rc; … … 1936 1914 RTSpinlockRelease(pDevExt->EventSpinlock); 1937 1915 1938 pWait = VBoxGuestWaitAlloc(pDevExt, NULL);1916 pWait = vbgdWaitAlloc(pDevExt, NULL); 1939 1917 if (pWait) 1940 1918 break; … … 1955 1933 if ((pHdr->fu32Flags & VBOX_HGCM_REQ_DONE) != 0) 1956 1934 { 1957 VBoxGuestWaitFreeLocked(pDevExt, pWait);1935 vbgdWaitFreeLocked(pDevExt, pWait); 1958 1936 RTSpinlockRelease(pDevExt->EventSpinlock); 1959 1937 return VINF_SUCCESS; … … 1975 1953 && ( !fInterruptible 1976 1954 || rc != VERR_INTERRUPTED)) 1977 LogRel((" VBoxGuestHGCMAsyncWaitCallback: wait failed! %Rrc\n", rc));1978 1979 VBoxGuestWaitFreeUnlocked(pDevExt, pWait);1955 LogRel(("vbgdHgcmAsyncWaitCallback: wait failed! %Rrc\n", rc)); 1956 1957 vbgdWaitFreeUnlocked(pDevExt, pWait); 1980 1958 return rc; 1981 1959 } … … 1985 1963 * This is a callback for dealing with async waits. 1986 1964 * 1987 * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent.1988 */ 1989 static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)1965 * It operates in a manner similar to vbgdIoCtl_WaitEvent. 1966 */ 1967 static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User) 1990 1968 { 1991 1969 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser; 1992 LogFlow(("VBoxGuestHGCMAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType)); 1993 return VBoxGuestHGCMAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, 1994 pDevExt, 1995 false /* fInterruptible */, 1996 u32User /* cMillies */); 1970 LogFlow(("vbgdHgcmAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType)); 1971 return vbgdHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt, 1972 false /* fInterruptible */, u32User /* cMillies */); 1997 1973 } 1998 1974 … … 2001 1977 * This is a callback for dealing with async waits with a timeout. 2002 1978 * 2003 * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent. 2004 */ 2005 static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallbackInterruptible(VMMDevHGCMRequestHeader *pHdr, 2006 void *pvUser, uint32_t u32User) 1979 * It operates in a manner similar to vbgdIoCtl_WaitEvent. 1980 */ 1981 static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallbackInterruptible(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User) 2007 1982 { 2008 1983 PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser; 2009 LogFlow(("VBoxGuestHGCMAsyncWaitCallbackInterruptible: requestType=%d\n", pHdr->header.requestType)); 2010 return VBoxGuestHGCMAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, 2011 pDevExt, 2012 true /* fInterruptible */, 2013 u32User /* cMillies */ ); 2014 } 2015 2016 2017 static int VBoxGuestCommonIOCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 2018 VBoxGuestHGCMConnectInfo *pInfo, size_t *pcbDataReturned) 1984 LogFlow(("vbgdHgcmAsyncWaitCallbackInterruptible: requestType=%d\n", pHdr->header.requestType)); 1985 return vbgdHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt, 1986 true /* fInterruptible */, u32User /* cMillies */); 1987 } 1988 1989 1990 static int vbgdIoCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 1991 VBoxGuestHGCMConnectInfo *pInfo, size_t *pcbDataReturned) 2019 1992 { 2020 1993 int rc; … … 2025 1998 * to deal with cancelled requests. 2026 1999 */ 2027 Log(("V BoxGuestCommonIOCtl: HGCM_CONNECT: %.128s\n",2000 Log(("VbgdCommonIoCtl: HGCM_CONNECT: %.128s\n", 2028 2001 pInfo->Loc.type == VMMDevHGCMLoc_LocalHost || pInfo->Loc.type == VMMDevHGCMLoc_LocalHost_Existing 2029 2002 ? pInfo->Loc.u.host.achName : "<not local host>")); 2030 2003 2031 rc = VbglR0HGCMInternalConnect(pInfo, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);2004 rc = VbglR0HGCMInternalConnect(pInfo, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT); 2032 2005 if (RT_SUCCESS(rc)) 2033 2006 { 2034 Log(("V BoxGuestCommonIOCtl: HGCM_CONNECT: u32Client=%RX32 result=%Rrc (rc=%Rrc)\n",2007 Log(("VbgdCommonIoCtl: HGCM_CONNECT: u32Client=%RX32 result=%Rrc (rc=%Rrc)\n", 2035 2008 pInfo->u32ClientID, pInfo->result, rc)); 2036 2009 if (RT_SUCCESS(pInfo->result)) … … 2052 2025 { 2053 2026 VBoxGuestHGCMDisconnectInfo Info; 2054 LogRelMax(32, ("V BoxGuestCommonIOCtl: HGCM_CONNECT: too many HGCMConnect calls for one session!\n"));2027 LogRelMax(32, ("VbgdCommonIoCtl: HGCM_CONNECT: too many HGCMConnect calls for one session!\n")); 2055 2028 Info.result = 0; 2056 2029 Info.u32ClientID = pInfo->u32ClientID; 2057 VbglR0HGCMInternalDisconnect(&Info, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);2030 VbglR0HGCMInternalDisconnect(&Info, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT); 2058 2031 return VERR_TOO_MANY_OPEN_FILES; 2059 2032 } … … 2068 2041 2069 2042 2070 static int VBoxGuestCommonIOCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestHGCMDisconnectInfo *pInfo,2071 2043 static int vbgdIoCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 2044 VBoxGuestHGCMDisconnectInfo *pInfo, size_t *pcbDataReturned) 2072 2045 { 2073 2046 /* … … 2087 2060 if (i >= RT_ELEMENTS(pSession->aHGCMClientIds)) 2088 2061 { 2089 LogRelMax(32, ("V BoxGuestCommonIOCtl: HGCM_DISCONNECT: u32Client=%RX32\n", u32ClientId));2062 LogRelMax(32, ("VbgdCommonIoCtl: HGCM_DISCONNECT: u32Client=%RX32\n", u32ClientId)); 2090 2063 return VERR_INVALID_HANDLE; 2091 2064 } … … 2096 2069 * to deal with cancelled requests. 2097 2070 */ 2098 Log(("V BoxGuestCommonIOCtl: HGCM_DISCONNECT: u32Client=%RX32\n", pInfo->u32ClientID));2099 rc = VbglR0HGCMInternalDisconnect(pInfo, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);2071 Log(("VbgdCommonIoCtl: HGCM_DISCONNECT: u32Client=%RX32\n", pInfo->u32ClientID)); 2072 rc = VbglR0HGCMInternalDisconnect(pInfo, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT); 2100 2073 if (RT_SUCCESS(rc)) 2101 2074 { 2102 LogFlow(("V BoxGuestCommonIOCtl: HGCM_DISCONNECT: result=%Rrc\n", pInfo->result));2075 LogFlow(("VbgdCommonIoCtl: HGCM_DISCONNECT: result=%Rrc\n", pInfo->result)); 2103 2076 if (pcbDataReturned) 2104 2077 *pcbDataReturned = sizeof(*pInfo); … … 2115 2088 2116 2089 2117 static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt, 2118 PVBOXGUESTSESSION pSession, 2119 VBoxGuestHGCMCallInfo *pInfo, 2120 uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData, 2121 size_t cbExtra, size_t cbData, size_t *pcbDataReturned) 2090 static int vbgdIoCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestHGCMCallInfo *pInfo, 2091 uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData, 2092 size_t cbExtra, size_t cbData, size_t *pcbDataReturned) 2122 2093 { 2123 2094 const uint32_t u32ClientId = pInfo->u32ClientID; … … 2132 2103 if (pInfo->cParms > 4096) /* (Just make sure it doesn't overflow the next check.) */ 2133 2104 { 2134 LogRel(("V BoxGuestCommonIOCtl: HGCM_CALL: cParm=%RX32 is not sane\n", pInfo->cParms));2105 LogRel(("VbgdCommonIoCtl: HGCM_CALL: cParm=%RX32 is not sane\n", pInfo->cParms)); 2135 2106 return VERR_INVALID_PARAMETER; 2136 2107 } … … 2145 2116 if (cbData < cbActual) 2146 2117 { 2147 LogRel(("V BoxGuestCommonIOCtl: HGCM_CALL: cbData=%#zx (%zu) required size is %#zx (%zu)\n",2118 LogRel(("VbgdCommonIoCtl: HGCM_CALL: cbData=%#zx (%zu) required size is %#zx (%zu)\n", 2148 2119 cbData, cbData, cbActual, cbActual)); 2149 2120 return VERR_INVALID_PARAMETER; … … 2160 2131 if (RT_UNLIKELY(i >= RT_ELEMENTS(pSession->aHGCMClientIds))) 2161 2132 { 2162 LogRelMax(32, ("V BoxGuestCommonIOCtl: HGCM_CALL: Invalid handle. u32Client=%RX32\n", u32ClientId));2133 LogRelMax(32, ("VbgdCommonIoCtl: HGCM_CALL: Invalid handle. u32Client=%RX32\n", u32ClientId)); 2163 2134 return VERR_INVALID_HANDLE; 2164 2135 } … … 2170 2141 * be interruptible (should add a flag for this later I guess). 2171 2142 */ 2172 LogFlow(("V BoxGuestCommonIOCtl: HGCM_CALL: u32Client=%RX32\n", pInfo->u32ClientID));2143 LogFlow(("VbgdCommonIoCtl: HGCM_CALL: u32Client=%RX32\n", pInfo->u32ClientID)); 2173 2144 fFlags = !fUserData && pSession->R0Process == NIL_RTR0PROCESS ? VBGLR0_HGCMCALL_F_KERNEL : VBGLR0_HGCMCALL_F_USER; 2174 2145 uint32_t cbInfo = (uint32_t)(cbData - cbExtra); … … 2177 2148 { 2178 2149 if (fInterruptible) 2179 rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallbackInterruptible, pDevExt, cMillies);2150 rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies); 2180 2151 else 2181 rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallback, pDevExt, cMillies);2152 rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallback, pDevExt, cMillies); 2182 2153 } 2183 2154 else … … 2185 2156 { 2186 2157 if (fInterruptible) 2187 rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallbackInterruptible, pDevExt, cMillies);2158 rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies); 2188 2159 else 2189 rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallback, pDevExt, cMillies);2160 rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallback, pDevExt, cMillies); 2190 2161 } 2191 2162 if (RT_SUCCESS(rc)) 2192 2163 { 2193 LogFlow(("V BoxGuestCommonIOCtl: HGCM_CALL: result=%Rrc\n", pInfo->result));2164 LogFlow(("VbgdCommonIoCtl: HGCM_CALL: result=%Rrc\n", pInfo->result)); 2194 2165 if (pcbDataReturned) 2195 2166 *pcbDataReturned = cbActual; … … 2199 2170 if ( rc != VERR_INTERRUPTED 2200 2171 && rc != VERR_TIMEOUT) 2201 LogRelMax(32, ("V BoxGuestCommonIOCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));2172 LogRelMax(32, ("VbgdCommonIoCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc)); 2202 2173 else 2203 Log(("V BoxGuestCommonIOCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));2174 Log(("VbgdCommonIoCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc)); 2204 2175 } 2205 2176 return rc; … … 2223 2194 * be NULL. 2224 2195 */ 2225 static int VBoxGuestCommonIOCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,2226 2196 static int vbgdIoCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 2197 VBoxGuestCheckBalloonInfo *pInfo, size_t *pcbDataReturned) 2227 2198 { 2228 2199 VMMDevGetMemBalloonChangeRequest *pReq; 2229 2200 int rc; 2230 2201 2231 LogFlow(("V BoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON\n"));2202 LogFlow(("VbgdCommonIoCtl: CHECK_MEMORY_BALLOON\n")); 2232 2203 rc = RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx); 2233 2204 AssertRCReturn(rc, rc); … … 2235 2206 /* 2236 2207 * The first user trying to query/change the balloon becomes the 2237 * owner and owns it until the session is closed (vb oxGuestCloseMemBalloon).2208 * owner and owns it until the session is closed (vbgdCloseMemBalloon). 2238 2209 */ 2239 2210 if ( pDevExt->MemBalloon.pOwner != pSession … … 2261 2232 pInfo->fHandleInR3 = false; 2262 2233 2263 rc = vb oxGuestSetBalloonSizeKernel(pDevExt, pReq->cBalloonChunks, &pInfo->fHandleInR3);2234 rc = vbgdSetBalloonSizeKernel(pDevExt, pReq->cBalloonChunks, &pInfo->fHandleInR3); 2264 2235 /* Ignore various out of memory failures. */ 2265 2236 if ( rc == VERR_NO_MEMORY … … 2272 2243 } 2273 2244 else 2274 LogRel(("V BoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON: VbglGRPerform failed. rc=%Rrc\n", rc));2245 LogRel(("VbgdCommonIoCtl: CHECK_MEMORY_BALLOON: VbglGRPerform failed. rc=%Rrc\n", rc)); 2275 2246 VbglGRFree(&pReq->header); 2276 2247 } … … 2280 2251 2281 2252 RTSemFastMutexRelease(pDevExt->MemBalloon.hMtx); 2282 LogFlow(("V BoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON returns %Rrc\n", rc));2253 LogFlow(("VbgdCommonIoCtl: CHECK_MEMORY_BALLOON returns %Rrc\n", rc)); 2283 2254 return rc; 2284 2255 } … … 2296 2267 * be NULL. 2297 2268 */ 2298 static int VBoxGuestCommonIOCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,2299 2269 static int vbgdIoCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 2270 VBoxGuestChangeBalloonInfo *pInfo, size_t *pcbDataReturned) 2300 2271 { 2301 2272 int rc; 2302 2273 2303 LogFlow(("V BoxGuestCommonIOCtl: CHANGE_BALLOON\n"));2274 LogFlow(("VbgdCommonIoCtl: CHANGE_BALLOON\n")); 2304 2275 rc = RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx); 2305 2276 AssertRCReturn(rc, rc); … … 2309 2280 /* 2310 2281 * The first user trying to query/change the balloon becomes the 2311 * owner and owns it until the session is closed (vb oxGuestCloseMemBalloon).2282 * owner and owns it until the session is closed (vbgdCloseMemBalloon). 2312 2283 */ 2313 2284 if ( pDevExt->MemBalloon.pOwner != pSession … … 2317 2288 if (pDevExt->MemBalloon.pOwner == pSession) 2318 2289 { 2319 rc = vb oxGuestSetBalloonSizeFromUser(pDevExt, pSession, pInfo->u64ChunkAddr, !!pInfo->fInflate);2290 rc = vbgdSetBalloonSizeFromUser(pDevExt, pSession, pInfo->u64ChunkAddr, !!pInfo->fInflate); 2320 2291 if (pcbDataReturned) 2321 2292 *pcbDataReturned = 0; … … 2340 2311 * @param pInfo The output buffer. 2341 2312 */ 2342 static int VBoxGuestCommonIOCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo)2313 static int vbgdIoCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo) 2343 2314 { 2344 2315 VMMDevReqWriteCoreDump *pReq = NULL; 2345 2316 int rc; 2346 2317 2347 LogFlow(("V BoxGuestCommonIOCtl: WRITE_CORE_DUMP\n"));2318 LogFlow(("VbgdCommonIoCtl: WRITE_CORE_DUMP\n")); 2348 2319 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_WriteCoreDump); 2349 2320 if (RT_FAILURE(rc)) 2350 2321 { 2351 Log(("V BoxGuestCommonIOCtl: WRITE_CORE_DUMP: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",2322 Log(("VbgdCommonIoCtl: WRITE_CORE_DUMP: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n", 2352 2323 sizeof(*pReq), sizeof(*pReq), rc)); 2353 2324 return rc; … … 2357 2328 rc = VbglGRPerform(&pReq->header); 2358 2329 if (RT_FAILURE(rc)) 2359 Log(("V BoxGuestCommonIOCtl: WRITE_CORE_DUMP: VbglGRPerform failed, rc=%Rrc!\n", rc));2330 Log(("VbgdCommonIoCtl: WRITE_CORE_DUMP: VbglGRPerform failed, rc=%Rrc!\n", rc)); 2360 2331 2361 2332 VbglGRFree(&pReq->header); … … 2374 2345 * @param pcbDataReturned Where to store the amount of returned data. Can be NULL. 2375 2346 */ 2376 static int VBoxGuestCommonIOCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned, bool fUserSession)2347 static int vbgdIoCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned, bool fUserSession) 2377 2348 { 2378 2349 NOREF(pch); 2379 2350 NOREF(cbData); 2380 RTAssertMsg2Weak("\nVBoxGuestCommonIOCtl_Log: cbData=%#x\n", cbData);2381 2351 if (pDevExt->fLoggingEnabled) 2382 2352 RTLogBackdoorPrintf("%.*s", cbData, pch); … … 2633 2603 * @param pInfo The request. 2634 2604 */ 2635 static int VBoxGuestCommonIOCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 2636 VBoxGuestFilterMaskInfo *pInfo) 2637 { 2638 LogFlow(("VBoxGuestCommonIOCtl: CTL_FILTER_MASK or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask)); 2605 static int vbgdIoCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestFilterMaskInfo *pInfo) 2606 { 2607 LogFlow(("VbgdCommonIoCtl: CTL_FILTER_MASK or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask)); 2639 2608 2640 2609 if ((pInfo->u32OrMask | pInfo->u32NotMask) & ~VMMDEV_EVENT_VALID_EVENT_MASK) 2641 2610 { 2642 Log(("V BoxGuestCommonIOCtl: CTL_FILTER_MASK or=%#x not=%#x: Invalid masks!\n", pInfo->u32OrMask, pInfo->u32NotMask));2611 Log(("VbgdCommonIoCtl: CTL_FILTER_MASK or=%#x not=%#x: Invalid masks!\n", pInfo->u32OrMask, pInfo->u32NotMask)); 2643 2612 return VERR_INVALID_PARAMETER; 2644 2613 } … … 2786 2755 * @param fFeatures New bitmap of enabled features. 2787 2756 */ 2788 static int vb oxGuestCommonIOCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fFeatures)2757 static int vbgdIoCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fFeatures) 2789 2758 { 2790 2759 int rc; 2791 LogFlow(("V BoxGuestCommonIOCtl: CTL_FILTER_MASK features=%#x\n", fFeatures));2760 LogFlow(("VbgdCommonIoCtl: CTL_FILTER_MASK features=%#x\n", fFeatures)); 2792 2761 2793 2762 if (fFeatures & ~VMMDEV_MOUSE_GUEST_MASK) … … 3073 3042 3074 3043 RTSpinlockRelease(pDevExt->EventSpinlock); 3075 LogRel(("vbgdAcquireSessionCapabilities: VBoxGuestSetGuestCapabilitiesfailed: rc=%Rrc\n", rc));3044 LogRel(("vbgdAcquireSessionCapabilities: vbgdUpdateCapabilitiesOnHostWithReqAndLock failed: rc=%Rrc\n", rc)); 3076 3045 VbglGRFree(&pReq->header); 3077 3046 return rc; … … 3115 3084 3116 3085 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP 3117 V BoxGuestWaitDoWakeUps(pDevExt);3086 VbgdCommonWaitDoWakeUps(pDevExt); 3118 3087 #endif 3119 3088 } … … 3132 3101 * @param pAcquire The request. 3133 3102 */ 3134 static int VBoxGuestCommonIOCTL_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 3135 VBoxGuestCapsAquire *pAcquire) 3103 static int vbgdIoCtl_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestCapsAquire *pAcquire) 3136 3104 { 3137 3105 int rc; 3138 LogFlow(("V BoxGuestCommonIOCtl: GUEST_CAPS_ACQUIRE or=%#x not=%#x flags=%#x\n",3106 LogFlow(("VbgdCommonIoCtl: GUEST_CAPS_ACQUIRE or=%#x not=%#x flags=%#x\n", 3139 3107 pAcquire->u32OrMask, pAcquire->u32NotMask, pAcquire->enmFlags)); 3140 3108 … … 3142 3110 false /*fSessionTermination*/); 3143 3111 if (RT_FAILURE(rc)) 3144 LogRel(("V BoxGuestCommonIOCtl: GUEST_CAPS_ACQUIRE failed rc=%Rrc\n", rc));3112 LogRel(("VbgdCommonIoCtl: GUEST_CAPS_ACQUIRE failed rc=%Rrc\n", rc)); 3145 3113 pAcquire->rc = rc; 3146 3114 return VINF_SUCCESS; … … 3251 3219 * @param pInfo The request. 3252 3220 */ 3253 static int VBoxGuestCommonIOCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 3254 VBoxGuestSetCapabilitiesInfo *pInfo) 3221 static int vbgdIoCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestSetCapabilitiesInfo *pInfo) 3255 3222 { 3256 3223 int rc; 3257 LogFlow(("V BoxGuestCommonIOCtl: SET_GUEST_CAPABILITIES or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));3224 LogFlow(("VbgdCommonIoCtl: SET_GUEST_CAPABILITIES or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask)); 3258 3225 3259 3226 if (!((pInfo->u32OrMask | pInfo->u32NotMask) & ~VMMDEV_GUEST_CAPABILITIES_MASK)) … … 3283 3250 * @param pcbDataReturned Where to store the amount of returned data. Can be NULL. 3284 3251 */ 3285 int V BoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,3286 3252 int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 3253 void *pvData, size_t cbData, size_t *pcbDataReturned) 3287 3254 { 3288 3255 int rc; 3289 LogFlow(("V BoxGuestCommonIOCtl: iFunction=%#x pDevExt=%p pSession=%p pvData=%p cbData=%zu\n",3256 LogFlow(("VbgdCommonIoCtl: iFunction=%#x pDevExt=%p pSession=%p pvData=%p cbData=%zu\n", 3290 3257 iFunction, pDevExt, pSession, pvData, cbData)); 3291 3258 … … 3345 3312 { 3346 3313 CHECKRET_MIN_SIZE("VMMREQUEST", sizeof(VMMDevRequestHeader)); 3347 rc = VBoxGuestCommonIOCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned);3314 rc = vbgdIoCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned); 3348 3315 } 3349 3316 #ifdef VBOX_WITH_HGCM … … 3355 3322 bool fInterruptible = pSession->R0Process != NIL_RTR0PROCESS; 3356 3323 CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo)); 3357 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,3358 3359 3324 rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT, 3325 fInterruptible, false /*f32bit*/, false /* fUserData */, 3326 0, cbData, pcbDataReturned); 3360 3327 } 3361 3328 else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED(0))) … … 3363 3330 VBoxGuestHGCMCallInfoTimed *pInfo = (VBoxGuestHGCMCallInfoTimed *)pvData; 3364 3331 CHECKRET_MIN_SIZE("HGCM_CALL_TIMED", sizeof(VBoxGuestHGCMCallInfoTimed)); 3365 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,3366 3367 3368 3332 rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout, 3333 !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS, 3334 false /*f32bit*/, false /* fUserData */, 3335 RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned); 3369 3336 } 3370 3337 else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(0))) … … 3372 3339 bool fInterruptible = true; 3373 3340 CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo)); 3374 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,3375 3376 3341 rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT, 3342 fInterruptible, false /*f32bit*/, true /* fUserData */, 3343 0, cbData, pcbDataReturned); 3377 3344 } 3378 3345 # ifdef RT_ARCH_AMD64 … … 3381 3348 bool fInterruptible = pSession->R0Process != NIL_RTR0PROCESS; 3382 3349 CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo)); 3383 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,3384 3385 3350 rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT, 3351 fInterruptible, true /*f32bit*/, false /* fUserData */, 3352 0, cbData, pcbDataReturned); 3386 3353 } 3387 3354 else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(0))) … … 3389 3356 CHECKRET_MIN_SIZE("HGCM_CALL_TIMED", sizeof(VBoxGuestHGCMCallInfoTimed)); 3390 3357 VBoxGuestHGCMCallInfoTimed *pInfo = (VBoxGuestHGCMCallInfoTimed *)pvData; 3391 rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,3392 3393 3394 3358 rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout, 3359 !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS, 3360 true /*f32bit*/, false /* fUserData */, 3361 RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned); 3395 3362 } 3396 3363 # endif … … 3399 3366 { 3400 3367 CHECKRET_MIN_SIZE("LOG", 1); 3401 rc = VBoxGuestCommonIOCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned, pSession->fUserSession);3368 rc = vbgdIoCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned, pSession->fUserSession); 3402 3369 } 3403 3370 else … … 3408 3375 CHECKRET_RING0("GETVMMDEVPORT"); 3409 3376 CHECKRET_MIN_SIZE("GETVMMDEVPORT", sizeof(VBoxGuestPortInfo)); 3410 rc = VBoxGuestCommonIOCtl_GetVMMDevPort(pDevExt, (VBoxGuestPortInfo *)pvData, pcbDataReturned);3377 rc = vbgdIoCtl_GetVMMDevPort(pDevExt, (VBoxGuestPortInfo *)pvData, pcbDataReturned); 3411 3378 break; 3412 3379 … … 3415 3382 CHECKRET_RING0("SET_MOUSE_NOTIFY_CALLBACK"); 3416 3383 CHECKRET_SIZE("SET_MOUSE_NOTIFY_CALLBACK", sizeof(VBoxGuestMouseSetNotifyCallback)); 3417 rc = VBoxGuestCommonIOCtl_SetMouseNotifyCallback(pDevExt, (VBoxGuestMouseSetNotifyCallback *)pvData);3384 rc = vbgdIoCtl_SetMouseNotifyCallback(pDevExt, (VBoxGuestMouseSetNotifyCallback *)pvData); 3418 3385 break; 3419 3386 #endif … … 3421 3388 case VBOXGUEST_IOCTL_WAITEVENT: 3422 3389 CHECKRET_MIN_SIZE("WAITEVENT", sizeof(VBoxGuestWaitEventInfo)); 3423 rc = VBoxGuestCommonIOCtl_WaitEvent(pDevExt, pSession, (VBoxGuestWaitEventInfo *)pvData,3390 rc = vbgdIoCtl_WaitEvent(pDevExt, pSession, (VBoxGuestWaitEventInfo *)pvData, 3424 3391 pcbDataReturned, pSession->R0Process != NIL_RTR0PROCESS); 3425 3392 break; … … 3428 3395 if (cbData != 0) 3429 3396 rc = VERR_INVALID_PARAMETER; 3430 rc = VBoxGuestCommonIOCtl_CancelAllWaitEvents(pDevExt, pSession);3397 rc = vbgdIoCtl_CancelAllWaitEvents(pDevExt, pSession); 3431 3398 break; 3432 3399 3433 3400 case VBOXGUEST_IOCTL_CTL_FILTER_MASK: 3434 3401 CHECKRET_MIN_SIZE("CTL_FILTER_MASK", sizeof(VBoxGuestFilterMaskInfo)); 3435 rc = VBoxGuestCommonIOCtl_CtlFilterMask(pDevExt, pSession, (VBoxGuestFilterMaskInfo *)pvData);3402 rc = vbgdIoCtl_CtlFilterMask(pDevExt, pSession, (VBoxGuestFilterMaskInfo *)pvData); 3436 3403 break; 3437 3404 … … 3442 3409 # endif 3443 3410 CHECKRET_MIN_SIZE("HGCM_CONNECT", sizeof(VBoxGuestHGCMConnectInfo)); 3444 rc = VBoxGuestCommonIOCtl_HGCMConnect(pDevExt, pSession, (VBoxGuestHGCMConnectInfo *)pvData, pcbDataReturned);3411 rc = vbgdIoCtl_HGCMConnect(pDevExt, pSession, (VBoxGuestHGCMConnectInfo *)pvData, pcbDataReturned); 3445 3412 break; 3446 3413 … … 3450 3417 # endif 3451 3418 CHECKRET_MIN_SIZE("HGCM_DISCONNECT", sizeof(VBoxGuestHGCMDisconnectInfo)); 3452 rc = VBoxGuestCommonIOCtl_HGCMDisconnect(pDevExt, pSession, (VBoxGuestHGCMDisconnectInfo *)pvData, 3453 pcbDataReturned); 3419 rc = vbgdIoCtl_HGCMDisconnect(pDevExt, pSession, (VBoxGuestHGCMDisconnectInfo *)pvData, pcbDataReturned); 3454 3420 break; 3455 3421 #endif /* VBOX_WITH_HGCM */ … … 3457 3423 case VBOXGUEST_IOCTL_CHECK_BALLOON: 3458 3424 CHECKRET_MIN_SIZE("CHECK_MEMORY_BALLOON", sizeof(VBoxGuestCheckBalloonInfo)); 3459 rc = VBoxGuestCommonIOCtl_CheckMemoryBalloon(pDevExt, pSession, (VBoxGuestCheckBalloonInfo *)pvData, 3460 pcbDataReturned); 3425 rc = vbgdIoCtl_CheckMemoryBalloon(pDevExt, pSession, (VBoxGuestCheckBalloonInfo *)pvData, pcbDataReturned); 3461 3426 break; 3462 3427 3463 3428 case VBOXGUEST_IOCTL_CHANGE_BALLOON: 3464 3429 CHECKRET_MIN_SIZE("CHANGE_MEMORY_BALLOON", sizeof(VBoxGuestChangeBalloonInfo)); 3465 rc = VBoxGuestCommonIOCtl_ChangeMemoryBalloon(pDevExt, pSession, (VBoxGuestChangeBalloonInfo *)pvData, 3466 pcbDataReturned); 3430 rc = vbgdIoCtl_ChangeMemoryBalloon(pDevExt, pSession, (VBoxGuestChangeBalloonInfo *)pvData, pcbDataReturned); 3467 3431 break; 3468 3432 3469 3433 case VBOXGUEST_IOCTL_WRITE_CORE_DUMP: 3470 3434 CHECKRET_MIN_SIZE("WRITE_CORE_DUMP", sizeof(VBoxGuestWriteCoreDump)); 3471 rc = VBoxGuestCommonIOCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);3435 rc = vbgdIoCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData); 3472 3436 break; 3473 3437 3474 3438 case VBOXGUEST_IOCTL_SET_MOUSE_STATUS: 3475 3439 CHECKRET_SIZE("SET_MOUSE_STATUS", sizeof(uint32_t)); 3476 rc = vb oxGuestCommonIOCtl_SetMouseStatus(pDevExt, pSession, *(uint32_t *)pvData);3440 rc = vbgdIoCtl_SetMouseStatus(pDevExt, pSession, *(uint32_t *)pvData); 3477 3441 break; 3478 3442 … … 3486 3450 case VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE: 3487 3451 CHECKRET_SIZE("GUEST_CAPS_ACQUIRE", sizeof(VBoxGuestCapsAquire)); 3488 rc = VBoxGuestCommonIOCTL_GuestCapsAcquire(pDevExt, pSession, (VBoxGuestCapsAquire*)pvData);3452 rc = vbgdIoCtl_GuestCapsAcquire(pDevExt, pSession, (VBoxGuestCapsAquire *)pvData); 3489 3453 *pcbDataReturned = sizeof(VBoxGuestCapsAquire); 3490 3454 break; … … 3492 3456 case VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES: 3493 3457 CHECKRET_MIN_SIZE("SET_GUEST_CAPABILITIES", sizeof(VBoxGuestSetCapabilitiesInfo)); 3494 rc = VBoxGuestCommonIOCtl_SetCapabilities(pDevExt, pSession, (VBoxGuestSetCapabilitiesInfo *)pvData);3458 rc = vbgdIoCtl_SetCapabilities(pDevExt, pSession, (VBoxGuestSetCapabilitiesInfo *)pvData); 3495 3459 break; 3496 3460 3497 3461 default: 3498 3462 { 3499 LogRel(("V BoxGuestCommonIOCtl: Unknown request iFunction=%#x stripped size=%#x\n",3463 LogRel(("VbgdCommonIoCtl: Unknown request iFunction=%#x stripped size=%#x\n", 3500 3464 iFunction, VBOXGUEST_IOCTL_STRIP_SIZE(iFunction))); 3501 3465 rc = VERR_NOT_SUPPORTED; … … 3505 3469 } 3506 3470 3507 LogFlow(("V BoxGuestCommonIOCtl: returns %Rrc *pcbDataReturned=%zu\n", rc, pcbDataReturned ? *pcbDataReturned : 0));3471 LogFlow(("VbgdCommonIoCtl: returns %Rrc *pcbDataReturned=%zu\n", rc, pcbDataReturned ? *pcbDataReturned : 0)); 3508 3472 return rc; 3509 3473 } … … 3511 3475 3512 3476 /** 3513 * Used by V BoxGuestCommonISR as well as the acquire guest capability code.3477 * Used by VbgdCommonISR as well as the acquire guest capability code. 3514 3478 * 3515 3479 * @returns VINF_SUCCESS on success. On failure, ORed together … … 3566 3530 * @param pDevExt The VBoxGuest device extension. 3567 3531 */ 3568 bool V BoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt)3569 { 3570 bool fMousePositionChanged = false;3571 VMMDevEvents volatile *pReq = pDevExt->pIrqAckEvents;3572 int 3573 bool 3532 bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt) 3533 { 3534 VMMDevEvents volatile *pReq = pDevExt->pIrqAckEvents; 3535 bool fMousePositionChanged = false; 3536 int rc = 0; 3537 bool fOurIrq; 3574 3538 3575 3539 /* … … 3601 3565 PVBOXGUESTWAIT pSafe; 3602 3566 3603 Log3(("V BoxGuestCommonISR: acknowledge events succeeded %#RX32\n", fEvents));3567 Log3(("VbgdCommonISR: acknowledge events succeeded %#RX32\n", fEvents)); 3604 3568 3605 3569 /* … … 3646 3610 } 3647 3611 else /* something is serious wrong... */ 3648 Log(("V BoxGuestCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n",3612 Log(("VbgdCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n", 3649 3613 pReq->header.rc, pReq->events)); 3650 3614 } 3651 3615 else 3652 Log3(("V BoxGuestCommonISR: not ours\n"));3616 Log3(("VbgdCommonISR: not ours\n")); 3653 3617 3654 3618 RTSpinlockRelease(pDevExt->EventSpinlock); … … 3660 3624 * care of it. Same on darwin, doing it in the work loop callback. 3661 3625 */ 3662 V BoxGuestWaitDoWakeUps(pDevExt);3626 VbgdCommonWaitDoWakeUps(pDevExt); 3663 3627 #endif 3664 3628 … … 3670 3634 { 3671 3635 ASMAtomicIncU32(&pDevExt->u32MousePosChangedSeq); 3672 V BoxGuestNativeISRMousePollEvent(pDevExt);3636 VbgdNativeISRMousePollEvent(pDevExt); 3673 3637 } 3674 3638 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp
r41722 r54608 5 5 6 6 /* 7 * Copyright (C) 2011-201 2Oracle Corporation7 * Copyright (C) 2011-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.h
r41722 r54608 5 5 6 6 /* 7 * Copyright (C) 2010-201 2Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm
r48665 r54608 5 5 6 6 ; 7 ; Copyright (C) 2007-201 3Oracle Corporation7 ; Copyright (C) 2007-2015 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h
r45372 r54608 7 7 8 8 /* 9 * Copyright (C) 2006-201 3Oracle Corporation9 * Copyright (C) 2006-2015 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 69 69 #endif 70 70 71 rc = V BoxGuestCreateKernelSession(&g_DevExt, &pSession);71 rc = VbgdCommonCreateKernelSession(&g_DevExt, &pSession); 72 72 if (RT_SUCCESS(rc)) 73 73 { … … 89 89 #endif 90 90 91 LogRel(("VBoxGuestIDCOpen: V BoxGuestCreateKernelSession failed. rc=%d\n", rc));91 LogRel(("VBoxGuestIDCOpen: VbgdCommonCreateKernelSession failed. rc=%d\n", rc)); 92 92 return NULL; 93 93 } … … 106 106 107 107 AssertPtrReturn(pSession, VERR_INVALID_POINTER); 108 V BoxGuestCloseSession(&g_DevExt, pSession);108 VbgdCommonCloseSession(&g_DevExt, pSession); 109 109 110 110 #ifdef RT_OS_SOLARIS … … 144 144 ("SC: %p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE); 145 145 146 return V BoxGuestCommonIOCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);146 return VbgdCommonIoCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned); 147 147 } 148 148 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
r54606 r54608 5 5 6 6 /* 7 * Copyright (C) 2010-201 4Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 65 65 uint32_t volatile fResEvents; 66 66 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP 67 /** Set by V BoxGuestWaitDoWakeUps before leaving the spinlock to call67 /** Set by VbgdCommonWaitDoWakeUps before leaving the spinlock to call 68 68 * RTSemEventMultiSignal. */ 69 69 bool volatile fPendingWakeUp; 70 70 /** Set by the requestor thread if it got the spinlock before the 71 * signaller. Deals with the race in V BoxGuestWaitDoWakeUps. */71 * signaller. Deals with the race in VbgdCommonWaitDoWakeUps. */ 72 72 bool volatile fFreeMe; 73 73 #endif … … 314 314 RT_C_DECLS_BEGIN 315 315 316 int V BoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fEvents);317 bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt);318 void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);319 int VBoxGuestReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType);320 int V BoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot);316 int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO, 317 VBOXOSTYPE enmOSType, uint32_t fEvents); 318 bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt); 319 void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt); 320 int VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType); 321 321 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP 322 void VBoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt); 323 #endif 324 325 int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession); 326 int VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession); 327 void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession); 328 329 int VBoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession); 330 int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 331 void *pvData, size_t cbData, size_t *pcbDataReturned); 332 333 #if defined(RT_OS_SOLARIS) \ 334 || defined(RT_OS_FREEBSD) \ 335 || defined(RT_OS_LINUX) 336 DECLVBGL(void *) VBoxGuestNativeServiceOpen(uint32_t *pu32Version); 337 DECLVBGL(void) VBoxGuestNativeServiceClose(void *pvOpaque); 338 DECLVBGL(int) VBoxGuestNativeServiceCall(void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn); 339 #endif 322 void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt); 323 #endif 324 325 int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession); 326 int VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession); 327 void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession); 328 329 int VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession); 330 int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, 331 void *pvData, size_t cbData, size_t *pcbDataReturned); 340 332 341 333 /** … … 347 339 * @param pDevExt The device extension. 348 340 */ 349 void V BoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt);341 void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt); 350 342 351 343
Note:
See TracChangeset
for help on using the changeset viewer.