Changeset 13765 in vbox for trunk/src/VBox/VMM/VMReq.cpp
- Timestamp:
- Nov 3, 2008 5:20:11 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMReq.cpp
r13755 r13765 401 401 VERR_VM_REQUEST_INVALID_TYPE); 402 402 AssertPtrReturn(ppReq, VERR_INVALID_POINTER); 403 AssertMsgReturn(enmDest == VMREQDEST_ALL || (unsigned)enmDest < pUVM->pVM->cCPUs, ("Invalid destination %d (max=%d)\n", enmDest, pUVM->pVM->cCPUs), VERR_INVALID_PARAMETER); 403 404 404 405 /* … … 619 620 int rc = VINF_SUCCESS; 620 621 PUVM pUVM = ((VMREQ volatile *)pReq)->pUVM; /* volatile paranoia */ 621 if (pUVM->vm.s.NativeThreadEMT != RTThreadNativeSelf()) 622 if ( pReq->enmDest == VMREQDEST_ALL 623 && pUVM->vm.s.NativeThreadEMT != RTThreadNativeSelf()) 622 624 { 623 625 unsigned fFlags = ((VMREQ volatile *)pReq)->fFlags; /* volatile paranoia */ … … 639 641 if (pUVM->pVM) 640 642 VM_FF_SET(pUVM->pVM, VM_FF_REQUEST); 643 VMR3NotifyFFU(pUVM, false); 644 645 /* 646 * Wait and return. 647 */ 648 if (!(fFlags & VMREQFLAGS_NO_WAIT)) 649 rc = VMR3ReqWait(pReq, cMillies); 650 LogFlow(("VMR3ReqQueue: returns %Vrc\n", rc)); 651 } 652 else 653 if ( pReq->enmDest != VMREQDEST_ALL 654 && pUVM->aCpu[pReq->enmDest].vm.s.NativeThreadEMT != RTThreadNativeSelf()) 655 { 656 RTCPUID idTarget = (RTCPUID)pReq->enmDest; 657 unsigned fFlags = ((VMREQ volatile *)pReq)->fFlags; /* volatile paranoia */ 658 659 /* 660 * Insert it. 661 */ 662 pReq->enmState = VMREQSTATE_QUEUED; 663 PVMREQ pNext; 664 do 665 { 666 pNext = pUVM->aCpu[idTarget].vm.s.pReqs; 667 pReq->pNext = pNext; 668 } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pUVM->aCpu[idTarget].vm.s.pReqs, (void *)pReq, (void *)pNext)); 669 670 /* 671 * Notify EMT. 672 */ 673 if (pUVM->pVM) 674 VMCPU_FF_SET(pUVM->pVM, VM_FF_REQUEST, idTarget); 675 /* @todo: VMR3NotifyFFU*/ 676 AssertFailed(); 641 677 VMR3NotifyFFU(pUVM, false); 642 678 … … 735 771 * 736 772 * @param pUVM Pointer to the user mode VM structure. 737 */ 738 VMMR3DECL(int) VMR3ReqProcessU(PUVM pUVM) 739 { 740 LogFlow(("VMR3ReqProcessU: (enmVMState=%d)\n", pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING)); 773 * @param enmDest Destination of the request packet (global or per VCPU). 774 */ 775 VMMR3DECL(int) VMR3ReqProcessU(PUVM pUVM, VMREQDEST enmDest) 776 { 777 LogFlow(("VMR3ReqProcessU: (enmVMState=%d) enmDest=%d\n", pUVM->pVM ? pUVM->pVM->enmVMState : VMSTATE_CREATING, enmDest)); 741 778 742 779 /* … … 749 786 while (rc <= VINF_SUCCESS) 750 787 { 788 void *volatile *ppReqs; 789 751 790 /* 752 791 * Get pending requests. 753 792 */ 754 if (RT_LIKELY(pUVM->pVM)) 755 VM_FF_CLEAR(pUVM->pVM, VM_FF_REQUEST); 756 PVMREQ pReqs = (PVMREQ)ASMAtomicXchgPtr((void * volatile *)&pUVM->vm.s.pReqs, NULL); 793 if (enmDest == VMREQDEST_ALL) 794 { 795 ppReqs = (void * volatile *)&pUVM->vm.s.pReqs; 796 if (RT_LIKELY(pUVM->pVM)) 797 VM_FF_CLEAR(pUVM->pVM, VM_FF_REQUEST); 798 } 799 else 800 { 801 ppReqs = (void * volatile *)&pUVM->aCpu[enmDest].vm.s.pReqs; 802 if (RT_LIKELY(pUVM->pVM)) 803 VMCPU_FF_CLEAR(pUVM->pVM, enmDest, VM_FF_REQUEST); 804 } 805 806 PVMREQ pReqs = (PVMREQ)ASMAtomicXchgPtr(ppReqs, NULL); 757 807 if (!pReqs) 758 808 break;
Note:
See TracChangeset
for help on using the changeset viewer.