Changeset 91895 in vbox
- Timestamp:
- Oct 20, 2021 1:30:17 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmqueue.h
r90838 r91895 59 59 /** Pointer to the next item in the pending list - R0 Pointer. */ 60 60 R0PTRTYPE(PPDMQUEUEITEMCORE) pNextR0; 61 /** Pointer to the next item in the pending list - RC Pointer. */62 RCPTRTYPE(PPDMQUEUEITEMCORE) pNextRC;63 #if HC_ARCH_BITS == 6464 RTRCPTR Alignment0;65 #endif66 61 } PDMQUEUEITEMCORE; 67 62 … … 156 151 VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem); 157 152 VMMDECL(void) PDMQueueInsertEx(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem, uint64_t NanoMaxDelay); 158 VMMDECL(RCPTRTYPE(PPDMQUEUE)) PDMQueueRCPtr(PPDMQUEUE pQueue);159 153 VMMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue); 160 154 VMMDECL(bool) PDMQueueFlushIfNecessary(PPDMQUEUE pQueue); -
trunk/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
r90784 r91895 83 83 /** 84 84 * Queue an item. 85 * 85 86 * The item must have been obtained using PDMQueueAlloc(). Once the item 86 87 * have been passed to this function it must not be touched! … … 120 121 /** 121 122 * Queue an item. 123 * 122 124 * The item must have been obtained using PDMQueueAlloc(). Once the item 123 125 * have been passed to this function it must not be touched! … … 145 147 Log2(("PDMQueueInsertEx: Setting VMCPU_FF_TO_R3\n")); 146 148 } 147 #endif148 }149 150 151 152 /**153 * Gets the RC pointer for the specified queue.154 *155 * @returns The RC address of the queue.156 * @returns NULL if pQueue is invalid.157 * @param pQueue The queue handle.158 */159 VMMDECL(RCPTRTYPE(PPDMQUEUE)) PDMQueueRCPtr(PPDMQUEUE pQueue)160 {161 AssertPtr(pQueue);162 Assert(pQueue->pVMR3 && pQueue->pVMRC);163 #ifdef IN_RC164 return pQueue;165 #else166 return MMHyperCCToRC(pQueue->CTX_SUFF(pVM), pQueue);167 149 #endif 168 150 } … … 198 180 AssertPtr(pQueue); 199 181 if ( pQueue->pPendingR3 != NIL_RTR3PTR 200 || pQueue->pPendingR0 != NIL_RTR0PTR 201 || pQueue->pPendingRC != NIL_RTRCPTR) 182 || pQueue->pPendingR0 != NIL_RTR0PTR) 202 183 { 203 184 pdmQueueSetFF(pQueue); -
trunk/src/VBox/VMM/VMMR3/PDM.cpp
r91686 r91895 579 579 580 580 /* 581 * Queues.582 */583 pdmR3QueueRelocate(pVM, offDelta);584 pVM->pdm.s.pDevHlpQueueRC = PDMQueueRCPtr(pVM->pdm.s.pDevHlpQueueR3);585 586 /*587 581 * The registered PIC. 588 582 */ -
trunk/src/VBox/VMM/VMMR3/PDMDevice.cpp
r90346 r91895 135 135 AssertRCReturn(rc, rc); 136 136 pVM->pdm.s.pDevHlpQueueR0 = PDMQueueR0Ptr(pVM->pdm.s.pDevHlpQueueR3); 137 pVM->pdm.s.pDevHlpQueueRC = PDMQueueRCPtr(pVM->pdm.s.pDevHlpQueueR3);138 139 137 140 138 /* -
trunk/src/VBox/VMM/VMMR3/PDMQueue.cpp
r87773 r91895 86 86 pQueue->pVMR3 = pVM; 87 87 pQueue->pVMR0 = fRZEnabled ? pVM->pVMR0ForCall : NIL_RTR0PTR; 88 pQueue->pVMRC = fRZEnabled ? pVM->pVMRC : NIL_RTRCPTR;89 88 pQueue->pszName = pszName; 90 89 pQueue->cMilliesInterval = cMilliesInterval; … … 102 101 pQueue->aFreeItems[i].pItemR3 = pItem; 103 102 if (fRZEnabled) 104 {105 103 pQueue->aFreeItems[i].pItemR0 = MMHyperR3ToR0(pVM, pItem); 106 pQueue->aFreeItems[i].pItemRC = MMHyperR3ToRC(pVM, pItem);107 }108 104 } 109 105 … … 455 451 pQueue->hTimer = NIL_TMTIMERHANDLE; 456 452 } 457 if (pQueue->pVMRC) 458 { 459 pQueue->pVMRC = NIL_RTRCPTR; 453 if (pQueue->pVMR0) 454 { 460 455 pQueue->pVMR0 = NIL_RTR0PTR; 461 456 MMHyperFree(pVM, pQueue); … … 569 564 pdmUnlock(pVM); 570 565 return VINF_SUCCESS; 571 }572 573 574 /**575 * Relocate the queues.576 *577 * @param pVM The cross context VM structure.578 * @param offDelta The relocation delta.579 */580 void pdmR3QueueRelocate(PVM pVM, RTGCINTPTR offDelta)581 {582 /*583 * Process the queues.584 */585 PUVM pUVM = pVM->pUVM;586 PPDMQUEUE pQueueNext = pUVM->pdm.s.pQueuesTimer;587 PPDMQUEUE pQueue = pUVM->pdm.s.pQueuesForced;588 do589 {590 while (pQueue)591 {592 if (pQueue->pVMRC)593 {594 pQueue->pVMRC = pVM->pVMRC;595 596 /* Pending RC items. */597 if (pQueue->pPendingRC)598 {599 pQueue->pPendingRC += offDelta;600 PPDMQUEUEITEMCORE pCur = (PPDMQUEUEITEMCORE)MMHyperRCToR3(pVM, pQueue->pPendingRC);601 while (pCur->pNextRC)602 {603 pCur->pNextRC += offDelta;604 pCur = (PPDMQUEUEITEMCORE)MMHyperRCToR3(pVM, pCur->pNextRC);605 }606 }607 608 /* The free items. */609 uint32_t i = pQueue->iFreeTail;610 while (i != pQueue->iFreeHead)611 {612 pQueue->aFreeItems[i].pItemRC = MMHyperR3ToRC(pVM, pQueue->aFreeItems[i].pItemR3);613 i = (i + 1) % (pQueue->cItems + PDMQUEUE_FREE_SLACK);614 }615 }616 617 /* next queue */618 pQueue = pQueue->pNext;619 }620 621 /* next queue list */622 pQueue = pQueueNext;623 pQueueNext = NULL;624 } while (pQueue);625 566 } 626 567 … … 654 595 for (PPDMQUEUE pCur = pVM->pUVM->pdm.s.pQueuesForced; pCur; pCur = pCur->pNext) 655 596 if ( pCur->pPendingR3 656 || pCur->pPendingR0 657 || pCur->pPendingRC) 597 || pCur->pPendingR0) 658 598 pdmR3QueueFlush(pCur); 659 599 … … 684 624 */ 685 625 PPDMQUEUEITEMCORE pItems = ASMAtomicXchgPtrT(&pQueue->pPendingR3, NULL, PPDMQUEUEITEMCORE); 686 RTRCPTR pItemsRC = ASMAtomicXchgRCPtr(&pQueue->pPendingRC, NIL_RTRCPTR);687 626 RTR0PTR pItemsR0 = ASMAtomicXchgR0Ptr(&pQueue->pPendingR0, NIL_RTR0PTR); 688 627 689 628 AssertMsgReturn( pItemsR0 690 || pItemsRC691 629 || pItems, 692 630 ("Someone is racing us? This shouldn't happen!\n"), … … 702 640 PPDMQUEUEITEMCORE pInsert = pCur; 703 641 pCur = pCur->pNextR3; 704 pInsert->pNextR3 = pItems;705 pItems = pInsert;706 }707 708 /*709 * Do the same for any pending RC items.710 */711 while (pItemsRC)712 {713 PPDMQUEUEITEMCORE pInsert = (PPDMQUEUEITEMCORE)MMHyperRCToR3(pQueue->pVMR3, pItemsRC);714 pItemsRC = pInsert->pNextRC;715 pInsert->pNextRC = NIL_RTRCPTR;716 642 pInsert->pNextR3 = pItems; 717 643 pItems = pInsert; … … 845 771 846 772 pQueue->aFreeItems[i].pItemR3 = pItem; 847 if (pQueue->pVMRC) 848 { 849 pQueue->aFreeItems[i].pItemRC = MMHyperR3ToRC(pQueue->pVMR3, pItem); 773 if (pQueue->pVMR0) 850 774 pQueue->aFreeItems[i].pItemR0 = MMHyperR3ToR0(pQueue->pVMR3, pItem); 851 }852 775 853 776 if (!ASMAtomicCmpXchgU32(&pQueue->iFreeHead, iNext, i)) … … 866 789 867 790 if ( pQueue->pPendingR3 868 || pQueue->pPendingR0 869 || pQueue->pPendingRC) 791 || pQueue->pPendingR0) 870 792 pdmR3QueueFlush(pQueue); 871 793 int rc = TMTimerSetMillies(pVM, hTimer, pQueue->cMilliesInterval); -
trunk/src/VBox/VMM/include/PDMInternal.h
r90677 r91895 1063 1063 /** LIFO of pending items - R0. */ 1064 1064 R0PTRTYPE(PPDMQUEUEITEMCORE) volatile pPendingR0; 1065 /** Pointer to the GC VM and indicator for GC enabled queue.1066 * If this is NULL, the queue cannot be used in GC.1067 */1068 PVMRC pVMRC;1069 /** LIFO of pending items - GC. */1070 RCPTRTYPE(PPDMQUEUEITEMCORE) volatile pPendingRC;1071 1065 1072 1066 /** Item size (bytes). */ … … 1107 1101 /** Pointer to the free item - HC Ptr. */ 1108 1102 R0PTRTYPE(PPDMQUEUEITEMCORE) volatile pItemR0; 1109 /** Pointer to the free item - GC Ptr. */1110 RCPTRTYPE(PPDMQUEUEITEMCORE) volatile pItemRC;1111 #if HC_ARCH_BITS == 641112 RTRCPTR Alignment0;1113 #endif1114 1103 } aFreeItems[1]; 1115 1104 } PDMQUEUE; … … 1434 1423 /** Queue in which devhlp tasks are queued for R3 execution - R0 Ptr. */ 1435 1424 R0PTRTYPE(PPDMQUEUE) pDevHlpQueueR0; 1436 /** Queue in which devhlp tasks are queued for R3 execution - RC Ptr. */1437 RCPTRTYPE(PPDMQUEUE) pDevHlpQueueRC;1438 /** Pointer to the queue which should be manually flushed - RC Ptr.1439 * Only touched by EMT. */1440 RCPTRTYPE(struct PDMQUEUE *) pQueueFlushRC;1441 1425 /** Pointer to the queue which should be manually flushed - R0 Ptr. 1442 1426 * Only touched by EMT. */ … … 1676 1660 char *pdmR3FileR3(const char *pszFile, bool fShared); 1677 1661 int pdmR3LoadR3U(PUVM pUVM, const char *pszFilename, const char *pszName); 1678 1679 void pdmR3QueueRelocate(PVM pVM, RTGCINTPTR offDelta);1680 1662 1681 1663 int pdmR3TaskInit(PVM pVM); -
trunk/src/VBox/VMM/testcase/tstVMStruct.h
r91345 r91895 609 609 GEN_CHECK_OFF_DOT(PDMQUEUE, aFreeItems[0].pItemR3); 610 610 GEN_CHECK_OFF_DOT(PDMQUEUE, aFreeItems[0].pItemR0); 611 GEN_CHECK_OFF_DOT(PDMQUEUE, aFreeItems[1].pItemRC);612 611 GEN_CHECK_SIZE(PDMDEVHLPTASK); 613 612 GEN_CHECK_OFF(PDMDEVHLPTASK, Core);
Note:
See TracChangeset
for help on using the changeset viewer.