- Timestamp:
- Aug 29, 2007 9:12:42 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r4415 r4417 1564 1564 PGMDECL(int) PGMPhysReadGCPtrSafe(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb) 1565 1565 { 1566 RTGCPHYS GCPhys; 1567 RTGCUINTPTR offset; 1568 int rc; 1569 1566 1570 /* 1567 1571 * Anything to do? … … 1577 1581 if (((RTGCUINTPTR)GCPtrSrc & PAGE_OFFSET_MASK) + cb <= PAGE_SIZE) 1578 1582 { 1583 /* Convert virtual to physical address */ 1584 offset = GCPtrSrc & PAGE_OFFSET_MASK; 1585 rc = PGMPhysGCPtr2GCPhys(pVM, GCPtrSrc, &GCPhys); 1586 AssertRCReturn(rc, rc); 1587 1588 /* mark the guest page as accessed. */ 1589 rc = PGMGstModifyPage(pVM, GCPtrSrc, 1, X86_PTE_A, ~(uint64_t)(X86_PTE_A)); 1590 AssertRC(rc); 1591 1592 PGMPhysRead(pVM, GCPhys + offset, pvDst, cb); 1593 return VINF_SUCCESS; 1594 } 1595 1596 /* 1597 * Page by page. 1598 */ 1599 for (;;) 1600 { 1601 /* Convert virtual to physical address */ 1602 offset = GCPtrSrc & PAGE_OFFSET_MASK; 1603 rc = PGMPhysGCPtr2GCPhys(pVM, GCPtrSrc, &GCPhys); 1604 AssertRCReturn(rc, rc); 1605 1579 1606 /* mark the guest page as accessed. */ 1580 1607 int rc = PGMGstModifyPage(pVM, GCPtrSrc, 1, X86_PTE_A, ~(uint64_t)(X86_PTE_A)); 1581 1608 AssertRC(rc); 1582 1609 1583 PGMPhysRead(pVM, GCPtrSrc, pvDst, cb);1584 return VINF_SUCCESS;1585 }1586 1587 /*1588 * Page by page.1589 */1590 for (;;)1591 {1592 /* mark the guest page as accessed. */1593 int rc = PGMGstModifyPage(pVM, GCPtrSrc, 1, X86_PTE_A, ~(uint64_t)(X86_PTE_A));1594 AssertRC(rc);1595 1596 1610 /* copy */ 1597 1611 size_t cbRead = PAGE_SIZE - ((RTGCUINTPTR)GCPtrSrc & PAGE_OFFSET_MASK); 1598 1612 if (cbRead >= cb) 1599 1613 { 1600 PGMPhysRead(pVM, GCP trSrc, pvDst, cb);1614 PGMPhysRead(pVM, GCPhys + offset, pvDst, cb); 1601 1615 return VINF_SUCCESS; 1602 1616 } 1603 PGMPhysRead(pVM, GCP trSrc, pvDst, cbRead);1617 PGMPhysRead(pVM, GCPhys + offset, pvDst, cbRead); 1604 1618 1605 1619 /* next */ … … 1626 1640 PGMDECL(int) PGMPhysWriteGCPtrSafe(PVM pVM, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb) 1627 1641 { 1642 RTGCPHYS GCPhys; 1643 RTGCUINTPTR offset; 1644 int rc; 1645 1628 1646 /* 1629 1647 * Anything to do? … … 1639 1657 if (((RTGCUINTPTR)GCPtrDst & PAGE_OFFSET_MASK) + cb <= PAGE_SIZE) 1640 1658 { 1659 /* Convert virtual to physical address */ 1660 offset = GCPtrDst & PAGE_OFFSET_MASK; 1661 rc = PGMPhysGCPtr2GCPhys(pVM, GCPtrDst, &GCPhys); 1662 AssertRCReturn(rc, rc); 1663 1641 1664 /* mark the guest page as accessed and dirty. */ 1642 intrc = PGMGstModifyPage(pVM, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D));1665 rc = PGMGstModifyPage(pVM, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D)); 1643 1666 AssertRC(rc); 1644 1667 1645 PGMPhysWrite(pVM, GCP trDst, pvSrc, cb);1668 PGMPhysWrite(pVM, GCPhys + offset, pvSrc, cb); 1646 1669 return VINF_SUCCESS; 1647 1670 } … … 1652 1675 for (;;) 1653 1676 { 1677 /* Convert virtual to physical address */ 1678 offset = GCPtrDst & PAGE_OFFSET_MASK; 1679 rc = PGMPhysGCPtr2GCPhys(pVM, GCPtrDst, &GCPhys); 1680 AssertRCReturn(rc, rc); 1681 1654 1682 /* mark the guest page as accessed and dirty. */ 1655 intrc = PGMGstModifyPage(pVM, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D));1683 rc = PGMGstModifyPage(pVM, GCPtrDst, 1, X86_PTE_A | X86_PTE_D, ~(uint64_t)(X86_PTE_A | X86_PTE_D)); 1656 1684 AssertRC(rc); 1657 1685 … … 1660 1688 if (cbWrite >= cb) 1661 1689 { 1662 PGMPhysWrite(pVM, GCP trDst, pvSrc, cb);1690 PGMPhysWrite(pVM, GCPhys + offset, pvSrc, cb); 1663 1691 return VINF_SUCCESS; 1664 1692 } 1665 PGMPhysWrite(pVM, GCP trDst, pvSrc, cbWrite);1693 PGMPhysWrite(pVM, GCPhys + offset, pvSrc, cbWrite); 1666 1694 1667 1695 /* next */
Note:
See TracChangeset
for help on using the changeset viewer.