Changeset 13151 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Oct 9, 2008 11:13:22 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
r13150 r13151 1875 1875 VMMDECL(int) PGMPhysSimpleWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb) 1876 1876 { 1877 # if defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) || defined(VBOX_WITH_NEW_PHYS_CODE)1878 1877 LogFlow(("PGMPhysSimpleWriteGCPhys: %RGp %zu\n", GCPhysDst, cb)); 1879 1878 … … 1933 1932 } 1934 1933 /* won't ever get here. */ 1935 1936 1937 # else /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 && !VBOX_WITH_NEW_PHYS_CODE*/1938 1939 /*1940 * Anything to be done?1941 */1942 if (!cb)1943 return VINF_SUCCESS;1944 1945 LogFlow(("PGMPhysSimpleWriteGCPhys: %RGp %zu\n", GCPhysDst, cb));1946 1947 /*1948 * Loop ram ranges.1949 */1950 for (PPGMRAMRANGE pRam = pVM->pgm.s.CTX_SUFF(pRamRanges);1951 pRam;1952 pRam = pRam->CTX_SUFF(pNext))1953 {1954 RTGCPHYS off = GCPhysDst - pRam->GCPhys;1955 if (off < pRam->cb)1956 {1957 if (pRam->fFlags & MM_RAM_FLAGS_DYNAMIC_ALLOC)1958 {1959 /* Copy page by page as we're not dealing with a linear HC range. */1960 for (;;)1961 {1962 /* convert */1963 void *pvDst;1964 int rc = pgmRamGCPhys2HCPtrWithRange(pVM, pRam, GCPhysDst, &pvDst);1965 if (VBOX_FAILURE(rc))1966 return rc;1967 1968 /* copy */1969 size_t cbWrite = PAGE_SIZE - ((RTGCUINTPTR)GCPhysDst & PAGE_OFFSET_MASK);1970 if (cbWrite >= cb)1971 {1972 memcpy(pvDst, pvSrc, cb);1973 return VINF_SUCCESS;1974 }1975 memcpy(pvDst, pvSrc, cbWrite);1976 1977 /* next */1978 cb -= cbWrite;1979 pvSrc = (uint8_t *)pvSrc + cbWrite;1980 GCPhysDst += cbWrite;1981 }1982 }1983 else if (pRam->pvR3)1984 {1985 /* write */1986 size_t cbWrite = pRam->cb - off;1987 if (cbWrite >= cb)1988 {1989 memcpy((uint8_t *)pRam->pvR3 + off, pvSrc, cb);1990 return VINF_SUCCESS;1991 }1992 memcpy((uint8_t *)pRam->pvR3 + off, pvSrc, cbWrite);1993 1994 /* next */1995 cb -= cbWrite;1996 GCPhysDst += cbWrite;1997 pvSrc = (uint8_t *)pvSrc + cbWrite;1998 }1999 else2000 return VERR_PGM_PHYS_PAGE_RESERVED;2001 }2002 else if (GCPhysDst < pRam->GCPhysLast)2003 break;2004 }2005 return VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS;2006 # endif /* !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 && !VBOX_WITH_NEW_PHYS_CODE*/2007 1934 } 2008 1935
Note:
See TracChangeset
for help on using the changeset viewer.