Changeset 13148 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Oct 9, 2008 11:04:30 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r13147 r13148 2022 2022 VMMDECL(int) PGMPhysSimpleReadGCPtr(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb) 2023 2023 { 2024 # if defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) || defined(VBOX_WITH_NEW_PHYS_CODE)2025 2024 /* 2026 2025 * Treat the first page as a special case. … … 2078 2077 } 2079 2078 /* won't ever get here. */ 2080 2081 # else /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 && !VBOX_WITH_NEW_PHYS_CODE */2082 2083 /*2084 * Anything to do?2085 */2086 if (!cb)2087 return VINF_SUCCESS;2088 2089 /*2090 * Optimize reads within a single page.2091 */2092 if (((RTGCUINTPTR)GCPtrSrc & PAGE_OFFSET_MASK) + cb <= PAGE_SIZE)2093 {2094 void *pvSrc;2095 int rc = PGMPhysGCPtr2HCPtr(pVM, GCPtrSrc, &pvSrc);2096 if (VBOX_FAILURE(rc))2097 return rc;2098 memcpy(pvDst, pvSrc, cb);2099 return VINF_SUCCESS;2100 }2101 2102 /*2103 * Page by page.2104 */2105 for (;;)2106 {2107 /* convert */2108 void *pvSrc;2109 int rc = PGMPhysGCPtr2HCPtr(pVM, GCPtrSrc, &pvSrc);2110 if (VBOX_FAILURE(rc))2111 return rc;2112 2113 /* copy */2114 size_t cbRead = PAGE_SIZE - ((RTGCUINTPTR)GCPtrSrc & PAGE_OFFSET_MASK);2115 if (cbRead >= cb)2116 {2117 memcpy(pvDst, pvSrc, cb);2118 return VINF_SUCCESS;2119 }2120 memcpy(pvDst, pvSrc, cbRead);2121 2122 /* next */2123 cb -= cbRead;2124 pvDst = (uint8_t *)pvDst + cbRead;2125 GCPtrSrc += cbRead;2126 }2127 # endif /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 && !VBOX_WITH_NEW_PHYS_CODE */2128 2079 } 2129 2080
Note:
See TracChangeset
for help on using the changeset viewer.