Changeset 41852 in vbox for trunk/src/VBox
- Timestamp:
- Jun 20, 2012 3:59:57 PM (12 years ago)
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/Init.cpp
r41783 r41852 33 33 #include <iprt/string.h> 34 34 #include <iprt/assert.h> 35 #include <iprt/semaphore.h> 35 36 36 37 /******************************************************************************* … … 41 42 42 43 /** 43 * Used by vbglQuery VMMDevPortand VbglInit to try get the host feature mask and44 * Used by vbglQueryDriverInfo and VbglInit to try get the host feature mask and 44 45 * version information (g_vbgldata::hostVersion). 45 46 * … … 78 79 * 79 80 */ 80 static void vbglQuery VMMDevPort(void)81 static void vbglQueryDriverInfo (void) 81 82 { 82 83 int rc = VINF_SUCCESS; 83 84 84 VBGLDRIVER driver; 85 86 rc = vbglDriverOpen (&driver); 85 rc = RTSemFastMutexRequest(g_vbgldata.mutexDriverInit); 86 87 if (RT_FAILURE(rc)) 88 return; 89 90 if (g_vbgldata.status == VbglStatusReady) 91 { 92 RTSemFastMutexRelease(g_vbgldata.mutexDriverInit); 93 return; 94 } 95 96 rc = vbglDriverOpen(&g_vbgldata.driver); 87 97 88 98 if (RT_SUCCESS(rc)) … … 93 103 VBoxGuestPortInfo port; 94 104 95 rc = vbglDriverIOCtl (&driver, VBOXGUEST_IOCTL_GETVMMDEVPORT, &port, sizeof (port)); 105 rc = vbglDriverIOCtl (&g_vbgldata.driver, 106 VBOXGUEST_IOCTL_GETVMMDEVPORT, &port, 107 sizeof (port)); 96 108 97 109 if (RT_SUCCESS (rc)) … … 106 118 vbglR0QueryHostVersion(); 107 119 } 108 109 vbglDriverClose (&driver); 110 } 111 112 dprintf (("vbglQueryVMMDevPort rc = %d\n", rc)); 120 } 121 RTSemFastMutexRelease(g_vbgldata.mutexDriverInit); 122 dprintf (("vbglQueryDriverInfo rc = %d\n", rc)); 113 123 } 114 124 #endif /* !VBGL_VBOXGUEST */ … … 128 138 if (g_vbgldata.status == VbglStatusInitializing) 129 139 { 130 vbglQuery VMMDevPort();140 vbglQueryDriverInfo (); 131 141 } 132 142 #endif … … 234 244 if (RT_SUCCESS(rc)) 235 245 { 236 /* Try to obtain VMMDev port via IOCTL to VBoxGuest main driver. */ 237 vbglQueryVMMDevPort (); 246 rc = RTSemFastMutexCreate(&g_vbgldata.mutexDriverInit); 247 if (RT_SUCCESS(rc)) 248 { 249 /* Try to obtain VMMDev port via IOCTL to VBoxGuest main driver. */ 250 vbglQueryDriverInfo (); 238 251 239 252 # ifdef VBOX_WITH_HGCM 240 rc = vbglR0HGCMInit ();253 rc = vbglR0HGCMInit (); 241 254 # endif /* VBOX_WITH_HGCM */ 255 256 if (RT_FAILURE(rc)) 257 { 258 RTSemFastMutexDestroy(g_vbgldata.mutexDriverInit); 259 g_vbgldata.mutexDriverInit = NIL_RTSEMFASTMUTEX; 260 } 261 } 242 262 243 263 if (RT_FAILURE(rc)) … … 245 265 vbglTerminateCommon (); 246 266 } 267 247 268 } 248 269 249 270 return rc; 271 } 272 273 DECLVBGL(bool) VbglIsReady(void) 274 { 275 return(g_vbgldata.status == VbglStatusReady); 250 276 } 251 277 … … 257 283 258 284 vbglTerminateCommon (); 285 vbglDriverClose(&g_vbgldata.driver); 286 RTSemFastMutexDestroy(g_vbgldata.mutexDriverInit); 287 g_vbgldata.mutexDriverInit = NIL_RTSEMFASTMUTEX; 259 288 260 289 return; 261 290 } 262 291 292 int vbglGetDriver(VBGLDRIVER **ppDriver) 293 { 294 if (g_vbgldata.status != VbglStatusReady) 295 { 296 vbglQueryDriverInfo(); 297 if (g_vbgldata.status != VbglStatusReady) 298 return VERR_TRY_AGAIN; 299 } 300 *ppDriver = &g_vbgldata.driver; 301 return VINF_SUCCESS; 302 } 303 263 304 #endif /* !VBGL_VBOXGUEST */ 264 -
trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
r41477 r41852 61 61 PhysHeap.cpp \ 62 62 Init.cpp \ 63 Mouse.cpp \ 63 64 VMMDev.cpp \ 64 65 HGCM.cpp \ -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBGLInternal.h
r40901 r41852 101 101 #ifndef VBGL_VBOXGUEST 102 102 /** 103 * Handle for the main driver instance. 104 * @{ 105 */ 106 107 RTSEMFASTMUTEX mutexDriverInit; 108 109 VBGLDRIVER driver; 110 111 /** @} */ 112 113 /** 103 114 * Fast heap for HGCM handles data. 104 115 * @{ … … 156 167 #endif /* VBOX_WITH_HGCM */ 157 168 169 #ifndef VBGL_VBOXGUEST 170 /** 171 * Get a handle to the main VBoxGuest driver. 172 * @returns VERR_TRY_AGAIN if the main driver has not yet been loaded. 173 */ 174 int vbglGetDriver(VBGLDRIVER **ppDriver); 175 #endif 176 158 177 #endif /* !___VBoxGuestLib_VBGLInternal_h */ 159 178 -
trunk/src/VBox/Additions/solaris/Mouse/Makefile.kmk
r41725 r41852 33 33 34 34 # 35 # vboxm ouse- The Mouse Integration Driver35 # vboxms - The Mouse Integration Driver 36 36 # 37 SYSMODS.solaris += vboxm ouse38 vboxm ouse_TEMPLATE = VBOXGUESTR039 vboxm ouse_DEFS = VBOX_WITH_HGCM VBOX_SVN_REV=$(VBOX_SVN_REV)40 vboxm ouse_DEPS += $(VBOX_SVN_REV_KMK)41 vboxm ouse_SOURCES = \37 SYSMODS.solaris += vboxms 38 vboxms_TEMPLATE = VBOXGUESTR0 39 vboxms_DEFS = VBOX_WITH_HGCM VBOX_SVN_REV=$(VBOX_SVN_REV) 40 vboxms_DEPS += $(VBOX_SVN_REV_KMK) 41 vboxms_SOURCES = \ 42 42 vboxmouse.c 43 vboxm ouse_LIBS = \43 vboxms_LIBS = \ 44 44 $(VBOX_LIB_VBGL_R0) 45 45 ifeq ($(KBUILD_HOST),solaris) 46 vboxm ouse_LDFLAGS += -N drv/vboxguest -N misc/ctf46 vboxms_LDFLAGS += -N drv/vboxguest -N misc/ctf 47 47 else 48 vboxm ouse_SOURCES += deps.asm49 vboxm ouse_deps.asm_ASFLAGS = -f bin -g null48 vboxms_SOURCES += deps.asm 49 vboxms_deps.asm_ASFLAGS = -f bin -g null 50 50 endif 51 51 -
trunk/src/VBox/Additions/solaris/Mouse/testcase/solaris.h
r41705 r41852 335 335 #define RTR0Init(...) VINF_SUCCESS 336 336 #define RTR0Term(...) do {} while(0) 337 #define RTR0AssertPanicSystem(...) do {} while(0) 337 338 #define RTLogCreate(...) VINF_SUCCESS 338 339 #define RTLogRelSetDefaultInstance(...) do {} while(0) 339 340 #define RTLogDestroy(...) do {} while(0) 341 #if 0 340 342 #define VBoxGuestCreateKernelSession(...) VINF_SUCCESS 341 343 #define VBoxGuestCreateUserSession(...) VINF_SUCCESS … … 348 350 #define VbglGRPerform(...) VINF_SUCCESS 349 351 #define VbglGRFree(...) do {} while(0) 352 #endif 353 #define VbglInit(...) VINF_SUCCESS 354 #define vbglDriverOpen(...) VINF_SUCCESS 355 #define vbglDriverClose(...) do {} while(0) 356 #define vbglDriverIOCtl(...) VINF_SUCCESS 350 357 #define qprocson(...) do {} while(0) 351 358 #define qprocsoff(...) do {} while(0) -
trunk/src/VBox/Additions/solaris/Mouse/vboxmouse.c
r41705 r41852 78 78 #define DEVICE_NAME "vboxmouse" 79 79 /** The module description as seen in 'modinfo'. */ 80 #define DEVICE_DESC "V irtualBox MouInt"80 #define DEVICE_DESC "VBoxMouseIntegr" 81 81 82 82 … … 102 102 static struct module_info g_vbmsSolModInfo = 103 103 { 104 0 x0ffff,/* module id number */105 "vboxm ouse",104 0, /* module id number */ 105 "vboxms", 106 106 0, /* minimum packet size */ 107 107 INFPSZ, /* maximum packet size accepted */ … … 159 159 */ 160 160 static struct fmodsw g_vbmsSolStrWrapper = { 161 "vboxm ouse",161 "vboxms", 162 162 &g_vbmsSolStreamTab, 163 D_MP | D_MTPERMOD163 D_MP 164 164 }; 165 165 … … 193 193 typedef struct 194 194 { 195 /** Pointer to the Guest Library handle for the main driver. */196 VBGLDRIVER Driver;197 195 /** The STREAMS write queue which we need for sending messages up to 198 196 * user-space. */ … … 286 284 287 285 /****************************************************************************** 288 * Helper routines *289 ******************************************************************************/290 291 /** Calls the kernel IOCtl to report mouse status to the host on behalf of292 * an open session. */293 static int vbmsSolSetMouseStatus(VBGLDRIVER *pDriver, uint32_t fStatus)294 {295 return vbglDriverIOCtl(pDriver, VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &fStatus,296 sizeof(fStatus));297 }298 299 300 /******************************************************************************301 286 * Main code * 302 287 ******************************************************************************/ … … 341 326 * Create a new session. 342 327 */ 343 rc = vbglDriverOpen(&pState->Driver); 344 if (RT_SUCCESS(rc)) 345 { 346 VBoxGuestMouseSetNotifyCallback NotifyCallback; 347 328 if (VbglIsReady()) 329 { 348 330 /* Initialise user data for the queues to our state and vice-versa. */ 349 331 WR(pReadQueue)->q_ptr = (char *)pState; 350 332 pReadQueue->q_ptr = (char *)pState; 351 333 /* Enable our IRQ handler. */ 352 NotifyCallback.pfnNotify = vbmsSolNotify; 353 NotifyCallback.pvUser = (void *)pState; 354 vbglDriverIOCtl(&pState->Driver, 355 VBOXGUEST_IOCTL_SET_MOUSE_NOTIFY_CALLBACK, 356 &NotifyCallback, sizeof(NotifyCallback)); 334 VbglSetMouseNotifyCallback(vbmsSolNotify, (void *)pState); 357 335 qprocson(pReadQueue); 358 336 LogRel((DEVICE_NAME "::Open\n")); … … 377 355 { 378 356 PVBMSSTATE pState = (PVBMSSTATE)pvState; 379 VMMDevReqMouseStatus *pReq;380 357 int rc; 358 uint32_t x, y; 381 359 LogFlow((DEVICE_NAME "::NativeISRMousePollEvent:\n")); 382 360 383 rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), 384 VMMDevReq_GetMouseStatus); 385 if (RT_FAILURE(rc)) 386 return; /* If kernel memory is short a missed event is acceptable! */ 387 pReq->mouseFeatures = 0; 388 pReq->pointerXPos = 0; 389 pReq->pointerYPos = 0; 390 rc = VbglGRPerform(&pReq->header); 361 rc = VbglGetMouseStatus(NULL, &x, &y); 391 362 if (RT_SUCCESS(rc)) 392 363 { … … 397 368 { 398 369 vbmsSolVUIDPutAbsEvent(pState, LOC_X_ABSOLUTE, 399 pReq->pointerXPos * cMaxScreenX 400 / VMMDEV_MOUSE_RANGE_MAX); 370 x * cMaxScreenX / VMMDEV_MOUSE_RANGE_MAX); 401 371 vbmsSolVUIDPutAbsEvent(pState, LOC_Y_ABSOLUTE, 402 pReq->pointerYPos * cMaxScreenY 403 / VMMDEV_MOUSE_RANGE_MAX); 372 y * cMaxScreenY / VMMDEV_MOUSE_RANGE_MAX); 404 373 } 405 374 } 406 VbglGRFree(&pReq->header);407 375 } 408 376 … … 439 407 { 440 408 PVBMSSTATE pState = (PVBMSSTATE)pReadQueue->q_ptr; 441 VBoxGuestMouseSetNotifyCallback NotifyCallback;442 409 443 410 LogFlow((DEVICE_NAME "::Close\n")); … … 451 418 } 452 419 420 VbglSetMouseStatus(0); 453 421 /* Disable our IRQ handler. */ 454 RT_ZERO(NotifyCallback); 455 vbglDriverIOCtl(&pState->Driver, 456 VBOXGUEST_IOCTL_SET_MOUSE_NOTIFY_CALLBACK, 457 &NotifyCallback, sizeof(NotifyCallback)); 422 VbglSetMouseNotifyCallback(NULL, NULL); 458 423 qprocsoff(pReadQueue); 459 424 … … 461 426 * Close the session. 462 427 */ 463 vbglDriverClose(&pState->Driver);464 428 ASMAtomicWriteNullPtr(&pState->pWriteQueue); 465 429 pReadQueue->q_ptr = NULL; … … 1198 1162 pState->cMaxScreenY = pResolution->height - 1; 1199 1163 /* Note: we don't disable this again until session close. */ 1200 rc = vbmsSolSetMouseStatus(&pState->Driver, 1201 VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE 1202 | VMMDEV_MOUSE_NEW_PROTOCOL); 1164 rc = VbglSetMouseStatus( VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE 1165 | VMMDEV_MOUSE_NEW_PROTOCOL); 1203 1166 if (RT_SUCCESS(rc)) 1204 1167 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.