- Timestamp:
- Jul 9, 2009 10:13:37 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49879
- Location:
- trunk/src/VBox/Additions/common/VBoxGuestLib
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/GenericRequest.cpp
r21226 r21461 28 28 { 29 29 VMMDevRequestHeader *pReq; 30 int rc = VbglEnter ();30 int rc = vbglR0Enter (); 31 31 32 32 if (RT_FAILURE(rc)) … … 65 65 { 66 66 RTCCPHYS physaddr; 67 int rc = VbglEnter ();67 int rc = vbglR0Enter (); 68 68 69 69 if (RT_FAILURE(rc)) … … 91 91 DECLVBGL(void) VbglGRFree (VMMDevRequestHeader *pReq) 92 92 { 93 int rc = VbglEnter ();93 int rc = vbglR0Enter (); 94 94 95 95 if (RT_FAILURE(rc)) -
trunk/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp
r21261 r21461 34 34 #define VBGL_HGCM_ASSERTMsg AssertReleaseMsg 35 35 36 int vbglHGCMInit (void) 37 { 38 RTSemFastMutexCreate(&g_vbgldata.mutexHGCMHandle); 39 40 return VINF_SUCCESS; 41 } 42 43 int vbglHGCMTerminate (void) 36 /** 37 * Initializes the HGCM VBGL bits. 38 * 39 * @return VBox status code. 40 */ 41 int vbglR0HGCMInit (void) 42 { 43 return RTSemFastMutexCreate(&g_vbgldata.mutexHGCMHandle); 44 } 45 46 /** 47 * Initializes the HGCM VBGL bits. 48 * 49 * @return VBox status code. 50 */ 51 int vbglR0HGCMTerminate (void) 44 52 { 45 53 RTSemFastMutexDestroy(g_vbgldata.mutexHGCMHandle); 54 g_vbgldata.mutexHGCMHandle = NIL_RTSEMFASTMUTEX; 46 55 47 56 return VINF_SUCCESS; -
trunk/src/VBox/Additions/common/VBoxGuestLib/Init.cpp
r21211 r21461 20 20 */ 21 21 22 22 /******************************************************************************* 23 * Header Files * 24 *******************************************************************************/ 23 25 #define VBGL_DECL_DATA 24 26 #include "VBGLInternal.h" … … 27 29 #include <iprt/assert.h> 28 30 31 /******************************************************************************* 32 * Global Variables * 33 *******************************************************************************/ 34 /** The global VBGL instance data. */ 29 35 VBGLDATA g_vbgldata; 30 36 37 /** 38 * Used by vbglQueryVMMDevPort and VbglInit to try get the host feature mask and 39 * version information (g_vbgldata::hostVersion). 40 * 41 * This was first implemented by the host in 3.1 and we quietly ignore failures 42 * for that reason. 43 */ 44 static void vbglR0QueryHostVersion (void) 45 { 46 VMMDevReqHostVersion *pReq; 47 48 int rc = VbglGRAlloc ((VMMDevRequestHeader **) &pReq, sizeof (*pReq), VMMDevReq_GetHostVersion); 49 50 if (RT_SUCCESS (rc)) 51 { 52 rc = VbglGRPerform (&pReq->header); 53 54 if (RT_SUCCESS (rc)) 55 { 56 g_vbgldata.hostVersion = *pReq; 57 Log (("vbglR0QueryHostVersion: %u.%u.%ur%u %#x\n", 58 pReq->major, pReq->minor, pReq->build, pReq->revision, pReq->features)); 59 } 60 61 VbglGRFree (&pReq->header); 62 } 63 } 64 31 65 #ifndef VBGL_VBOXGUEST 32 /* The guest library uses lazy initialization for VMMDev port and memory, 66 /** 67 * The guest library uses lazy initialization for VMMDev port and memory, 33 68 * because these values are provided by the VBoxGuest driver and it might 34 69 * be loaded later than other drivers. 70 * 35 71 * The VbglEnter checks the current library status, tries to retrive these 36 72 * values and fails if they are unavailable. 73 * 37 74 */ 38 75 static void vbglQueryVMMDevPort (void) … … 46 83 if (RT_SUCCESS(rc)) 47 84 { 85 /* 86 * Try query the port info. 87 */ 48 88 VBoxGuestPortInfo port; 49 89 … … 58 98 59 99 g_vbgldata.status = VbglStatusReady; 100 101 vbglR0QueryHostVersion(); 60 102 } 61 103 … … 65 107 dprintf (("vbglQueryVMMDevPort rc = %d\n", rc)); 66 108 } 67 #endif 68 69 int VbglEnter (void) 109 #endif /* !VBGL_VBOXGUEST */ 110 111 /** 112 * Checks if VBGL has been initialized. 113 * 114 * The the client library, this will lazily complete the initialization. 115 * 116 * @return VINF_SUCCESS or VERR_VBGL_NOT_INITIALIZED. 117 */ 118 int vbglR0Enter (void) 70 119 { 71 120 int rc; … … 121 170 int rc = VINF_SUCCESS; 122 171 172 # ifdef RT_OS_WINDOWS /** @todo r=bird: this doesn't make sense. Is there something special going on on windows? */ 123 173 dprintf(("vbglInit: starts g_vbgldata.status %d\n", g_vbgldata.status)); 124 174 … … 129 179 return rc; 130 180 } 181 # else 182 dprintf(("vbglInit: starts\n")); 183 # endif 131 184 132 185 rc = vbglInitCommon (); … … 138 191 139 192 g_vbgldata.status = VbglStatusReady; 193 194 vbglR0QueryHostVersion(); 140 195 } 141 196 else … … 175 230 vbglQueryVMMDevPort (); 176 231 177 # ifdef VBOX_WITH_HGCM178 rc = vbgl HGCMInit ();179 # endif /* VBOX_WITH_HGCM */232 # ifdef VBOX_WITH_HGCM 233 rc = vbglR0HGCMInit (); 234 # endif /* VBOX_WITH_HGCM */ 180 235 181 236 if (RT_FAILURE(rc)) … … 192 247 vbglTerminateCommon (); 193 248 194 # ifdef VBOX_WITH_HGCM195 vbgl HGCMTerminate ();196 # endif249 # ifdef VBOX_WITH_HGCM 250 vbglR0HGCMTerminate (); 251 # endif 197 252 198 253 return; -
trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
r21271 r21461 58 58 VMMDev.cpp \ 59 59 HGCM.cpp \ 60 VBoxCalls.c 60 VBoxCalls.c \ 61 VbglR0CanUsePhysPageList.cpp 62 61 63 62 64 # … … 73 75 Init.cpp \ 74 76 VMMDev.cpp \ 75 HGCMInternal.cpp 77 HGCMInternal.cpp \ 78 VbglR0CanUsePhysPageList.cpp 76 79 77 80 # -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBGLInternal.h
r21227 r21461 29 29 #include <VBox/log.h> 30 30 31 /** @todo dprintf() -> Log() */ 31 32 #ifdef RT_OS_WINDOWS /** @todo dprintf() -> Log() */ 32 33 #if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(LOG_ENABLED) 33 34 # define dprintf(a) RTLogBackdoorPrintf a … … 35 36 # define dprintf(a) do {} while (0) 36 37 #endif 38 #else 39 # define dprintf(a) Log(a) 40 #endif 37 41 38 42 #include "SysHlp.h" 39 43 40 #pragma pack(4) 44 #pragma pack(4) /** @todo r=bird: What do we need packing for here? None of these structures are shared between drivers AFAIK. */ 41 45 42 46 struct _VBGLPHYSHEAPBLOCK; … … 60 64 }; 61 65 66 /** 67 * Global VBGL ring-0 data. 68 * Lives in VbglR0Init.cpp. 69 */ 62 70 typedef struct _VBGLDATA 63 71 { … … 80 88 /** @} */ 81 89 90 /** 91 * The host version data. 92 */ 93 VMMDevReqHostVersion hostVersion; 94 95 82 96 #ifndef VBGL_VBOXGUEST 83 97 /** … … 94 108 } VBGLDATA; 95 109 110 96 111 #pragma pack() 97 112 … … 100 115 #endif 101 116 102 /* Check if library has been initialized before entering 103 * a public library function. 117 /** 118 * Internal macro for checking whether we can pass phyical page lists to the 119 * host. 120 * 121 * ASSUMES that vbglR0Enter has been called already. 104 122 */ 105 int VbglEnter (void); 123 #define VBGLR0_CAN_USE_PHYS_PAGE_LIST() \ 124 ( !!(g_vbgldata.hostVersion.features & VMMDEV_HVF_HGCM_PHYS_PAGE_LIST) ) 125 126 int vbglR0Enter (void); 106 127 107 128 #ifdef VBOX_WITH_HGCM 108 129 # ifndef VBGL_VBOXGUEST 109 /* Initialize HGCM subsystem. */ 110 int vbglHGCMInit (void); 111 /* Terminate HGCM subsystem. */ 112 int vbglHGCMTerminate (void); 130 int vbglR0HGCMInit (void); 131 int vbglR0HGCMTerminate (void); 113 132 # endif 114 133 #endif /* VBOX_WITH_HGCM */ -
trunk/src/VBox/Additions/common/VBoxGuestLib/VMMDev.cpp
r21211 r21461 24 24 DECLVBGL(int) VbglQueryVMMDevMemory (VMMDevMemory **ppVMMDevMemory) 25 25 { 26 int rc = VbglEnter ();26 int rc = vbglR0Enter (); 27 27 28 28 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.