vbox的更動 2027 路徑 trunk/src/VBox/Devices/VMMDev
- 時間撮記:
- 2007-4-11 下午01:12:07 (18 年 以前)
- 位置:
- trunk/src/VBox/Devices/VMMDev
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/VMMDev/VBoxDev.cpp
r1681 r2027 953 953 break; 954 954 } 955 #endif 955 #endif /* VBOX_HGCM */ 956 956 957 957 case VMMDevReq_VideoAccelEnable: -
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
r1687 r2027 35 35 #include "VMMDevHGCM.h" 36 36 37 typedef enum _VBOXHGCMCMDTYPE 38 { 39 VBOXHGCMCMDTYPE_LOADSTATE, 40 VBOXHGCMCMDTYPE_CONNECT, 41 VBOXHGCMCMDTYPE_DISCONNECT, 42 VBOXHGCMCMDTYPE_CALL, 43 VBOXHGCMCMDTYPE_SizeHack = 0x7fffffff 44 } VBOXHGCMCMDTYPE; 45 37 46 /* Information about a linear ptr parameter. */ 38 47 typedef struct _VBOXHGCMLINPTR … … 60 69 struct VBOXHGCMCMD *pNext; 61 70 struct VBOXHGCMCMD *pPrev; 62 63 /* GC ptr of the command header. */ 71 72 /* The type of the command. */ 73 VBOXHGCMCMDTYPE enmCmdType; 74 75 /* GC pointer of the guest request. */ 64 76 RTGCPHYS GCPtr; 65 77 66 /* Pointer to guest request. */78 /* HC pointer to guest request. */ 67 79 VMMDevHGCMRequestHeader *pHeader; 68 80 … … 90 102 } 91 103 92 static int vmmdevHGCMAddCommand (VMMDevState *pVMMDevState, PVBOXHGCMCMD pCmd, RTGCPHYS GCPtr )104 static int vmmdevHGCMAddCommand (VMMDevState *pVMMDevState, PVBOXHGCMCMD pCmd, RTGCPHYS GCPtr, VBOXHGCMCMDTYPE enmCmdType) 93 105 { 94 106 /* PPDMDEVINS pDevIns = pVMMDevState->pDevIns; */ … … 111 123 pVMMDevState->pHGCMCmdList = pCmd; 112 124 125 pCmd->enmCmdType = enmCmdType; 113 126 pCmd->GCPtr = GCPtr; 114 127 … … 274 287 if (pCmd) 275 288 { 276 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPtr );289 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPtr, VBOXHGCMCMDTYPE_CONNECT); 277 290 278 291 pCmd->pHeader = &pHGCMConnect->header; … … 303 316 if (pCmd) 304 317 { 305 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPtr );318 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPtr, VBOXHGCMCMDTYPE_DISCONNECT); 306 319 307 320 pCmd->pHeader = &pHGCMDisconnect->header; … … 531 544 if (VBOX_SUCCESS (rc)) 532 545 { 533 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPtr );546 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPtr, VBOXHGCMCMDTYPE_CALL); 534 547 535 548 /* Pass the function call to HGCM connector for actual processing */ … … 549 562 } 550 563 564 static int vmmdevHGCMCmdVerify (PVBOXHGCMCMD pCmd) 565 { 566 VMMDevHGCMRequestHeader *pHeader = pCmd->pHeader; 567 568 switch (pCmd->enmCmdType) 569 { 570 case VBOXHGCMCMDTYPE_CONNECT: 571 if (pHeader->header.requestType == VMMDevReq_HGCMConnect) return VINF_SUCCESS; 572 break; 573 574 case VBOXHGCMCMDTYPE_DISCONNECT: 575 if (pHeader->header.requestType == VMMDevReq_HGCMDisconnect) return VINF_SUCCESS; 576 break; 577 578 case VBOXHGCMCMDTYPE_CALL: 579 if (pHeader->header.requestType == VMMDevReq_HGCMCall) return VINF_SUCCESS; 580 break; 581 582 default: 583 AssertFailed (); 584 } 585 586 LogRel(("VMMDEV: Invalid HGCM command: pCmd->enmCmdType = 0x%08X, pHeader->header.requestType = 0x%08X\n", 587 pCmd->enmCmdType, pHeader->header.requestType)); 588 return VERR_INVALID_PARAMETER; 589 } 590 551 591 #define PDMIHGCMPORT_2_VMMDEVSTATE(pInterface) ( (VMMDevState *) ((uintptr_t)pInterface - RT_OFFSETOF(VMMDevState, HGCMPort)) ) 552 592 … … 563 603 /* Setup return codes. */ 564 604 pHeader->result = result; 565 566 /* Update parameters and data buffers. */ 567 568 if (pHeader->header.requestType == VMMDevReq_HGCMCall) 569 { 570 VMMDevHGCMCall *pHGCMCall = (VMMDevHGCMCall *)pHeader; 571 572 uint32_t cParms = pHGCMCall->cParms; 573 574 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall); 575 576 VBOXHGCMSVCPARM *pHostParm = pCmd->paHostParms; 577 578 uint32_t i; 579 uint32_t iLinPtr = 0; 580 581 for (i = 0; i < cParms; i++, pGuestParm++, pHostParm++) 605 606 /* Verify the request type. */ 607 rc = vmmdevHGCMCmdVerify (pCmd); 608 609 if (VBOX_SUCCESS (rc)) 610 { 611 /* Update parameters and data buffers. */ 612 613 if (pHeader->header.requestType == VMMDevReq_HGCMCall) 582 614 { 583 switch (pGuestParm->type) 615 VMMDevHGCMCall *pHGCMCall = (VMMDevHGCMCall *)pHeader; 616 617 uint32_t cParms = pHGCMCall->cParms; 618 619 HGCMFunctionParameter *pGuestParm = VMMDEV_HGCM_CALL_PARMS(pHGCMCall); 620 621 VBOXHGCMSVCPARM *pHostParm = pCmd->paHostParms; 622 623 uint32_t i; 624 uint32_t iLinPtr = 0; 625 626 for (i = 0; i < cParms; i++, pGuestParm++, pHostParm++) 584 627 { 585 case VMMDevHGCMParmType_32bit:628 switch (pGuestParm->type) 586 629 { 587 pGuestParm->u.value32 = pHostParm->u.uint32; 588 } break; 589 590 case VMMDevHGCMParmType_64bit: 591 { 592 pGuestParm->u.value64 = pHostParm->u.uint64; 593 } break; 594 595 case VMMDevHGCMParmType_PhysAddr: 596 { 597 /* do nothing */ 598 } break; 599 600 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 601 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 602 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 603 { 604 /* Copy buffer back to guest memory. */ 605 uint32_t size = pGuestParm->u.Pointer.size; 606 607 if (size > 0 && pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 630 case VMMDevHGCMParmType_32bit: 608 631 { 609 /* Use the saved page list. */ 610 rc = vmmdevHGCMWriteLinPtr (pVMMDevState->pDevIns, i, pHostParm->u.pointer.addr, size, iLinPtr++, pCmd->paLinPtrs); 611 AssertReleaseRC(rc); 632 pGuestParm->u.value32 = pHostParm->u.uint32; 633 } break; 634 635 case VMMDevHGCMParmType_64bit: 636 { 637 pGuestParm->u.value64 = pHostParm->u.uint64; 638 } break; 639 640 case VMMDevHGCMParmType_PhysAddr: 641 { 642 /* do nothing */ 643 } break; 644 645 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ 646 case VMMDevHGCMParmType_LinAddr_Out: /* Out (write) */ 647 case VMMDevHGCMParmType_LinAddr: /* In & Out */ 648 { 649 /* Copy buffer back to guest memory. */ 650 uint32_t size = pGuestParm->u.Pointer.size; 651 652 if (size > 0 && pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 653 { 654 /* Use the saved page list. */ 655 rc = vmmdevHGCMWriteLinPtr (pVMMDevState->pDevIns, i, pHostParm->u.pointer.addr, size, iLinPtr++, pCmd->paLinPtrs); 656 AssertReleaseRC(rc); 657 } 658 } break; 659 660 default: 661 { 662 /* This indicates that the guest request memory was corrupted. */ 663 AssertReleaseMsgFailed(("hgcmCompleted: invalid parameter type %08X\n", pGuestParm->type)); 612 664 } 613 } break;614 615 default:616 {617 /* This indicates that the guest request memory was corrupted. */618 AssertReleaseMsgFailed(("hgcmCompleted: invalid parameter type %08X\n", pGuestParm->type));619 665 } 620 666 } 621 667 } 668 } 669 else 670 { 671 /* Return error to the guest. */ 672 pHeader->header.rc = rc; 622 673 } 623 674 … … 715 766 AssertReturn(pCmd, VERR_NO_MEMORY); 716 767 717 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPtr );768 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPtr, VBOXHGCMCMDTYPE_LOADSTATE); 718 769 } 719 770
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器