VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp@ 40901

Last change on this file since 40901 was 40901, checked in by vboxsync, 13 years ago

Let the other hosts use page lists again.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 44.0 KB
Line 
1/* $Revision: 40901 $ */
2/** @file
3 * VBoxGuestLib - Host-Guest Communication Manager internal functions, implemented by VBoxGuest
4 */
5
6/*
7 * Copyright (C) 2006-2007 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27/* Entire file is ifdef'ed with VBGL_VBOXGUEST */
28#ifdef VBGL_VBOXGUEST
29
30/*******************************************************************************
31* Header Files *
32*******************************************************************************/
33#define LOG_GROUP LOG_GROUP_HGCM
34
35#include "VBGLInternal.h"
36#include <iprt/alloca.h>
37#include <iprt/asm.h>
38#include <iprt/assert.h>
39#include <iprt/mem.h>
40#include <iprt/memobj.h>
41#include <iprt/string.h>
42#include <iprt/thread.h>
43#include <iprt/time.h>
44
45/*******************************************************************************
46* Defined Constants And Macros *
47*******************************************************************************/
48/** The max parameter buffer size for a user request. */
49#define VBGLR0_MAX_HGCM_USER_PARM (24*_1M)
50/** The max parameter buffer size for a kernel request. */
51#define VBGLR0_MAX_HGCM_KERNEL_PARM (16*_1M)
52#ifdef RT_OS_LINUX
53/** Linux needs to use bounce buffers since RTR0MemObjLockUser has unwanted
54 * side effects. */
55# define USE_BOUNCE_BUFFERS
56#endif
57
58
59/*******************************************************************************
60* Structures and Typedefs *
61*******************************************************************************/
62/**
63 * Lock info structure used by VbglR0HGCMInternalCall and its helpers.
64 */
65struct VbglR0ParmInfo
66{
67 uint32_t cLockBufs;
68 struct
69 {
70 uint32_t iParm;
71 RTR0MEMOBJ hObj;
72#ifdef USE_BOUNCE_BUFFERS
73 void *pvSmallBuf;
74#endif
75 } aLockBufs[10];
76};
77
78
79
80/* These functions can be only used by VBoxGuest. */
81
82DECLVBGL(int) VbglR0HGCMInternalConnect (VBoxGuestHGCMConnectInfo *pConnectInfo,
83 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData)
84{
85 VMMDevHGCMConnect *pHGCMConnect;
86 int rc;
87
88 if (!pConnectInfo || !pfnAsyncCallback)
89 return VERR_INVALID_PARAMETER;
90
91 pHGCMConnect = NULL;
92
93 /* Allocate request */
94 rc = VbglGRAlloc ((VMMDevRequestHeader **)&pHGCMConnect, sizeof (VMMDevHGCMConnect), VMMDevReq_HGCMConnect);
95
96 if (RT_SUCCESS(rc))
97 {
98 /* Initialize request memory */
99 pHGCMConnect->header.fu32Flags = 0;
100
101 memcpy (&pHGCMConnect->loc, &pConnectInfo->Loc, sizeof (HGCMServiceLocation));
102 pHGCMConnect->u32ClientID = 0;
103
104 /* Issue request */
105 rc = VbglGRPerform (&pHGCMConnect->header.header);
106
107 if (RT_SUCCESS(rc))
108 {
109 /* Check if host decides to process the request asynchronously. */
110 if (rc == VINF_HGCM_ASYNC_EXECUTE)
111 {
112 /* Wait for request completion interrupt notification from host */
113 pfnAsyncCallback (&pHGCMConnect->header, pvAsyncData, u32AsyncData);
114 }
115
116 pConnectInfo->result = pHGCMConnect->header.result;
117
118 if (RT_SUCCESS (pConnectInfo->result))
119 pConnectInfo->u32ClientID = pHGCMConnect->u32ClientID;
120 }
121
122 VbglGRFree (&pHGCMConnect->header.header);
123 }
124
125 return rc;
126}
127
128
129DECLR0VBGL(int) VbglR0HGCMInternalDisconnect (VBoxGuestHGCMDisconnectInfo *pDisconnectInfo,
130 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData)
131{
132 VMMDevHGCMDisconnect *pHGCMDisconnect;
133 int rc;
134
135 if (!pDisconnectInfo || !pfnAsyncCallback)
136 return VERR_INVALID_PARAMETER;
137
138 pHGCMDisconnect = NULL;
139
140 /* Allocate request */
141 rc = VbglGRAlloc ((VMMDevRequestHeader **)&pHGCMDisconnect, sizeof (VMMDevHGCMDisconnect), VMMDevReq_HGCMDisconnect);
142
143 if (RT_SUCCESS(rc))
144 {
145 /* Initialize request memory */
146 pHGCMDisconnect->header.fu32Flags = 0;
147
148 pHGCMDisconnect->u32ClientID = pDisconnectInfo->u32ClientID;
149
150 /* Issue request */
151 rc = VbglGRPerform (&pHGCMDisconnect->header.header);
152
153 if (RT_SUCCESS(rc))
154 {
155 /* Check if host decides to process the request asynchronously. */
156 if (rc == VINF_HGCM_ASYNC_EXECUTE)
157 {
158 /* Wait for request completion interrupt notification from host */
159 pfnAsyncCallback (&pHGCMDisconnect->header, pvAsyncData, u32AsyncData);
160 }
161
162 pDisconnectInfo->result = pHGCMDisconnect->header.result;
163 }
164
165 VbglGRFree (&pHGCMDisconnect->header.header);
166 }
167
168 return rc;
169}
170
171
172/**
173 * Preprocesses the HGCM call, validating and locking/buffering parameters.
174 *
175 * @returns VBox status code.
176 *
177 * @param pCallInfo The call info.
178 * @param cbCallInfo The size of the call info structure.
179 * @param fIsUser Is it a user request or kernel request.
180 * @param pcbExtra Where to return the extra request space needed for
181 * physical page lists.
182 */
183static int vbglR0HGCMInternalPreprocessCall(VBoxGuestHGCMCallInfo const *pCallInfo, uint32_t cbCallInfo,
184 bool fIsUser, struct VbglR0ParmInfo *pParmInfo, size_t *pcbExtra)
185{
186 HGCMFunctionParameter const *pSrcParm = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo);
187 uint32_t cParms = pCallInfo->cParms;
188 uint32_t iParm;
189 uint32_t cb;
190
191 /*
192 * Lock down the any linear buffers so we can get their addresses
193 * and figure out how much extra storage we need for page lists.
194 *
195 * Note! With kernel mode users we can be assertive. For user mode users
196 * we should just (debug) log it and fail without any fanfare.
197 */
198 *pcbExtra = 0;
199 pParmInfo->cLockBufs = 0;
200 for (iParm = 0; iParm < cParms; iParm++, pSrcParm++)
201 {
202 switch (pSrcParm->type)
203 {
204 case VMMDevHGCMParmType_32bit:
205 Log4(("GstHGCMCall: parm=%u type=32bit: %#010x\n", iParm, pSrcParm->u.value32));
206 break;
207
208 case VMMDevHGCMParmType_64bit:
209 Log4(("GstHGCMCall: parm=%u type=64bit: %#018x\n", iParm, pSrcParm->u.value64));
210 break;
211
212 case VMMDevHGCMParmType_PageList:
213 if (fIsUser)
214 return VERR_INVALID_PARAMETER;
215 cb = pSrcParm->u.PageList.size;
216 if (cb)
217 {
218 uint32_t off = pSrcParm->u.PageList.offset;
219 HGCMPageListInfo *pPgLst;
220 uint32_t cPages;
221 uint32_t u32;
222
223 AssertMsgReturn(cb <= VBGLR0_MAX_HGCM_KERNEL_PARM, ("%#x > %#x\n", cb, VBGLR0_MAX_HGCM_KERNEL_PARM),
224 VERR_OUT_OF_RANGE);
225 AssertMsgReturn( off >= pCallInfo->cParms * sizeof(HGCMFunctionParameter)
226 && off <= cbCallInfo - sizeof(HGCMPageListInfo),
227 ("offset=%#x cParms=%#x cbCallInfo=%#x\n", off, pCallInfo->cParms, cbCallInfo),
228 VERR_INVALID_PARAMETER);
229
230 pPgLst = (HGCMPageListInfo *)((uint8_t *)pCallInfo + off);
231 cPages = pPgLst->cPages;
232 u32 = RT_OFFSETOF(HGCMPageListInfo, aPages[cPages]) + off;
233 AssertMsgReturn(u32 <= cbCallInfo,
234 ("u32=%#x (cPages=%#x offset=%#x) cbCallInfo=%#x\n", u32, cPages, off, cbCallInfo),
235 VERR_INVALID_PARAMETER);
236 AssertMsgReturn(pPgLst->offFirstPage < PAGE_SIZE, ("#x\n", pPgLst->offFirstPage), VERR_INVALID_PARAMETER);
237 u32 = RT_ALIGN_32(pPgLst->offFirstPage + cb, PAGE_SIZE) >> PAGE_SHIFT;
238 AssertMsgReturn(cPages == u32, ("cPages=%#x u32=%#x\n", cPages, u32), VERR_INVALID_PARAMETER);
239 AssertMsgReturn(VBOX_HGCM_F_PARM_ARE_VALID(pPgLst->flags), ("%#x\n", pPgLst->flags), VERR_INVALID_PARAMETER);
240 Log4(("GstHGCMCall: parm=%u type=pglst: cb=%#010x cPgs=%u offPg0=%#x flags=%#x\n",
241 iParm, cb, cPages, pPgLst->offFirstPage, pPgLst->flags));
242 u32 = cPages;
243 while (u32-- > 0)
244 {
245 Log4(("GstHGCMCall: pg#%u=%RHp\n", u32, pPgLst->aPages[u32]));
246 AssertMsgReturn(!(pPgLst->aPages[u32] & (PAGE_OFFSET_MASK | UINT64_C(0xfff0000000000000))),
247 ("pg#%u=%RHp\n", u32, pPgLst->aPages[u32]),
248 VERR_INVALID_PARAMETER);
249 }
250
251 *pcbExtra += RT_OFFSETOF(HGCMPageListInfo, aPages[pPgLst->cPages]);
252 }
253 else
254 Log4(("GstHGCMCall: parm=%u type=pglst: cb=0\n", iParm));
255 break;
256
257 case VMMDevHGCMParmType_LinAddr_Locked_In:
258 case VMMDevHGCMParmType_LinAddr_Locked_Out:
259 case VMMDevHGCMParmType_LinAddr_Locked:
260 if (fIsUser)
261 return VERR_INVALID_PARAMETER;
262 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
263 {
264 cb = pSrcParm->u.Pointer.size;
265 AssertMsgReturn(cb <= VBGLR0_MAX_HGCM_KERNEL_PARM, ("%#x > %#x\n", cb, VBGLR0_MAX_HGCM_KERNEL_PARM),
266 VERR_OUT_OF_RANGE);
267 if (cb != 0)
268 Log4(("GstHGCMCall: parm=%u type=%#x: cb=%#010x pv=%p\n",
269 iParm, pSrcParm->type, cb, pSrcParm->u.Pointer.u.linearAddr));
270 else
271 Log4(("GstHGCMCall: parm=%u type=%#x: cb=0\n", iParm, pSrcParm->type));
272 break;
273 }
274 /* fall thru */
275
276 case VMMDevHGCMParmType_LinAddr_In:
277 case VMMDevHGCMParmType_LinAddr_Out:
278 case VMMDevHGCMParmType_LinAddr:
279 cb = pSrcParm->u.Pointer.size;
280 if (cb != 0)
281 {
282#ifdef USE_BOUNCE_BUFFERS
283 void *pvSmallBuf = NULL;
284#endif
285 uint32_t iLockBuf = pParmInfo->cLockBufs;
286 RTR0MEMOBJ hObj;
287 int rc;
288 uint32_t fAccess = pSrcParm->type == VMMDevHGCMParmType_LinAddr_In
289 || pSrcParm->type == VMMDevHGCMParmType_LinAddr_Locked_In
290 ? RTMEM_PROT_READ
291 : RTMEM_PROT_READ | RTMEM_PROT_WRITE;
292
293 AssertReturn(iLockBuf < RT_ELEMENTS(pParmInfo->aLockBufs), VERR_INVALID_PARAMETER);
294 if (!fIsUser)
295 {
296 AssertMsgReturn(cb <= VBGLR0_MAX_HGCM_KERNEL_PARM, ("%#x > %#x\n", cb, VBGLR0_MAX_HGCM_KERNEL_PARM),
297 VERR_OUT_OF_RANGE);
298 rc = RTR0MemObjLockKernel(&hObj, (void *)pSrcParm->u.Pointer.u.linearAddr, cb, fAccess);
299 if (RT_FAILURE(rc))
300 {
301 Log(("GstHGCMCall: id=%#x fn=%u parm=%u RTR0MemObjLockKernel(,%p,%#x) -> %Rrc\n",
302 pCallInfo->u32ClientID, pCallInfo->u32Function, iParm, pSrcParm->u.Pointer.u.linearAddr, cb, rc));
303 return rc;
304 }
305 Log3(("GstHGCMCall: parm=%u type=%#x: cb=%#010x pv=%p locked kernel -> %p\n",
306 iParm, pSrcParm->type, cb, pSrcParm->u.Pointer.u.linearAddr, hObj));
307 }
308 else if (cb > VBGLR0_MAX_HGCM_USER_PARM)
309 {
310 Log(("GstHGCMCall: id=%#x fn=%u parm=%u pv=%p cb=%#x > %#x -> out of range\n",
311 pCallInfo->u32ClientID, pCallInfo->u32Function, iParm, pSrcParm->u.Pointer.u.linearAddr,
312 cb, VBGLR0_MAX_HGCM_USER_PARM));
313 return VERR_OUT_OF_RANGE;
314 }
315 else
316 {
317#ifndef USE_BOUNCE_BUFFERS
318 rc = RTR0MemObjLockUser(&hObj, (RTR3PTR)pSrcParm->u.Pointer.u.linearAddr, cb, fAccess, NIL_RTR0PROCESS);
319 if (RT_FAILURE(rc))
320 {
321 Log(("GstHGCMCall: id=%#x fn=%u parm=%u RTR0MemObjLockUser(,%p,%#x,nil) -> %Rrc\n",
322 pCallInfo->u32ClientID, pCallInfo->u32Function, iParm, pSrcParm->u.Pointer.u.linearAddr, cb, rc));
323 return rc;
324 }
325 Log3(("GstHGCMCall: parm=%u type=%#x: cb=%#010x pv=%p locked user -> %p\n",
326 iParm, pSrcParm->type, cb, pSrcParm->u.Pointer.u.linearAddr, hObj));
327
328#else /* USE_BOUNCE_BUFFERS */
329 /*
330 * This is a bit massive, but we don't want to waste a
331 * whole page for a 3 byte string buffer (guest props).
332 *
333 * The threshold is ASSUMING sizeof(RTMEMHDR) == 16 and
334 * the system is using some power of two allocator.
335 */
336 /** @todo A more efficient strategy would be to combine buffers. However it
337 * is probably going to be more massive than the current code, so
338 * it can wait till later. */
339 bool fCopyIn = pSrcParm->type != VMMDevHGCMParmType_LinAddr_Out
340 && pSrcParm->type != VMMDevHGCMParmType_LinAddr_Locked_Out;
341 if (cb <= PAGE_SIZE / 2 - 16)
342 {
343 pvSmallBuf = fCopyIn ? RTMemTmpAlloc(cb) : RTMemTmpAllocZ(cb);
344 if (RT_UNLIKELY(!pvSmallBuf))
345 return VERR_NO_MEMORY;
346 if (fCopyIn)
347 {
348 rc = RTR0MemUserCopyFrom(pvSmallBuf, pSrcParm->u.Pointer.u.linearAddr, cb);
349 if (RT_FAILURE(rc))
350 {
351 RTMemTmpFree(pvSmallBuf);
352 Log(("GstHGCMCall: id=%#x fn=%u parm=%u RTR0MemUserCopyFrom(,%p,%#x) -> %Rrc\n",
353 pCallInfo->u32ClientID, pCallInfo->u32Function, iParm,
354 pSrcParm->u.Pointer.u.linearAddr, cb, rc));
355 return rc;
356 }
357 }
358 rc = RTR0MemObjLockKernel(&hObj, pvSmallBuf, cb, fAccess);
359 if (RT_FAILURE(rc))
360 {
361 RTMemTmpFree(pvSmallBuf);
362 Log(("GstHGCMCall: RTR0MemObjLockKernel failed for small buffer: rc=%Rrc pvSmallBuf=%p cb=%#x\n",
363 rc, pvSmallBuf, cb));
364 return rc;
365 }
366 Log3(("GstHGCMCall: parm=%u type=%#x: cb=%#010x pv=%p small buffer %p -> %p\n",
367 iParm, pSrcParm->type, cb, pSrcParm->u.Pointer.u.linearAddr, pvSmallBuf, hObj));
368 }
369 else
370 {
371 rc = RTR0MemObjAllocPage(&hObj, cb, false /*fExecutable*/);
372 if (RT_FAILURE(rc))
373 return rc;
374 if (!fCopyIn)
375 memset(RTR0MemObjAddress(hObj), '\0', cb);
376 else
377 {
378 rc = RTR0MemUserCopyFrom(RTR0MemObjAddress(hObj), pSrcParm->u.Pointer.u.linearAddr, cb);
379 if (RT_FAILURE(rc))
380 {
381 RTR0MemObjFree(hObj, false /*fFreeMappings*/);
382 Log(("GstHGCMCall: id=%#x fn=%u parm=%u RTR0MemUserCopyFrom(,%p,%#x) -> %Rrc\n",
383 pCallInfo->u32ClientID, pCallInfo->u32Function, iParm,
384 pSrcParm->u.Pointer.u.linearAddr, cb, rc));
385 return rc;
386 }
387 }
388 Log3(("GstHGCMCall: parm=%u type=%#x: cb=%#010x pv=%p big buffer -> %p\n",
389 iParm, pSrcParm->type, cb, pSrcParm->u.Pointer.u.linearAddr, hObj));
390 }
391#endif /* USE_BOUNCE_BUFFERS */
392 }
393
394 pParmInfo->aLockBufs[iLockBuf].iParm = iParm;
395 pParmInfo->aLockBufs[iLockBuf].hObj = hObj;
396#ifdef USE_BOUNCE_BUFFERS
397 pParmInfo->aLockBufs[iLockBuf].pvSmallBuf = pvSmallBuf;
398#endif
399 pParmInfo->cLockBufs = iLockBuf + 1;
400
401 if (VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ false))
402 {
403 size_t const cPages = RTR0MemObjSize(hObj) >> PAGE_SHIFT;
404 *pcbExtra += RT_OFFSETOF(HGCMPageListInfo, aPages[cPages]);
405 }
406 }
407 else
408 Log4(("GstHGCMCall: parm=%u type=%#x: cb=0\n", iParm, pSrcParm->type));
409 break;
410
411 default:
412 return VERR_INVALID_PARAMETER;
413 }
414 }
415
416 return VINF_SUCCESS;
417}
418
419
420/**
421 * Translates locked linear address to the normal type.
422 * The locked types are only for the guest side and not handled by the host.
423 *
424 * @returns normal linear address type.
425 * @param enmType The type.
426 */
427static HGCMFunctionParameterType vbglR0HGCMInternalConvertLinAddrType(HGCMFunctionParameterType enmType)
428{
429 switch (enmType)
430 {
431 case VMMDevHGCMParmType_LinAddr_Locked_In:
432 return VMMDevHGCMParmType_LinAddr_In;
433 case VMMDevHGCMParmType_LinAddr_Locked_Out:
434 return VMMDevHGCMParmType_LinAddr_Out;
435 case VMMDevHGCMParmType_LinAddr_Locked:
436 return VMMDevHGCMParmType_LinAddr;
437 default:
438 return enmType;
439 }
440}
441
442
443/**
444 * Translates linear address types to page list direction flags.
445 *
446 * @returns page list flags.
447 * @param enmType The type.
448 */
449static uint32_t vbglR0HGCMInternalLinAddrTypeToPageListFlags(HGCMFunctionParameterType enmType)
450{
451 switch (enmType)
452 {
453 case VMMDevHGCMParmType_LinAddr_In:
454 case VMMDevHGCMParmType_LinAddr_Locked_In:
455 return VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;
456
457 case VMMDevHGCMParmType_LinAddr_Out:
458 case VMMDevHGCMParmType_LinAddr_Locked_Out:
459 return VBOX_HGCM_F_PARM_DIRECTION_FROM_HOST;
460
461 default: AssertFailed();
462 case VMMDevHGCMParmType_LinAddr:
463 case VMMDevHGCMParmType_LinAddr_Locked:
464 return VBOX_HGCM_F_PARM_DIRECTION_BOTH;
465 }
466}
467
468
469/**
470 * Initializes the call request that we're sending to the host.
471 *
472 * @returns VBox status code.
473 *
474 * @param pCallInfo The call info.
475 * @param cbCallInfo The size of the call info structure.
476 * @param fIsUser Is it a user request or kernel request.
477 * @param pcbExtra Where to return the extra request space needed for
478 * physical page lists.
479 */
480static void vbglR0HGCMInternalInitCall(VMMDevHGCMCall *pHGCMCall, VBoxGuestHGCMCallInfo const *pCallInfo,
481 uint32_t cbCallInfo, bool fIsUser, struct VbglR0ParmInfo *pParmInfo)
482{
483 HGCMFunctionParameter const *pSrcParm = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo);
484 HGCMFunctionParameter *pDstParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall);
485 uint32_t cParms = pCallInfo->cParms;
486 uint32_t offExtra = (uintptr_t)(pDstParm + cParms) - (uintptr_t)pHGCMCall;
487 uint32_t iLockBuf = 0;
488 uint32_t iParm;
489
490
491 /*
492 * The call request headers.
493 */
494 pHGCMCall->header.fu32Flags = 0;
495 pHGCMCall->header.result = VINF_SUCCESS;
496
497 pHGCMCall->u32ClientID = pCallInfo->u32ClientID;
498 pHGCMCall->u32Function = pCallInfo->u32Function;
499 pHGCMCall->cParms = cParms;
500
501 /*
502 * The parameters.
503 */
504 for (iParm = 0; iParm < pCallInfo->cParms; iParm++, pSrcParm++, pDstParm++)
505 {
506 switch (pSrcParm->type)
507 {
508 case VMMDevHGCMParmType_32bit:
509 case VMMDevHGCMParmType_64bit:
510 *pDstParm = *pSrcParm;
511 break;
512
513 case VMMDevHGCMParmType_PageList:
514 pDstParm->type = VMMDevHGCMParmType_PageList;
515 pDstParm->u.PageList.size = pSrcParm->u.PageList.size;
516 if (pSrcParm->u.PageList.size)
517 {
518 HGCMPageListInfo const *pSrcPgLst = (HGCMPageListInfo *)((uint8_t *)pCallInfo + pSrcParm->u.PageList.offset);
519 HGCMPageListInfo *pDstPgLst = (HGCMPageListInfo *)((uint8_t *)pHGCMCall + offExtra);
520 uint32_t const cPages = pSrcPgLst->cPages;
521 uint32_t iPage;
522
523 pDstParm->u.PageList.offset = offExtra;
524 pDstPgLst->flags = pSrcPgLst->flags;
525 pDstPgLst->offFirstPage = pSrcPgLst->offFirstPage;
526 pDstPgLst->cPages = cPages;
527 for (iPage = 0; iPage < cPages; iPage++)
528 pDstPgLst->aPages[iPage] = pSrcPgLst->aPages[iPage];
529
530 offExtra += RT_OFFSETOF(HGCMPageListInfo, aPages[cPages]);
531 }
532 else
533 pDstParm->u.PageList.offset = 0;
534 break;
535
536 case VMMDevHGCMParmType_LinAddr_Locked_In:
537 case VMMDevHGCMParmType_LinAddr_Locked_Out:
538 case VMMDevHGCMParmType_LinAddr_Locked:
539 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
540 {
541 *pDstParm = *pSrcParm;
542 pDstParm->type = vbglR0HGCMInternalConvertLinAddrType(pSrcParm->type);
543 break;
544 }
545 /* fall thru */
546
547 case VMMDevHGCMParmType_LinAddr_In:
548 case VMMDevHGCMParmType_LinAddr_Out:
549 case VMMDevHGCMParmType_LinAddr:
550 if (pSrcParm->u.Pointer.size != 0)
551 {
552#ifdef USE_BOUNCE_BUFFERS
553 void *pvSmallBuf = pParmInfo->aLockBufs[iLockBuf].pvSmallBuf;
554#endif
555 RTR0MEMOBJ hObj = pParmInfo->aLockBufs[iLockBuf].hObj;
556 Assert(iParm == pParmInfo->aLockBufs[iLockBuf].iParm);
557
558 if (VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ false))
559 {
560 HGCMPageListInfo *pDstPgLst = (HGCMPageListInfo *)((uint8_t *)pHGCMCall + offExtra);
561 size_t const cPages = RTR0MemObjSize(hObj) >> PAGE_SHIFT;
562 size_t iPage;
563
564 pDstParm->type = VMMDevHGCMParmType_PageList;
565 pDstParm->u.PageList.size = pSrcParm->u.Pointer.size;
566 pDstParm->u.PageList.offset = offExtra;
567 pDstPgLst->flags = vbglR0HGCMInternalLinAddrTypeToPageListFlags(pSrcParm->type);
568#ifdef USE_BOUNCE_BUFFERS
569 if (fIsUser)
570 pDstPgLst->offFirstPage = (uintptr_t)pvSmallBuf & PAGE_OFFSET_MASK;
571 else
572#endif
573 pDstPgLst->offFirstPage = pSrcParm->u.Pointer.u.linearAddr & PAGE_OFFSET_MASK;
574 pDstPgLst->cPages = cPages; Assert(pDstPgLst->cPages == cPages);
575 for (iPage = 0; iPage < cPages; iPage++)
576 {
577 pDstPgLst->aPages[iPage] = RTR0MemObjGetPagePhysAddr(hObj, iPage);
578 Assert(pDstPgLst->aPages[iPage] != NIL_RTHCPHYS);
579 }
580
581 offExtra += RT_OFFSETOF(HGCMPageListInfo, aPages[cPages]);
582 }
583 else
584 {
585 pDstParm->type = vbglR0HGCMInternalConvertLinAddrType(pSrcParm->type);
586 pDstParm->u.Pointer.size = pSrcParm->u.Pointer.size;
587#ifdef USE_BOUNCE_BUFFERS
588 if (fIsUser)
589 pDstParm->u.Pointer.u.linearAddr = pvSmallBuf
590 ? (uintptr_t)pvSmallBuf
591 : (uintptr_t)RTR0MemObjAddress(hObj);
592 else
593#endif
594 pDstParm->u.Pointer.u.linearAddr = pSrcParm->u.Pointer.u.linearAddr;
595 }
596 iLockBuf++;
597 }
598 else
599 {
600 pDstParm->type = vbglR0HGCMInternalConvertLinAddrType(pSrcParm->type);
601 pDstParm->u.Pointer.size = 0;
602 pDstParm->u.Pointer.u.linearAddr = 0;
603 }
604 break;
605
606 default:
607 AssertFailed();
608 pDstParm->type = VMMDevHGCMParmType_Invalid;
609 break;
610 }
611 }
612}
613
614
615/**
616 * Performs the call and completion wait.
617 *
618 * @returns VBox status code of this operation, not necessarily the call.
619 *
620 * @param pHGCMCall The HGCM call info.
621 * @param pfnAsyncCallback The async callback that will wait for the call
622 * to complete.
623 * @param pvAsyncData Argument for the callback.
624 * @param u32AsyncData Argument for the callback.
625 * @param pfLeakIt Where to return the leak it / free it,
626 * indicator. Cancellation fun.
627 */
628static int vbglR0HGCMInternalDoCall(VMMDevHGCMCall *pHGCMCall, PFNVBGLHGCMCALLBACK pfnAsyncCallback,
629 void *pvAsyncData, uint32_t u32AsyncData, bool *pfLeakIt)
630{
631 int rc;
632
633 Log(("calling VbglGRPerform\n"));
634 rc = VbglGRPerform(&pHGCMCall->header.header);
635 Log(("VbglGRPerform rc = %Rrc (header rc=%d)\n", rc, pHGCMCall->header.result));
636
637 /*
638 * If the call failed, but as a result of the request itself, then pretend
639 * success. Upper layers will interpret the result code in the packet.
640 */
641 if ( RT_FAILURE(rc)
642 && rc == pHGCMCall->header.result)
643 {
644 Assert(pHGCMCall->header.fu32Flags & VBOX_HGCM_REQ_DONE);
645 rc = VINF_SUCCESS;
646 }
647
648 /*
649 * Check if host decides to process the request asynchronously,
650 * if so, we wait for it to complete using the caller supplied callback.
651 */
652 *pfLeakIt = false;
653 if (rc == VINF_HGCM_ASYNC_EXECUTE)
654 {
655 Log(("Processing HGCM call asynchronously\n"));
656 rc = pfnAsyncCallback(&pHGCMCall->header, pvAsyncData, u32AsyncData);
657 if (pHGCMCall->header.fu32Flags & VBOX_HGCM_REQ_DONE)
658 {
659 Assert(!(pHGCMCall->header.fu32Flags & VBOX_HGCM_REQ_CANCELLED));
660 rc = VINF_SUCCESS;
661 }
662 else
663 {
664 /*
665 * The request didn't complete in time or the call was interrupted,
666 * the RC from the callback indicates which. Try cancel the request.
667 *
668 * This is a bit messy because we're racing request completion. Sorry.
669 */
670 /** @todo It would be nice if we could use the waiter callback to do further
671 * waiting in case of a completion race. If it wasn't for WINNT having its own
672 * version of all that stuff, I would've done it already. */
673 VMMDevHGCMCancel2 *pCancelReq;
674 int rc2 = VbglGRAlloc((VMMDevRequestHeader **)&pCancelReq, sizeof(*pCancelReq), VMMDevReq_HGCMCancel2);
675 if (RT_SUCCESS(rc2))
676 {
677 pCancelReq->physReqToCancel = VbglPhysHeapGetPhysAddr(pHGCMCall);
678 rc2 = VbglGRPerform(&pCancelReq->header);
679 VbglGRFree(&pCancelReq->header);
680 }
681#if 1 /** @todo ADDVER: Remove this on next minor version change. */
682 if (rc2 == VERR_NOT_IMPLEMENTED)
683 {
684 /* host is too old, or we're out of heap. */
685 pHGCMCall->header.fu32Flags |= VBOX_HGCM_REQ_CANCELLED;
686 pHGCMCall->header.header.requestType = VMMDevReq_HGCMCancel;
687 rc2 = VbglGRPerform(&pHGCMCall->header.header);
688 if (rc2 == VERR_INVALID_PARAMETER)
689 rc2 = VERR_NOT_FOUND;
690 else if (RT_SUCCESS(rc))
691 RTThreadSleep(1);
692 }
693#endif
694 if (RT_SUCCESS(rc)) rc = VERR_INTERRUPTED; /** @todo weed this out from the WINNT VBoxGuest code. */
695 if (RT_SUCCESS(rc2))
696 {
697 Log(("vbglR0HGCMInternalDoCall: successfully cancelled\n"));
698 pHGCMCall->header.fu32Flags |= VBOX_HGCM_REQ_CANCELLED;
699 }
700 else
701 {
702 /*
703 * Wait for a bit while the host (hopefully) completes it.
704 */
705 uint64_t u64Start = RTTimeSystemMilliTS();
706 uint32_t cMilliesToWait = rc2 == VERR_NOT_FOUND || rc2 == VERR_SEM_DESTROYED ? 500 : 2000;
707 uint64_t cElapsed = 0;
708 if (rc2 != VERR_NOT_FOUND)
709 {
710 static unsigned s_cErrors = 0;
711 if (s_cErrors++ < 32)
712 LogRel(("vbglR0HGCMInternalDoCall: Failed to cancel the HGCM call on %Rrc: rc2=%Rrc\n", rc, rc2));
713 }
714 else
715 Log(("vbglR0HGCMInternalDoCall: Cancel race rc=%Rrc rc2=%Rrc\n", rc, rc2));
716
717 do
718 {
719 ASMCompilerBarrier(); /* paranoia */
720 if (pHGCMCall->header.fu32Flags & VBOX_HGCM_REQ_DONE)
721 break;
722 RTThreadSleep(1);
723 cElapsed = RTTimeSystemMilliTS() - u64Start;
724 } while (cElapsed < cMilliesToWait);
725
726 ASMCompilerBarrier(); /* paranoia^2 */
727 if (pHGCMCall->header.fu32Flags & VBOX_HGCM_REQ_DONE)
728 rc = VINF_SUCCESS;
729 else
730 {
731 LogRel(("vbglR0HGCMInternalDoCall: Leaking %u bytes. Pending call to %u with %u parms. (rc2=%Rrc)\n",
732 pHGCMCall->header.header.size, pHGCMCall->u32Function, pHGCMCall->cParms, rc2));
733 *pfLeakIt = true;
734 }
735 Log(("vbglR0HGCMInternalDoCall: Cancel race ended with rc=%Rrc (rc2=%Rrc) after %llu ms\n", rc, rc2, cElapsed));
736 }
737 }
738 }
739
740 Log(("GstHGCMCall: rc=%Rrc result=%Rrc fu32Flags=%#x fLeakIt=%d\n",
741 rc, pHGCMCall->header.result, pHGCMCall->header.fu32Flags, *pfLeakIt));
742 return rc;
743}
744
745
746/**
747 * Copies the result of the call back to the caller info structure and user
748 * buffers (if using bounce buffers).
749 *
750 * @returns rc, unless RTR0MemUserCopyTo fails.
751 * @param pCallInfo Call info structure to update.
752 * @param pHGCMCall HGCM call request.
753 * @param pParmInfo Parameter locking/buffering info.
754 * @param fIsUser Is it a user (true) or kernel request.
755 * @param rc The current result code. Passed along to
756 * preserve informational status codes.
757 */
758static int vbglR0HGCMInternalCopyBackResult(VBoxGuestHGCMCallInfo *pCallInfo, VMMDevHGCMCall const *pHGCMCall,
759 struct VbglR0ParmInfo *pParmInfo, bool fIsUser, int rc)
760{
761 HGCMFunctionParameter const *pSrcParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall);
762 HGCMFunctionParameter *pDstParm = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo);
763 uint32_t cParms = pCallInfo->cParms;
764#ifdef USE_BOUNCE_BUFFERS
765 uint32_t iLockBuf = 0;
766#endif
767 uint32_t iParm;
768
769 /*
770 * The call result.
771 */
772 pCallInfo->result = pHGCMCall->header.result;
773
774 /*
775 * Copy back parameters.
776 */
777 for (iParm = 0; iParm < cParms; iParm++, pSrcParm++, pDstParm++)
778 {
779 switch (pDstParm->type)
780 {
781 case VMMDevHGCMParmType_32bit:
782 case VMMDevHGCMParmType_64bit:
783 *pDstParm = *pSrcParm;
784 break;
785
786 case VMMDevHGCMParmType_PageList:
787 pDstParm->u.PageList.size = pSrcParm->u.PageList.size;
788 break;
789
790 case VMMDevHGCMParmType_LinAddr_Locked_In:
791 case VMMDevHGCMParmType_LinAddr_In:
792#ifdef USE_BOUNCE_BUFFERS
793 if ( fIsUser
794 && iLockBuf < pParmInfo->cLockBufs
795 && iParm == pParmInfo->aLockBufs[iLockBuf].iParm)
796 iLockBuf++;
797#endif
798 pDstParm->u.Pointer.size = pSrcParm->u.Pointer.size;
799 break;
800
801 case VMMDevHGCMParmType_LinAddr_Locked_Out:
802 case VMMDevHGCMParmType_LinAddr_Locked:
803 if (!VBGLR0_CAN_USE_PHYS_PAGE_LIST(/*a_fLocked =*/ true))
804 {
805 pDstParm->u.Pointer.size = pSrcParm->u.Pointer.size;
806 break;
807 }
808 /* fall thru */
809
810 case VMMDevHGCMParmType_LinAddr_Out:
811 case VMMDevHGCMParmType_LinAddr:
812 {
813#ifdef USE_BOUNCE_BUFFERS
814 if (fIsUser)
815 {
816 size_t cbOut = RT_MIN(pSrcParm->u.Pointer.size, pDstParm->u.Pointer.size);
817 if (cbOut)
818 {
819 int rc2;
820 Assert(pParmInfo->aLockBufs[iLockBuf].iParm == iParm);
821 rc2 = RTR0MemUserCopyTo((RTR3PTR)pDstParm->u.Pointer.u.linearAddr,
822 pParmInfo->aLockBufs[iLockBuf].pvSmallBuf
823 ? pParmInfo->aLockBufs[iLockBuf].pvSmallBuf
824 : RTR0MemObjAddress(pParmInfo->aLockBufs[iLockBuf].hObj),
825 cbOut);
826 if (RT_FAILURE(rc2))
827 return rc2;
828 iLockBuf++;
829 }
830 else if ( iLockBuf < pParmInfo->cLockBufs
831 && iParm == pParmInfo->aLockBufs[iLockBuf].iParm)
832 iLockBuf++;
833 }
834#endif
835 pDstParm->u.Pointer.size = pSrcParm->u.Pointer.size;
836 break;
837 }
838
839 default:
840 AssertFailed();
841 rc = VERR_INTERNAL_ERROR_4;
842 break;
843 }
844 }
845
846#ifdef USE_BOUNCE_BUFFERS
847 Assert(!fIsUser || pParmInfo->cLockBufs == iLockBuf);
848#endif
849 return rc;
850}
851
852
853DECLR0VBGL(int) VbglR0HGCMInternalCall(VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
854 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData)
855{
856 bool fIsUser = (fFlags & VBGLR0_HGCMCALL_F_MODE_MASK) == VBGLR0_HGCMCALL_F_USER;
857 struct VbglR0ParmInfo ParmInfo;
858 size_t cbExtra;
859 int rc;
860
861 /*
862 * Basic validation.
863 */
864 AssertMsgReturn( !pCallInfo
865 || !pfnAsyncCallback
866 || pCallInfo->cParms > VBOX_HGCM_MAX_PARMS
867 || !(fFlags & ~VBGLR0_HGCMCALL_F_MODE_MASK),
868 ("pCallInfo=%p pfnAsyncCallback=%p fFlags=%#x\n", pCallInfo, pfnAsyncCallback, fFlags),
869 VERR_INVALID_PARAMETER);
870 AssertReturn( cbCallInfo >= sizeof(VBoxGuestHGCMCallInfo)
871 || cbCallInfo >= pCallInfo->cParms * sizeof(HGCMFunctionParameter),
872 VERR_INVALID_PARAMETER);
873
874 Log(("GstHGCMCall: u32ClientID=%#x u32Function=%u cParms=%u cbCallInfo=%#x fFlags=%#x\n",
875 pCallInfo->u32ClientID, pCallInfo->u32ClientID, pCallInfo->u32Function, pCallInfo->cParms, cbCallInfo, fFlags));
876
877 /*
878 * Validate, lock and buffer the parameters for the call.
879 * This will calculate the amount of extra space for physical page list.
880 */
881 rc = vbglR0HGCMInternalPreprocessCall(pCallInfo, cbCallInfo, fIsUser, &ParmInfo, &cbExtra);
882 if (RT_SUCCESS(rc))
883 {
884 /*
885 * Allocate the request buffer and recreate the call request.
886 */
887 VMMDevHGCMCall *pHGCMCall;
888 rc = VbglGRAlloc((VMMDevRequestHeader **)&pHGCMCall,
889 sizeof(VMMDevHGCMCall) + pCallInfo->cParms * sizeof(HGCMFunctionParameter) + cbExtra,
890 VMMDevReq_HGCMCall);
891 if (RT_SUCCESS(rc))
892 {
893 bool fLeakIt;
894 vbglR0HGCMInternalInitCall(pHGCMCall, pCallInfo, cbCallInfo, fIsUser, &ParmInfo);
895
896 /*
897 * Perform the call.
898 */
899 rc = vbglR0HGCMInternalDoCall(pHGCMCall, pfnAsyncCallback, pvAsyncData, u32AsyncData, &fLeakIt);
900 if (RT_SUCCESS(rc))
901 {
902 /*
903 * Copy back the result (parameters and buffers that changed).
904 */
905 rc = vbglR0HGCMInternalCopyBackResult(pCallInfo, pHGCMCall, &ParmInfo, fIsUser, rc);
906 }
907 else
908 {
909 if ( rc != VERR_INTERRUPTED
910 && rc != VERR_TIMEOUT)
911 {
912 static unsigned s_cErrors = 0;
913 if (s_cErrors++ < 32)
914 LogRel(("VbglR0HGCMInternalCall: vbglR0HGCMInternalDoCall failed. rc=%Rrc\n", rc));
915 }
916 }
917
918 if (!fLeakIt)
919 VbglGRFree(&pHGCMCall->header.header);
920 }
921 }
922 else
923 LogRel(("VbglR0HGCMInternalCall: vbglR0HGCMInternalPreprocessCall failed. rc=%Rrc\n", rc));
924
925 /*
926 * Release locks and free bounce buffers.
927 */
928 if (ParmInfo.cLockBufs)
929 while (ParmInfo.cLockBufs-- > 0)
930 {
931 RTR0MemObjFree(ParmInfo.aLockBufs[ParmInfo.cLockBufs].hObj, false /*fFreeMappings*/);
932#ifdef USE_BOUNCE_BUFFERS
933 RTMemTmpFree(ParmInfo.aLockBufs[ParmInfo.cLockBufs].pvSmallBuf);
934#endif
935 }
936
937 return rc;
938}
939
940
941#if ARCH_BITS == 64
942DECLR0VBGL(int) VbglR0HGCMInternalCall32(VBoxGuestHGCMCallInfo *pCallInfo, uint32_t cbCallInfo, uint32_t fFlags,
943 PFNVBGLHGCMCALLBACK pfnAsyncCallback, void *pvAsyncData, uint32_t u32AsyncData)
944{
945 VBoxGuestHGCMCallInfo *pCallInfo64 = NULL;
946 HGCMFunctionParameter *pParm64 = NULL;
947 HGCMFunctionParameter32 *pParm32 = NULL;
948 uint32_t cParms = 0;
949 uint32_t iParm = 0;
950 int rc = VINF_SUCCESS;
951
952 /*
953 * Input validation.
954 */
955 AssertMsgReturn( !pCallInfo
956 || !pfnAsyncCallback
957 || pCallInfo->cParms > VBOX_HGCM_MAX_PARMS
958 || !(fFlags & ~VBGLR0_HGCMCALL_F_MODE_MASK),
959 ("pCallInfo=%p pfnAsyncCallback=%p fFlags=%#x\n", pCallInfo, pfnAsyncCallback, fFlags),
960 VERR_INVALID_PARAMETER);
961 AssertReturn( cbCallInfo >= sizeof(VBoxGuestHGCMCallInfo)
962 || cbCallInfo >= pCallInfo->cParms * sizeof(HGCMFunctionParameter32),
963 VERR_INVALID_PARAMETER);
964
965 /* This Assert does not work on Solaris/Windows 64/32 mixed mode, not sure why, skipping for now */
966#if !defined(RT_OS_SOLARIS) && !defined(RT_OS_WINDOWS)
967 AssertReturn((fFlags & VBGLR0_HGCMCALL_F_MODE_MASK) == VBGLR0_HGCMCALL_F_KERNEL, VERR_WRONG_ORDER);
968#endif
969
970 cParms = pCallInfo->cParms;
971 Log(("VbglR0HGCMInternalCall32: cParms=%d, u32Function=%d, fFlags=%#x\n", cParms, pCallInfo->u32Function, fFlags));
972
973 /*
974 * The simple approach, allocate a temporary request and convert the parameters.
975 */
976 pCallInfo64 = (VBoxGuestHGCMCallInfo *)RTMemTmpAllocZ(sizeof(*pCallInfo64) + cParms * sizeof(HGCMFunctionParameter));
977 if (!pCallInfo64)
978 return VERR_NO_TMP_MEMORY;
979
980 *pCallInfo64 = *pCallInfo;
981 pParm32 = VBOXGUEST_HGCM_CALL_PARMS32(pCallInfo);
982 pParm64 = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo64);
983 for (iParm = 0; iParm < cParms; iParm++, pParm32++, pParm64++)
984 {
985 switch (pParm32->type)
986 {
987 case VMMDevHGCMParmType_32bit:
988 pParm64->type = VMMDevHGCMParmType_32bit;
989 pParm64->u.value32 = pParm32->u.value32;
990 break;
991
992 case VMMDevHGCMParmType_64bit:
993 pParm64->type = VMMDevHGCMParmType_64bit;
994 pParm64->u.value64 = pParm32->u.value64;
995 break;
996
997 case VMMDevHGCMParmType_LinAddr_Out:
998 case VMMDevHGCMParmType_LinAddr:
999 case VMMDevHGCMParmType_LinAddr_In:
1000 pParm64->type = pParm32->type;
1001 pParm64->u.Pointer.size = pParm32->u.Pointer.size;
1002 pParm64->u.Pointer.u.linearAddr = pParm32->u.Pointer.u.linearAddr;
1003 break;
1004
1005 default:
1006 rc = VERR_INVALID_PARAMETER;
1007 LogRel(("VbglR0HGCMInternalCall32: pParm32 type %#x invalid.\n", pParm32->type));
1008 break;
1009 }
1010 if (RT_FAILURE(rc))
1011 break;
1012 }
1013 if (RT_SUCCESS(rc))
1014 {
1015 rc = VbglR0HGCMInternalCall(pCallInfo64, sizeof(*pCallInfo64) + cParms * sizeof(HGCMFunctionParameter), fFlags,
1016 pfnAsyncCallback, pvAsyncData, u32AsyncData);
1017
1018 if (RT_SUCCESS(rc))
1019 {
1020 *pCallInfo = *pCallInfo64;
1021
1022 /*
1023 * Copy back.
1024 */
1025 pParm32 = VBOXGUEST_HGCM_CALL_PARMS32(pCallInfo);
1026 pParm64 = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo64);
1027 for (iParm = 0; iParm < cParms; iParm++, pParm32++, pParm64++)
1028 {
1029 switch (pParm64->type)
1030 {
1031 case VMMDevHGCMParmType_32bit:
1032 pParm32->u.value32 = pParm64->u.value32;
1033 break;
1034
1035 case VMMDevHGCMParmType_64bit:
1036 pParm32->u.value64 = pParm64->u.value64;
1037 break;
1038
1039 case VMMDevHGCMParmType_LinAddr_Out:
1040 case VMMDevHGCMParmType_LinAddr:
1041 case VMMDevHGCMParmType_LinAddr_In:
1042 pParm32->u.Pointer.size = pParm64->u.Pointer.size;
1043 break;
1044
1045 default:
1046 LogRel(("VbglR0HGCMInternalCall32: failed invalid pParm32 type %d\n", pParm32->type));
1047 rc = VERR_INTERNAL_ERROR_3;
1048 break;
1049 }
1050 }
1051 }
1052 else
1053 {
1054 static unsigned s_cErrors = 0;
1055 if (s_cErrors++ < 32)
1056 LogRel(("VbglR0HGCMInternalCall32: VbglR0HGCMInternalCall failed. rc=%Rrc\n", rc));
1057 }
1058 }
1059 else
1060 {
1061 static unsigned s_cErrors = 0;
1062 if (s_cErrors++ < 32)
1063 LogRel(("VbglR0HGCMInternalCall32: failed. rc=%Rrc\n", rc));
1064 }
1065
1066 RTMemTmpFree(pCallInfo64);
1067 return rc;
1068}
1069#endif /* ARCH_BITS == 64 */
1070
1071#endif /* VBGL_VBOXGUEST */
1072
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette