Changeset 13152 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Oct 9, 2008 11:14:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r13151 r13152 1733 1733 VMMDECL(int) PGMPhysSimpleReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb) 1734 1734 { 1735 # if defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) || defined(VBOX_WITH_NEW_PHYS_CODE)1736 1735 /* 1737 1736 * Treat the first page as a special case. … … 1789 1788 } 1790 1789 /* won't ever get here. */ 1791 1792 # else /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 && !VBOX_WITH_NEW_PHYS_CODE*/1793 1794 /*1795 * Anything to be done?1796 */1797 if (!cb)1798 return VINF_SUCCESS;1799 1800 /*1801 * Loop ram ranges.1802 */1803 for (PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRanges);1804 pRam;1805 pRam = pRam->CTX_SUFF(pNext))1806 {1807 RTGCPHYS off = GCPhysSrc - pRam->GCPhys;1808 if (off < pRam->cb)1809 {1810 if (pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC)1811 {1812 /* Copy page by page as we're not dealing with a linear HC range. */1813 for (;;)1814 {1815 /* convert */1816 void *pvSrc;1817 int rc = pgmRamGCPhys2HCPtrWithRange(pVM, pRam, GCPhysSrc, &pvSrc);1818 if (VBOX_FAILURE(rc))1819 return rc;1820 1821 /* copy */1822 size_t cbRead = PAGE_SIZE - ((RTGCUINTPTR)GCPhysSrc & PAGE_OFFSET_MASK);1823 if (cbRead >= cb)1824 {1825 memcpy(pvDst, pvSrc, cb);1826 return VINF_SUCCESS;1827 }1828 memcpy(pvDst, pvSrc, cbRead);1829 1830 /* next */1831 cb -= cbRead;1832 pvDst = (uint8_t *)pvDst + cbRead;1833 GCPhysSrc += cbRead;1834 }1835 }1836 else if (pRam->pvR3)1837 {1838 /* read */1839 size_t cbRead = pRam->cb - off;1840 if (cbRead >= cb)1841 {1842 memcpy(pvDst, (uint8_t *)pRam->pvR3 + off, cb);1843 return VINF_SUCCESS;1844 }1845 memcpy(pvDst, (uint8_t *)pRam->pvR3 + off, cbRead);1846 1847 /* next */1848 cb -= cbRead;1849 pvDst = (uint8_t *)pvDst + cbRead;1850 GCPhysSrc += cbRead;1851 }1852 else1853 return VERR_PGM_PHYS_PAGE_RESERVED;1854 }1855 else if (GCPhysSrc < pRam->GCPhysLast)1856 break;1857 }1858 return VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS;1859 # endif /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 && !VBOX_WITH_NEW_PHYS_CODE*/1860 1790 } 1861 1791
Note:
See TracChangeset
for help on using the changeset viewer.