Changeset 37467 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jun 15, 2011 1:08:45 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 72281
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/IOM.cpp
r37466 r37467 149 149 AssertCompileMemberAlignment(VM, iom.s, 32); 150 150 AssertCompile(sizeof(pVM->iom.s) <= sizeof(pVM->iom.padding)); 151 AssertCompileMemberAlignment(IOM, EmtLock, sizeof(uintptr_t));151 AssertCompileMemberAlignment(IOM, CritSect, sizeof(uintptr_t)); 152 152 153 153 /* … … 159 159 * Initialize the REM critical section. 160 160 */ 161 int rc = PDMR3CritSectInit(pVM, &pVM->iom.s. EmtLock, RT_SRC_POS, "IOM Lock");161 int rc = PDMR3CritSectInit(pVM, &pVM->iom.s.CritSect, RT_SRC_POS, "IOM Lock"); 162 162 AssertRCReturn(rc, rc); 163 163 … … 227 227 static void iomR3FlushCache(PVM pVM) 228 228 { 229 iomLock(pVM); 229 IOM_LOCK(pVM); 230 230 231 /* 231 232 * Caching of port and statistics (saves some time in rep outs/ins instruction emulation) … … 252 253 pVM->iom.s.pMMIOStatsLastRC = NIL_RTRCPTR; 253 254 254 iomUnlock(pVM);255 IOM_UNLOCK(pVM); 255 256 } 256 257 … … 562 563 * Try Insert it. 563 564 */ 564 iomLock(pVM);565 IOM_LOCK(pVM); 565 566 if (RTAvlroIOPortInsert(&pVM->iom.s.pTreesR3->IOPortTreeR3, &pRange->Core)) 566 567 { 567 568 #ifdef VBOX_WITH_STATISTICS 568 569 for (unsigned iPort = 0; iPort < cPorts; iPort++) 569 570 iomR3IOPortStatsCreate(pVM, PortStart + iPort, pszDesc); 570 571 iomUnlock(pVM);571 #endif 572 IOM_UNLOCK(pVM); 572 573 return VINF_SUCCESS; 573 574 } 574 iomUnlock(pVM);575 IOM_UNLOCK(pVM); 575 576 576 577 /* conflict. */ … … 628 629 } 629 630 630 iomLock(pVM);631 IOM_LOCK(pVM); 631 632 632 633 /* … … 640 641 { 641 642 AssertMsgFailed(("No R3! Port=#x %#x-%#x! (%s)\n", Port, PortStart, (unsigned)PortStart + cPorts - 1, pszDesc)); 642 iomUnlock(pVM);643 IOM_UNLOCK(pVM); 643 644 return VERR_IOM_NO_HC_IOPORT_RANGE; 644 645 } … … 651 652 { 652 653 AssertMsgFailed(("Not owner! Port=%#x %#x-%#x! (%s)\n", Port, PortStart, (unsigned)PortStart + cPorts - 1, pszDesc)); 653 iomUnlock(pVM);654 IOM_UNLOCK(pVM); 654 655 return VERR_IOM_NOT_IOPORT_RANGE_OWNER; 655 656 } … … 685 686 if (RTAvlroIOPortInsert(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortTreeRC, &pRange->Core)) 686 687 { 687 iomUnlock(pVM);688 IOM_UNLOCK(pVM); 688 689 return VINF_SUCCESS; 689 690 } … … 694 695 rc = VERR_IOM_IOPORT_RANGE_CONFLICT; 695 696 } 696 iomUnlock(pVM);697 IOM_UNLOCK(pVM); 697 698 return rc; 698 699 } … … 743 744 } 744 745 745 iomLock(pVM);746 IOM_LOCK(pVM); 746 747 /* 747 748 * Validate that there are ring-3 ranges for the ports. … … 754 755 { 755 756 AssertMsgFailed(("No R3! Port=#x %#x-%#x! (%s)\n", Port, PortStart, (unsigned)PortStart + cPorts - 1, pszDesc)); 756 iomUnlock(pVM);757 IOM_UNLOCK(pVM); 757 758 return VERR_IOM_NO_HC_IOPORT_RANGE; 758 759 } … … 765 766 { 766 767 AssertMsgFailed(("Not owner! Port=%#x %#x-%#x! (%s)\n", Port, PortStart, (unsigned)PortStart + cPorts - 1, pszDesc)); 767 iomUnlock(pVM);768 IOM_UNLOCK(pVM); 768 769 return VERR_IOM_NOT_IOPORT_RANGE_OWNER; 769 770 } … … 799 800 if (RTAvlroIOPortInsert(&pVM->iom.s.CTX_SUFF(pTrees)->IOPortTreeR0, &pRange->Core)) 800 801 { 801 iomUnlock(pVM);802 IOM_UNLOCK(pVM); 802 803 return VINF_SUCCESS; 803 804 } … … 808 809 rc = VERR_IOM_IOPORT_RANGE_CONFLICT; 809 810 } 810 iomUnlock(pVM);811 IOM_UNLOCK(pVM); 811 812 return rc; 812 813 } … … 846 847 } 847 848 848 iomLock(pVM);849 IOM_LOCK(pVM); 849 850 850 851 /* Flush the IO port lookup cache */ … … 867 868 AssertMsgFailed(("Removal of ports in range %#x-%#x rejected because not owner of %#x-%#x (%s)\n", 868 869 PortStart, PortLast, pRange->Core.Key, pRange->Core.KeyLast, pRange->pszDesc)); 869 iomUnlock(pVM);870 IOM_UNLOCK(pVM); 870 871 return VERR_IOM_NOT_IOPORT_RANGE_OWNER; 871 872 } … … 931 932 if (RT_FAILURE(rc2)) 932 933 { 933 iomUnlock(pVM);934 IOM_UNLOCK(pVM); 934 935 return rc2; 935 936 } … … 1014 1015 if (RT_FAILURE(rc2)) 1015 1016 { 1016 iomUnlock(pVM);1017 IOM_UNLOCK(pVM); 1017 1018 return rc2; 1018 1019 } … … 1096 1097 if (RT_FAILURE(rc2)) 1097 1098 { 1098 iomUnlock(pVM);1099 IOM_UNLOCK(pVM); 1099 1100 return rc2; 1100 1101 } … … 1125 1126 1126 1127 /* done */ 1127 iomUnlock(pVM);1128 IOM_UNLOCK(pVM); 1128 1129 return rc; 1129 1130 } … … 1471 1472 * Try register it with PGM and then insert it into the tree. 1472 1473 */ 1473 iomLock(pVM);1474 IOM_LOCK(pVM); 1474 1475 iomR3FlushCache(pVM); 1475 1476 rc = PGMR3PhysMMIORegister(pVM, GCPhysStart, cbRange, … … 1481 1482 if (RTAvlroGCPhysInsert(&pVM->iom.s.pTreesR3->MMIOTree, &pRange->Core)) 1482 1483 { 1483 iomUnlock(pVM);1484 IOM_UNLOCK(pVM); 1484 1485 return VINF_SUCCESS; 1485 1486 } 1486 1487 1487 1488 /* bail out */ 1488 iomUnlock(pVM);1489 IOM_UNLOCK(pVM); 1489 1490 DBGFR3Info(pVM, "mmio", NULL, NULL); 1490 1491 AssertMsgFailed(("This cannot happen!\n")); … … 1492 1493 } 1493 1494 else 1494 iomUnlock(pVM);1495 IOM_UNLOCK(pVM); 1495 1496 1496 1497 MMHyperFree(pVM, pRange); … … 1540 1541 * Find the MMIO range and check that the input matches. 1541 1542 */ 1542 iomLock(pVM);1543 IOM_LOCK(pVM); 1543 1544 PIOMMMIORANGE pRange = iomMmioGetRange(pVM, GCPhysStart); 1544 AssertReturnStmt(pRange, iomUnlock(pVM), VERR_IOM_MMIO_RANGE_NOT_FOUND);1545 AssertReturnStmt(pRange->pDevInsR3 == pDevIns, iomUnlock(pVM), VERR_IOM_NOT_MMIO_RANGE_OWNER);1546 AssertReturnStmt(pRange->GCPhys == GCPhysStart, iomUnlock(pVM), VERR_IOM_INVALID_MMIO_RANGE);1547 AssertReturnStmt(pRange->cb == cbRange, iomUnlock(pVM), VERR_IOM_INVALID_MMIO_RANGE);1545 AssertReturnStmt(pRange, IOM_UNLOCK(pVM), VERR_IOM_MMIO_RANGE_NOT_FOUND); 1546 AssertReturnStmt(pRange->pDevInsR3 == pDevIns, IOM_UNLOCK(pVM), VERR_IOM_NOT_MMIO_RANGE_OWNER); 1547 AssertReturnStmt(pRange->GCPhys == GCPhysStart, IOM_UNLOCK(pVM), VERR_IOM_INVALID_MMIO_RANGE); 1548 AssertReturnStmt(pRange->cb == cbRange, IOM_UNLOCK(pVM), VERR_IOM_INVALID_MMIO_RANGE); 1548 1549 1549 1550 pRange->pvUserRC = pvUser; … … 1552 1553 pRange->pfnFillCallbackRC = pfnFillCallback; 1553 1554 pRange->pDevInsRC = MMHyperCCToRC(pVM, pDevIns); 1554 iomUnlock(pVM);1555 IOM_UNLOCK(pVM); 1555 1556 1556 1557 return VINF_SUCCESS; … … 1597 1598 * Find the MMIO range and check that the input matches. 1598 1599 */ 1599 iomLock(pVM);1600 IOM_LOCK(pVM); 1600 1601 PIOMMMIORANGE pRange = iomMmioGetRange(pVM, GCPhysStart); 1601 AssertReturnStmt(pRange, iomUnlock(pVM), VERR_IOM_MMIO_RANGE_NOT_FOUND);1602 AssertReturnStmt(pRange->pDevInsR3 == pDevIns, iomUnlock(pVM), VERR_IOM_NOT_MMIO_RANGE_OWNER);1603 AssertReturnStmt(pRange->GCPhys == GCPhysStart, iomUnlock(pVM), VERR_IOM_INVALID_MMIO_RANGE);1604 AssertReturnStmt(pRange->cb == cbRange, iomUnlock(pVM), VERR_IOM_INVALID_MMIO_RANGE);1602 AssertReturnStmt(pRange, IOM_UNLOCK(pVM), VERR_IOM_MMIO_RANGE_NOT_FOUND); 1603 AssertReturnStmt(pRange->pDevInsR3 == pDevIns, IOM_UNLOCK(pVM), VERR_IOM_NOT_MMIO_RANGE_OWNER); 1604 AssertReturnStmt(pRange->GCPhys == GCPhysStart, IOM_UNLOCK(pVM), VERR_IOM_INVALID_MMIO_RANGE); 1605 AssertReturnStmt(pRange->cb == cbRange, IOM_UNLOCK(pVM), VERR_IOM_INVALID_MMIO_RANGE); 1605 1606 1606 1607 pRange->pvUserR0 = pvUser; … … 1609 1610 pRange->pfnFillCallbackR0 = pfnFillCallback; 1610 1611 pRange->pDevInsR0 = MMHyperCCToR0(pVM, pDevIns); 1611 iomUnlock(pVM);1612 IOM_UNLOCK(pVM); 1612 1613 1613 1614 return VINF_SUCCESS; … … 1644 1645 } 1645 1646 1646 iomLock(pVM);1647 IOM_LOCK(pVM); 1647 1648 1648 1649 /* … … 1655 1656 if (!pRange) 1656 1657 { 1657 iomUnlock(pVM);1658 IOM_UNLOCK(pVM); 1658 1659 return VERR_IOM_MMIO_RANGE_NOT_FOUND; 1659 1660 } 1660 1661 AssertMsgReturnStmt(pRange->pDevInsR3 == pDevIns, 1661 1662 ("Not owner! GCPhys=%RGp %RGp LB%#x %s\n", GCPhys, GCPhysStart, cbRange, pRange->pszDesc), 1662 iomUnlock(pVM),1663 IOM_UNLOCK(pVM), 1663 1664 VERR_IOM_NOT_MMIO_RANGE_OWNER); 1664 1665 AssertMsgReturnStmt(pRange->Core.KeyLast <= GCPhysLast, 1665 1666 ("Incomplete R3 range! GCPhys=%RGp %RGp LB%#x %s\n", GCPhys, GCPhysStart, cbRange, pRange->pszDesc), 1666 iomUnlock(pVM),1667 IOM_UNLOCK(pVM), 1667 1668 VERR_IOM_INCOMPLETE_MMIO_RANGE); 1668 1669 … … 1683 1684 Assert(pRange); 1684 1685 Assert(pRange->Core.Key == GCPhys && pRange->Core.KeyLast <= GCPhysLast); 1685 iomUnlock(pVM); /** @todo r=bird: Why are we leving the lock here? We don't leave it when registering the range above... */1686 IOM_UNLOCK(pVM); /** @todo r=bird: Why are we leaving the lock here? We don't leave it when registering the range above... */ 1686 1687 1687 1688 /* remove it from PGM */ … … 1689 1690 AssertRC(rc); 1690 1691 1691 iomLock(pVM);1692 IOM_LOCK(pVM); 1692 1693 1693 1694 /* advance and free. */ … … 1701 1702 } 1702 1703 1703 iomUnlock(pVM);1704 IOM_UNLOCK(pVM); 1704 1705 return VINF_SUCCESS; 1705 1706 }
Note:
See TracChangeset
for help on using the changeset viewer.