- Timestamp:
- Jun 5, 2008 3:39:11 PM (17 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r8857 r9435 153 153 pParm->type = VMMDevHGCMParmType_LinAddr; 154 154 pParm->u.Pointer.size = cb; 155 pParm->u.Pointer.u.linearAddr = ( RTGCPTR)pv;155 pParm->u.Pointer.u.linearAddr = (uintptr_t)pv; 156 156 } 157 157 -
trunk/src/VBox/Additions/common/VBoxGuestLib/GenericRequest.cpp
r8155 r9435 76 76 77 77 physaddr = VbglPhysHeapGetPhysAddr (pReq); 78 if (!physaddr) 78 if ( !physaddr 79 || (physaddr >> 32) != 0) /* Port IO is 32 bit. */ 79 80 { 80 81 rc = VERR_VBGL_INVALID_ADDR; -
trunk/src/VBox/Additions/common/VBoxGuestLib/PhysHeap.cpp
r8155 r9435 305 305 306 306 physAddr = 0; 307 /* This function allocates physical contiguous memory (below 4GB) according to the IPRT docs. 308 * Address < 4G is required for the port IO. 309 */ 307 310 pChunk = (VBGLPHYSHEAPCHUNK *)RTMemContAlloc (&physAddr, cbSize); 308 311 -
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxCalls.c
r8155 r9435 129 129 data.mappings.type = VMMDevHGCMParmType_LinAddr; 130 130 data.mappings.u.Pointer.size = sizeof (SHFLMAPPING) * *pcMappings; 131 data.mappings.u.Pointer.u.linearAddr = ( RTGCPTR)&paMappings[0];131 data.mappings.u.Pointer.u.linearAddr = (uintptr_t)&paMappings[0]; 132 132 133 133 /* Log(("VBOXSF: in ifs difference %d\n", … … 166 166 data.name.type = VMMDevHGCMParmType_LinAddr; 167 167 data.name.u.Pointer.size = size; 168 data.name.u.Pointer.u.linearAddr = ( RTGCPTR)pString;168 data.name.u.Pointer.u.linearAddr = (uintptr_t)pString; 169 169 170 170 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data)); … … 192 192 data.path.type = VMMDevHGCMParmType_LinAddr; 193 193 data.path.u.Pointer.size = ShflStringSizeOfBuffer (szFolderName); 194 data.path.u.Pointer.u.linearAddr = ( RTGCPTR)szFolderName;194 data.path.u.Pointer.u.linearAddr = (uintptr_t)szFolderName; 195 195 196 196 data.root.type = VMMDevHGCMParmType_32bit; … … 227 227 data.path.type = VMMDevHGCMParmType_LinAddr; 228 228 data.path.u.Pointer.size = ShflStringSizeOfBuffer (szFolderName); 229 data.path.u.Pointer.u.linearAddr = ( RTGCPTR)szFolderName;229 data.path.u.Pointer.u.linearAddr = (uintptr_t)szFolderName; 230 230 231 231 data.root.type = VMMDevHGCMParmType_32bit; … … 284 284 data.path.type = VMMDevHGCMParmType_LinAddr; 285 285 data.path.u.Pointer.size = ShflStringSizeOfBuffer (pParsedPath); 286 data.path.u.Pointer.u.linearAddr = ( RTGCPTR)pParsedPath;286 data.path.u.Pointer.u.linearAddr = (uintptr_t)pParsedPath; 287 287 288 288 data.parms.type = VMMDevHGCMParmType_LinAddr; 289 289 data.parms.u.Pointer.size = sizeof (SHFLCREATEPARMS); 290 data.parms.u.Pointer.u.linearAddr = ( RTGCPTR)pCreateParms;290 data.parms.u.Pointer.u.linearAddr = (uintptr_t)pCreateParms; 291 291 292 292 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data)); … … 343 343 data.path.type = VMMDevHGCMParmType_LinAddr_In; 344 344 data.path.u.Pointer.size = ShflStringSizeOfBuffer (pParsedPath); 345 data.path.u.Pointer.u.linearAddr = ( RTGCPTR)pParsedPath;345 data.path.u.Pointer.u.linearAddr = (uintptr_t)pParsedPath; 346 346 347 347 data.flags.type = VMMDevHGCMParmType_32bit; … … 375 375 data.src.type = VMMDevHGCMParmType_LinAddr_In; 376 376 data.src.u.Pointer.size = ShflStringSizeOfBuffer (pSrcPath); 377 data.src.u.Pointer.u.linearAddr = ( RTGCPTR)pSrcPath;377 data.src.u.Pointer.u.linearAddr = (uintptr_t)pSrcPath; 378 378 379 379 data.dest.type = VMMDevHGCMParmType_LinAddr_In; 380 380 data.dest.u.Pointer.size = ShflStringSizeOfBuffer (pDestPath); 381 data.dest.u.Pointer.u.linearAddr = ( RTGCPTR)pDestPath;381 data.dest.u.Pointer.u.linearAddr = (uintptr_t)pDestPath; 382 382 383 383 data.flags.type = VMMDevHGCMParmType_32bit; … … 416 416 data.buffer.type = (fLocked) ? VMMDevHGCMParmType_LinAddr_Locked_Out : VMMDevHGCMParmType_LinAddr_Out; 417 417 data.buffer.u.Pointer.size = *pcbBuffer; 418 data.buffer.u.Pointer.u.linearAddr = ( RTGCPTR)pBuffer;418 data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer; 419 419 420 420 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data)); … … 451 451 data.buffer.type = (fLocked) ? VMMDevHGCMParmType_LinAddr_Locked_In : VMMDevHGCMParmType_LinAddr_In; 452 452 data.buffer.u.Pointer.size = *pcbBuffer; 453 data.buffer.u.Pointer.u.linearAddr = ( RTGCPTR)pBuffer;453 data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer; 454 454 455 455 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data)); … … 521 521 data.path.u.Pointer.size = 522 522 (ParsedPath) ? ShflStringSizeOfBuffer(ParsedPath) : 0; 523 data.path.u.Pointer.u.linearAddr = ( RTGCPTR) ParsedPath;523 data.path.u.Pointer.u.linearAddr = (uintptr_t) ParsedPath; 524 524 525 525 data.buffer.type = VMMDevHGCMParmType_LinAddr_Out; 526 526 data.buffer.u.Pointer.size = *pcbBuffer; 527 data.buffer.u.Pointer.u.linearAddr = ( RTGCPTR)pBuffer;527 data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer; 528 528 529 529 data.resumePoint.type = VMMDevHGCMParmType_32bit; … … 566 566 data.info.type = VMMDevHGCMParmType_LinAddr; 567 567 data.info.u.Pointer.size = *pcbBuffer; 568 data.info.u.Pointer.u.linearAddr = ( RTGCPTR)pBuffer;568 data.info.u.Pointer.u.linearAddr = (uintptr_t)pBuffer; 569 569 570 570 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data)); -
trunk/src/VBox/Devices/Makefile.kmk
r9408 r9435 226 226 DevicesR3_TEMPLATE = VBOXR3 227 227 DevicesR3_SDKS.win = WINPSDK W2K3DDK 228 DevicesR3_DEFS += VBOX_HGCM_HOST_CODE 228 229 DevicesR3_INCS := \ 229 230 $(PATH_SUB_CURRENT) -
trunk/src/VBox/Devices/VMMDev/VBoxDev.cpp
r8996 r9435 1065 1065 } 1066 1066 1067 #ifdef VBOX_WITH_64_BITS_GUESTS 1068 case VMMDevReq_HGCMCall32: 1069 case VMMDevReq_HGCMCall64: 1070 #else 1067 1071 case VMMDevReq_HGCMCall: 1072 #endif /* VBOX_WITH_64_BITS_GUESTS */ 1068 1073 { 1069 1074 if (pRequestHeader->size < sizeof(VMMDevHGCMCall)) … … 1084 1089 Log2(("%.*Vhxd\n", pRequestHeader->size, pRequestHeader)); 1085 1090 1086 pRequestHeader->rc = vmmdevHGCMCall (pData, pHGCMCall, (RTGCPHYS)u32); 1091 #ifdef VBOX_WITH_64_BITS_GUESTS 1092 bool f64Bits = (pRequestHeader->requestType == VMMDevReq_HGCMCall64); 1093 #else 1094 bool f64Bits = false; 1095 #endif /* VBOX_WITH_64_BITS_GUESTS */ 1096 1097 pRequestHeader->rc = vmmdevHGCMCall (pData, pHGCMCall, (RTGCPHYS)u32, f64Bits); 1087 1098 } 1088 1099 break; -
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
r8155 r9435 349 349 350 350 351 int vmmdevHGCMCall (VMMDevState *pVMMDevState, VMMDevHGCMCall *pHGCMCall, RTGCPHYS GCPhys )351 int vmmdevHGCMCall (VMMDevState *pVMMDevState, VMMDevHGCMCall *pHGCMCall, RTGCPHYS GCPhys, bool f64Bits) 352 352 { 353 353 int rc = VINF_SUCCESS; 354 354 355 Log(("vmmdevHGCMCall: client id = %d, function = %d \n", pHGCMCall->u32ClientID, pHGCMCall->u32Function));355 Log(("vmmdevHGCMCall: client id = %d, function = %d, %s bit\n", pHGCMCall->u32ClientID, pHGCMCall->u32Function, f64Bits? "64": "32")); 356 356 357 357 /* Compute size and allocate memory block to hold: … … 371 371 uint32_t cbCmdSize = sizeof (struct VBOXHGCMCMD) + cParms * sizeof (VBOXHGCMSVCPARM); 372 372 373 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall);374 375 /* Look for pointer parameters, which require a host buffer. */376 373 uint32_t i; 377 374 … … 379 376 uint32_t cLinPtrPages = 0; 380 377 381 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++) 382 { 383 switch (pGuestParm->type) 384 { 385 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 386 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 387 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 378 if (f64Bits) 379 { 380 #ifdef VBOX_WITH_64_BITS_GUESTS 381 HGCMFunctionParameter64 *pGuestParm = VMMDEV_HGCM_CALL_PARMS64(pHGCMCall); 382 #else 383 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall); 384 AssertFailed (); /* This code should not be called in this case */ 385 #endif /* VBOX_WITH_64_BITS_GUESTS */ 386 387 /* Look for pointer parameters, which require a host buffer. */ 388 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++) 389 { 390 switch (pGuestParm->type) 388 391 { 389 cbCmdSize += pGuestParm->u.Pointer.size; 392 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 393 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 394 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 395 { 396 cbCmdSize += pGuestParm->u.Pointer.size; 390 397 391 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 398 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 399 { 400 cLinPtrs++; 401 /* Take the offset into the current page also into account! */ 402 cLinPtrPages += ((pGuestParm->u.Pointer.u.linearAddr & PAGE_OFFSET_MASK) 403 + pGuestParm->u.Pointer.size + PAGE_SIZE - 1) / PAGE_SIZE; 404 } 405 406 Log(("vmmdevHGCMCall: linptr size = %d\n", pGuestParm->u.Pointer.size)); 407 } break; 408 409 case VMMDevHGCMParmType_32bit: 410 case VMMDevHGCMParmType_64bit: 411 case VMMDevHGCMParmType_PhysAddr: 392 412 { 393 cLinPtrs++; 394 /* Take the offset into the current page also into account! */ 395 cLinPtrPages += ((pGuestParm->u.Pointer.u.linearAddr & PAGE_OFFSET_MASK) 396 + pGuestParm->u.Pointer.size + PAGE_SIZE - 1) / PAGE_SIZE; 413 } break; 414 415 default: 416 { 417 AssertMsgFailed(("vmmdevHGCMCall: invalid parameter type %x\n", pGuestParm->type)); 418 rc = VERR_INVALID_PARAMETER; 419 break; 397 420 } 421 } 422 } 423 } 424 else 425 { 426 #ifdef VBOX_WITH_64_BITS_GUESTS 427 HGCMFunctionParameter32 *pGuestParm = VMMDEV_HGCM_CALL_PARMS32(pHGCMCall); 428 #else 429 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall); 430 #endif /* VBOX_WITH_64_BITS_GUESTS */ 431 432 /* Look for pointer parameters, which require a host buffer. */ 433 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++) 434 { 435 switch (pGuestParm->type) 436 { 437 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 438 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 439 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 440 { 441 cbCmdSize += pGuestParm->u.Pointer.size; 398 442 399 Log(("vmmdevHGCMCall: linptr size = %d\n", pGuestParm->u.Pointer.size)); 400 } break; 401 402 case VMMDevHGCMParmType_32bit: 403 case VMMDevHGCMParmType_64bit: 404 case VMMDevHGCMParmType_PhysAddr: 405 { 406 } break; 407 408 default: 409 { 410 AssertMsgFailed(("vmmdevHGCMCall: invalid parameter type %x\n", pGuestParm->type)); 411 rc = VERR_INVALID_PARAMETER; 412 break; 443 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 444 { 445 cLinPtrs++; 446 /* Take the offset into the current page also into account! */ 447 cLinPtrPages += ((pGuestParm->u.Pointer.u.linearAddr & PAGE_OFFSET_MASK) 448 + pGuestParm->u.Pointer.size + PAGE_SIZE - 1) / PAGE_SIZE; 449 } 450 451 Log(("vmmdevHGCMCall: linptr size = %d\n", pGuestParm->u.Pointer.size)); 452 } break; 453 454 case VMMDevHGCMParmType_32bit: 455 case VMMDevHGCMParmType_64bit: 456 case VMMDevHGCMParmType_PhysAddr: 457 { 458 } break; 459 460 default: 461 { 462 AssertMsgFailed(("vmmdevHGCMCall: invalid parameter type %x\n", pGuestParm->type)); 463 rc = VERR_INVALID_PARAMETER; 464 break; 465 } 413 466 } 414 467 } … … 462 515 pCmd->paHostParms = pHostParm; 463 516 464 pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall);465 466 517 uint32_t iLinPtr = 0; 467 518 RTGCPHYS *pPages = (RTGCPHYS *)((uint8_t *)pCmd->paLinPtrs + sizeof (VBOXHGCMLINPTR) *cLinPtrs); 468 519 469 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++, pHostParm++) 470 { 471 switch (pGuestParm->type) 520 if (f64Bits) 521 { 522 #ifdef VBOX_WITH_64_BITS_GUESTS 523 HGCMFunctionParameter64 *pGuestParm = VMMDEV_HGCM_CALL_PARMS64(pHGCMCall); 524 #else 525 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall); 526 AssertFailed (); /* This code should not be called in this case */ 527 #endif /* VBOX_WITH_64_BITS_GUESTS */ 528 529 530 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++, pHostParm++) 472 531 { 473 case VMMDevHGCMParmType_32bit: 474 { 475 uint32_t u32 = pGuestParm->u.value32; 476 477 pHostParm->type = VBOX_HGCM_SVC_PARM_32BIT; 478 pHostParm->u.uint32 = u32; 479 480 Log(("vmmdevHGCMCall: uint32 guest parameter %u\n", u32)); 481 break; 482 } 483 484 case VMMDevHGCMParmType_64bit: 485 { 486 uint64_t u64 = pGuestParm->u.value64; 487 488 pHostParm->type = VBOX_HGCM_SVC_PARM_64BIT; 489 pHostParm->u.uint64 = u64; 490 491 Log(("vmmdevHGCMCall: uint64 guest parameter %llu\n", u64)); 492 break; 493 } 494 495 case VMMDevHGCMParmType_PhysAddr: 496 { 497 uint32_t size = pGuestParm->u.Pointer.size; 532 switch (pGuestParm->type) 533 { 534 case VMMDevHGCMParmType_32bit: 535 { 536 uint32_t u32 = pGuestParm->u.value32; 537 538 pHostParm->type = VBOX_HGCM_SVC_PARM_32BIT; 539 pHostParm->u.uint32 = u32; 540 541 Log(("vmmdevHGCMCall: uint32 guest parameter %u\n", u32)); 542 break; 543 } 544 545 case VMMDevHGCMParmType_64bit: 546 { 547 uint64_t u64 = pGuestParm->u.value64; 548 549 pHostParm->type = VBOX_HGCM_SVC_PARM_64BIT; 550 pHostParm->u.uint64 = u64; 551 552 Log(("vmmdevHGCMCall: uint64 guest parameter %llu\n", u64)); 553 break; 554 } 555 556 case VMMDevHGCMParmType_PhysAddr: 557 { 558 uint32_t size = pGuestParm->u.Pointer.size; 498 559 #ifdef LOG_ENABLED 499 RTGCPHYS physAddr = pGuestParm->u.Pointer.u.physAddr;560 RTGCPHYS physAddr = pGuestParm->u.Pointer.u.physAddr; 500 561 #endif 501 562 502 pHostParm->type = VBOX_HGCM_SVC_PARM_PTR; 503 pHostParm->u.pointer.size = size; 504 505 AssertFailed(); 506 /* rc = PDMDevHlpPhys2HCVirt (pVMMDevState->pDevIns, physAddr, size, &pHostParm->u.pointer.addr); */ 507 508 Log(("vmmdevHGCMCall: PhysAddr guest parameter %VGp\n", physAddr)); 509 break; 510 } 511 512 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 513 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 514 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 515 { 516 uint32_t size = pGuestParm->u.Pointer.size; 517 RTGCPTR linearAddr = pGuestParm->u.Pointer.u.linearAddr; 518 519 pHostParm->type = VBOX_HGCM_SVC_PARM_PTR; 520 pHostParm->u.pointer.size = size; 521 522 /* Copy guest data to an allocated buffer, so 523 * services can use the data. 524 */ 525 526 if (size == 0) 563 pHostParm->type = VBOX_HGCM_SVC_PARM_PTR; 564 pHostParm->u.pointer.size = size; 565 566 AssertFailed(); 567 /* rc = PDMDevHlpPhys2HCVirt (pVMMDevState->pDevIns, physAddr, size, &pHostParm->u.pointer.addr); */ 568 569 Log(("vmmdevHGCMCall: PhysAddr guest parameter %VGp\n", physAddr)); 570 break; 571 } 572 573 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 574 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 575 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 527 576 { 528 pHostParm->u.pointer.addr = (void *) 0xfeeddead; 529 } 530 else 531 { 532 /* Don't overdo it */ 533 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_Out) 534 rc = PDMDevHlpPhysReadGCVirt(pVMMDevState->pDevIns, pcBuf, linearAddr, size); 577 uint32_t size = pGuestParm->u.Pointer.size; 578 RTGCPTR linearAddr = pGuestParm->u.Pointer.u.linearAddr; 579 580 pHostParm->type = VBOX_HGCM_SVC_PARM_PTR; 581 pHostParm->u.pointer.size = size; 582 583 /* Copy guest data to an allocated buffer, so 584 * services can use the data. 585 */ 586 587 if (size == 0) 588 { 589 pHostParm->u.pointer.addr = (void *) 0xfeeddead; 590 } 535 591 else 536 rc = VINF_SUCCESS;537 538 if (VBOX_SUCCESS(rc))539 592 { 540 pHostParm->u.pointer.addr = pcBuf; 541 pcBuf += size; 593 /* Don't overdo it */ 594 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_Out) 595 rc = PDMDevHlpPhysReadGCVirt(pVMMDevState->pDevIns, pcBuf, linearAddr, size); 596 else 597 rc = VINF_SUCCESS; 598 599 if (VBOX_SUCCESS(rc)) 600 { 601 pHostParm->u.pointer.addr = pcBuf; 602 pcBuf += size; 542 603 543 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 544 { 545 /* Remember the guest physical pages that belong to the virtual address 546 * region. 547 */ 548 rc = vmmdevHGCMSaveLinPtr (pVMMDevState->pDevIns, i, linearAddr, size, iLinPtr++, pCmd->paLinPtrs, &pPages); 604 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 605 { 606 /* Remember the guest physical pages that belong to the virtual address 607 * region. 608 */ 609 rc = vmmdevHGCMSaveLinPtr (pVMMDevState->pDevIns, i, linearAddr, size, iLinPtr++, pCmd->paLinPtrs, &pPages); 610 } 549 611 } 550 612 } 613 614 Log(("vmmdevHGCMCall: LinAddr guest parameter %VGv, rc = %Vrc\n", linearAddr, rc)); 615 break; 551 616 } 552 617 553 Log(("vmmdevHGCMCall: LinAddr guest parameter %VGv, rc = %Vrc\n", linearAddr, rc)); 554 break; 555 } 556 557 /* just to shut up gcc */ 558 default: 559 break; 618 /* just to shut up gcc */ 619 default: 620 break; 621 } 622 } 623 } 624 else 625 { 626 #ifdef VBOX_WITH_64_BITS_GUESTS 627 HGCMFunctionParameter32 *pGuestParm = VMMDEV_HGCM_CALL_PARMS32(pHGCMCall); 628 #else 629 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall); 630 #endif /* VBOX_WITH_64_BITS_GUESTS */ 631 632 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++, pHostParm++) 633 { 634 switch (pGuestParm->type) 635 { 636 case VMMDevHGCMParmType_32bit: 637 { 638 uint32_t u32 = pGuestParm->u.value32; 639 640 pHostParm->type = VBOX_HGCM_SVC_PARM_32BIT; 641 pHostParm->u.uint32 = u32; 642 643 Log(("vmmdevHGCMCall: uint32 guest parameter %u\n", u32)); 644 break; 645 } 646 647 case VMMDevHGCMParmType_64bit: 648 { 649 uint64_t u64 = pGuestParm->u.value64; 650 651 pHostParm->type = VBOX_HGCM_SVC_PARM_64BIT; 652 pHostParm->u.uint64 = u64; 653 654 Log(("vmmdevHGCMCall: uint64 guest parameter %llu\n", u64)); 655 break; 656 } 657 658 case VMMDevHGCMParmType_PhysAddr: 659 { 660 uint32_t size = pGuestParm->u.Pointer.size; 661 #ifdef LOG_ENABLED 662 RTGCPHYS physAddr = pGuestParm->u.Pointer.u.physAddr; 663 #endif 664 665 pHostParm->type = VBOX_HGCM_SVC_PARM_PTR; 666 pHostParm->u.pointer.size = size; 667 668 AssertFailed(); 669 /* rc = PDMDevHlpPhys2HCVirt (pVMMDevState->pDevIns, physAddr, size, &pHostParm->u.pointer.addr); */ 670 671 Log(("vmmdevHGCMCall: PhysAddr guest parameter %VGp\n", physAddr)); 672 break; 673 } 674 675 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 676 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 677 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 678 { 679 uint32_t size = pGuestParm->u.Pointer.size; 680 RTGCPTR linearAddr = pGuestParm->u.Pointer.u.linearAddr; 681 682 pHostParm->type = VBOX_HGCM_SVC_PARM_PTR; 683 pHostParm->u.pointer.size = size; 684 685 /* Copy guest data to an allocated buffer, so 686 * services can use the data. 687 */ 688 689 if (size == 0) 690 { 691 pHostParm->u.pointer.addr = (void *) 0xfeeddead; 692 } 693 else 694 { 695 /* Don't overdo it */ 696 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_Out) 697 rc = PDMDevHlpPhysReadGCVirt(pVMMDevState->pDevIns, pcBuf, linearAddr, size); 698 else 699 rc = VINF_SUCCESS; 700 701 if (VBOX_SUCCESS(rc)) 702 { 703 pHostParm->u.pointer.addr = pcBuf; 704 pcBuf += size; 705 706 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 707 { 708 /* Remember the guest physical pages that belong to the virtual address 709 * region. 710 */ 711 rc = vmmdevHGCMSaveLinPtr (pVMMDevState->pDevIns, i, linearAddr, size, iLinPtr++, pCmd->paLinPtrs, &pPages); 712 } 713 } 714 } 715 716 Log(("vmmdevHGCMCall: LinAddr guest parameter %VGv, rc = %Vrc\n", linearAddr, rc)); 717 break; 718 } 719 720 /* just to shut up gcc */ 721 default: 722 break; 723 } 560 724 } 561 725 } … … 595 759 596 760 case VBOXHGCMCMDTYPE_CALL: 597 if (pHeader->header.requestType == VMMDevReq_HGCMCall) return VINF_SUCCESS; 761 #ifdef VBOX_WITH_64_BITS_GUESTS 762 if ( pHeader->header.requestType == VMMDevReq_HGCMCall32 763 || pHeader->header.requestType == VMMDevReq_HGCMCall64) return VINF_SUCCESS; 764 #else 765 if ( pHeader->header.requestType == VMMDevReq_HGCMCall) return VINF_SUCCESS; 766 #endif /* VBOX_WITH_64_BITS_GUESTS */ 767 598 768 break; 599 769 … … 636 806 switch (pHeader->header.requestType) 637 807 { 638 case VMMDevReq_HGCMCall: 808 #ifdef VBOX_WITH_64_BITS_GUESTS 809 case VMMDevReq_HGCMCall64: 639 810 { 640 811 VMMDevHGCMCall *pHGCMCall = (VMMDevHGCMCall *)pHeader; … … 642 813 uint32_t cParms = pHGCMCall->cParms; 643 814 644 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall);645 646 815 VBOXHGCMSVCPARM *pHostParm = pCmd->paHostParms; 647 816 648 817 uint32_t i; 649 818 uint32_t iLinPtr = 0; 819 820 HGCMFunctionParameter64 *pGuestParm = VMMDEV_HGCM_CALL_PARMS64(pHGCMCall); 650 821 651 822 for (i = 0; i < cParms; i++, pGuestParm++, pHostParm++) … … 693 864 } 694 865 866 case VMMDevReq_HGCMCall32: 867 { 868 VMMDevHGCMCall *pHGCMCall = (VMMDevHGCMCall *)pHeader; 869 870 uint32_t cParms = pHGCMCall->cParms; 871 872 VBOXHGCMSVCPARM *pHostParm = pCmd->paHostParms; 873 874 uint32_t i; 875 uint32_t iLinPtr = 0; 876 877 HGCMFunctionParameter32 *pGuestParm = VMMDEV_HGCM_CALL_PARMS32(pHGCMCall); 878 879 for (i = 0; i < cParms; i++, pGuestParm++, pHostParm++) 880 { 881 switch (pGuestParm->type) 882 { 883 case VMMDevHGCMParmType_32bit: 884 { 885 pGuestParm->u.value32 = pHostParm->u.uint32; 886 } break; 887 888 case VMMDevHGCMParmType_64bit: 889 { 890 pGuestParm->u.value64 = pHostParm->u.uint64; 891 } break; 892 893 case VMMDevHGCMParmType_PhysAddr: 894 { 895 /* do nothing */ 896 } break; 897 898 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 899 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 900 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 901 { 902 /* Copy buffer back to guest memory. */ 903 uint32_t size = pGuestParm->u.Pointer.size; 904 905 if (size > 0 && pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 906 { 907 /* Use the saved page list. */ 908 rc = vmmdevHGCMWriteLinPtr (pVMMDevState->pDevIns, i, pHostParm->u.pointer.addr, size, iLinPtr++, pCmd->paLinPtrs); 909 AssertReleaseRC(rc); 910 } 911 } break; 912 913 default: 914 { 915 /* This indicates that the guest request memory was corrupted. */ 916 AssertReleaseMsgFailed(("hgcmCompleted: invalid parameter type %08X\n", pGuestParm->type)); 917 } 918 } 919 } 920 break; 921 } 922 #else 923 case VMMDevReq_HGCMCall: 924 { 925 VMMDevHGCMCall *pHGCMCall = (VMMDevHGCMCall *)pHeader; 926 927 uint32_t cParms = pHGCMCall->cParms; 928 929 VBOXHGCMSVCPARM *pHostParm = pCmd->paHostParms; 930 931 uint32_t i; 932 uint32_t iLinPtr = 0; 933 934 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall); 935 936 for (i = 0; i < cParms; i++, pGuestParm++, pHostParm++) 937 { 938 switch (pGuestParm->type) 939 { 940 case VMMDevHGCMParmType_32bit: 941 { 942 pGuestParm->u.value32 = pHostParm->u.uint32; 943 } break; 944 945 case VMMDevHGCMParmType_64bit: 946 { 947 pGuestParm->u.value64 = pHostParm->u.uint64; 948 } break; 949 950 case VMMDevHGCMParmType_PhysAddr: 951 { 952 /* do nothing */ 953 } break; 954 955 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 956 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 957 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 958 { 959 /* Copy buffer back to guest memory. */ 960 uint32_t size = pGuestParm->u.Pointer.size; 961 962 if (size > 0 && pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 963 { 964 /* Use the saved page list. */ 965 rc = vmmdevHGCMWriteLinPtr (pVMMDevState->pDevIns, i, pHostParm->u.pointer.addr, size, iLinPtr++, pCmd->paLinPtrs); 966 AssertReleaseRC(rc); 967 } 968 } break; 969 970 default: 971 { 972 /* This indicates that the guest request memory was corrupted. */ 973 AssertReleaseMsgFailed(("hgcmCompleted: invalid parameter type %08X\n", pGuestParm->type)); 974 } 975 } 976 } 977 break; 978 } 979 #endif /* VBOX_WITH_64_BITS_GUESTS */ 695 980 case VMMDevReq_HGCMConnect: 696 981 { … … 926 1211 } 927 1212 1213 #ifdef VBOX_WITH_64_BITS_GUESTS 1214 case VMMDevReq_HGCMCall64: 1215 case VMMDevReq_HGCMCall32: 1216 #else 928 1217 case VMMDevReq_HGCMCall: 1218 #endif /* VBOX_WITH_64_BITS_GUESTS */ 929 1219 { 930 1220 if (requestHeader->size < sizeof(VMMDevHGCMCall)) … … 946 1236 Log(("%.*Vhxd\n", requestHeader->size, requestHeader)); 947 1237 948 requestHeader->rc = vmmdevHGCMCall (pVMMDevState, pHGCMCall, pIter->GCPhys); 1238 #ifdef VBOX_WITH_64_BITS_GUESTS 1239 bool f64Bits = (requestHeader->requestType == VMMDevReq_HGCMCall64); 1240 #else 1241 bool f64Bits = false; 1242 #endif /* VBOX_WITH_64_BITS_GUESTS */ 1243 requestHeader->rc = vmmdevHGCMCall (pVMMDevState, pHGCMCall, pIter->GCPhys, f64Bits); 949 1244 } 950 1245 break; -
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.h
r8155 r9435 34 34 DECLCALLBACK(int) vmmdevHGCMConnect (VMMDevState *pVMMDevState, VMMDevHGCMConnect *pHGCMConnect, RTGCPHYS GCPtr); 35 35 DECLCALLBACK(int) vmmdevHGCMDisconnect (VMMDevState *pVMMDevState, VMMDevHGCMDisconnect *pHGCMDisconnect, RTGCPHYS GCPtr); 36 DECLCALLBACK(int) vmmdevHGCMCall (VMMDevState *pVMMDevState, VMMDevHGCMCall *pHGCMCall, RTGCPHYS GCPtr );36 DECLCALLBACK(int) vmmdevHGCMCall (VMMDevState *pVMMDevState, VMMDevHGCMCall *pHGCMCall, RTGCPHYS GCPtr, bool f64Bits); 37 37 38 38 DECLCALLBACK(void) hgcmCompleted (PPDMIHGCMPORT pInterface, int32_t result, PVBOXHGCMCMD pCmdPtr); -
trunk/src/VBox/HostServices/SharedClipboard/service.cpp
r8155 r9435 32 32 #include "VBoxClipboard.h" 33 33 34 #define VBOX_HGCM_PARM_COUNT(a) ((sizeof (a) - sizeof (((a *)0)->hdr)) / sizeof (HGCMFunctionParameter))35 36 34 static void VBoxHGCMParmUInt32Set (VBOXHGCMSVCPARM *pParm, uint32_t u32) 37 35 { … … 339 337 Log(("svcCall: VBOX_SHARED_CLIPBOARD_FN_GET_HOST_MSG\n")); 340 338 341 if (cParms != VBOX_ HGCM_PARM_COUNT (VBoxClipboardGetHostMsg))339 if (cParms != VBOX_SHARED_CLIPBOARD_CPARMS_GET_HOST_MSG) 342 340 { 343 341 rc = VERR_INVALID_PARAMETER; … … 387 385 Log(("svcCall: VBOX_SHARED_CLIPBOARD_FN_FORMATS\n")); 388 386 389 if (cParms != VBOX_ HGCM_PARM_COUNT (VBoxClipboardFormats))387 if (cParms != VBOX_SHARED_CLIPBOARD_CPARMS_FORMATS) 390 388 { 391 389 rc = VERR_INVALID_PARAMETER; … … 432 430 Log(("svcCall: VBOX_SHARED_CLIPBOARD_FN_READ_DATA\n")); 433 431 434 if (cParms != VBOX_ HGCM_PARM_COUNT (VBoxClipboardReadData))432 if (cParms != VBOX_SHARED_CLIPBOARD_CPARMS_READ_DATA) 435 433 { 436 434 rc = VERR_INVALID_PARAMETER; … … 500 498 Log(("svcCall: VBOX_SHARED_CLIPBOARD_FN_WRITE_DATA\n")); 501 499 502 if (cParms != VBOX_ HGCM_PARM_COUNT (VBoxClipboardWriteData))500 if (cParms != VBOX_SHARED_CLIPBOARD_CPARMS_WRITE_DATA) 503 501 { 504 502 rc = VERR_INVALID_PARAMETER;
Note:
See TracChangeset
for help on using the changeset viewer.