Changeset 23521 in vbox
- Timestamp:
- Oct 2, 2009 9:08:07 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PGMSavedState.cpp
r23518 r23521 941 941 { 942 942 /* 943 * Save all non-zero pages.943 * The mop up round. 944 944 */ 945 945 pgmLock(pVM); … … 948 948 pMmio2 = pMmio2->pNextR3) 949 949 { 950 uint8_t const *pbPage = (uint8_t const *)pMmio2->RamRange.pvR3; 951 uint32_t cPages = pMmio2->RamRange.cb >> PAGE_SHIFT; 950 PPGMLIVESAVEMMIO2PAGE paLSPages = pMmio2->paLSPages; 951 uint8_t const *pbPage = (uint8_t const *)pMmio2->RamRange.pvR3; 952 uint32_t cPages = pMmio2->RamRange.cb >> PAGE_SHIFT; 953 uint32_t iPageLast = cPages; 952 954 for (uint32_t iPage = 0; iPage < cPages; iPage++, pbPage += PAGE_SIZE) 953 955 { 954 uint8_t u8Type = ASMMemIsZeroPage(pbPage) ? PGM_STATE_REC_MMIO2_ZERO : PGM_STATE_REC_MMIO2_RAW; 955 if (iPage != 0) 956 uint8_t u8Type; 957 if (!fLiveSave) 958 u8Type = ASMMemIsZeroPage(pbPage) ? PGM_STATE_REC_MMIO2_ZERO : PGM_STATE_REC_MMIO2_RAW; 959 else 960 { 961 if ( !paLSPages[iPage].fDirty 962 && !pgmR3ScanMmio2Page(pVM, pbPage, &paLSPages[iPage])) 963 { 964 if (paLSPages[iPage].fZero) 965 continue; 966 967 /* We have to be sure here before put it down as successfully written. */ 968 uint8_t abSha1Hash[RTSHA1_HASH_SIZE]; 969 RTSha1(pbPage, PAGE_SIZE, abSha1Hash); 970 if (!memcmp(abSha1Hash, paLSPages[iPage].abSha1Saved, sizeof(abSha1Hash))) 971 continue; 972 } 973 u8Type = paLSPages[iPage].fZero ? PGM_STATE_REC_MMIO2_ZERO : PGM_STATE_REC_MMIO2_RAW; 974 } 975 976 if (iPage != 0 && iPage == iPageLast + 1) 956 977 rc = SSMR3PutU8(pSSM, u8Type); 957 978 else … … 959 980 SSMR3PutU8(pSSM, u8Type | PGM_STATE_REC_FLAG_ADDR); 960 981 SSMR3PutU8(pSSM, pMmio2->idSavedState); 961 rc = SSMR3PutU32(pSSM, 0);982 rc = SSMR3PutU32(pSSM, iPage); 962 983 } 963 984 if (u8Type == PGM_STATE_REC_MMIO2_RAW) … … 965 986 if (RT_FAILURE(rc)) 966 987 break; 988 iPageLast = iPage; 967 989 } 968 990 } … … 970 992 } 971 993 /* 972 * Only do this every 4rd time, two passes after the scan. 994 * Only do this every 4rd time since it's kind of expense. 995 * We position it two passes after the scan pass to avoid saving busy pages. 973 996 */ 974 997 else if ((uPass & 3) == 2) 975 998 { 976 /** @todo */ 999 pgmLock(pVM); 1000 for (PPGMMMIO2RANGE pMmio2 = pVM->pgm.s.pMmio2RangesR3; 1001 pMmio2 && RT_SUCCESS(rc); 1002 pMmio2 = pMmio2->pNextR3) 1003 { 1004 PPGMLIVESAVEMMIO2PAGE paLSPages = pMmio2->paLSPages; 1005 uint8_t const *pbPage = (uint8_t const *)pMmio2->RamRange.pvR3; 1006 uint32_t cPages = pMmio2->RamRange.cb >> PAGE_SHIFT; 1007 uint32_t iPageLast = cPages; 1008 pgmUnlock(pVM); 1009 1010 for (uint32_t iPage = 0; iPage < cPages; iPage++, pbPage += PAGE_SIZE) 1011 { 1012 if (!paLSPages[iPage].fDirty) 1013 continue; 1014 if (paLSPages[iPage].cUnchangedScans < 3) 1015 continue; 1016 if (!pgmR3ScanMmio2Page(pVM, pbPage, &paLSPages[iPage])) 1017 continue; 1018 1019 if (!paLSPages[iPage].fZero) 1020 RTSha1(pbPage, PAGE_SIZE, paLSPages[iPage].abSha1Saved); 1021 uint8_t u8Type = paLSPages[iPage].fZero ? PGM_STATE_REC_MMIO2_ZERO : PGM_STATE_REC_MMIO2_RAW; 1022 1023 if (iPage != 0 && iPage == iPageLast + 1) 1024 rc = SSMR3PutU8(pSSM, u8Type); 1025 else 1026 { 1027 SSMR3PutU8(pSSM, u8Type | PGM_STATE_REC_FLAG_ADDR); 1028 SSMR3PutU8(pSSM, pMmio2->idSavedState); 1029 rc = SSMR3PutU32(pSSM, iPage); 1030 } 1031 if (u8Type == PGM_STATE_REC_MMIO2_RAW) 1032 rc = SSMR3PutMem(pSSM, pbPage, PAGE_SIZE); 1033 1034 if (RT_FAILURE(rc)) 1035 break; 1036 iPageLast = iPage; 1037 } 1038 1039 pgmLock(pVM); 1040 } 1041 pgmUnlock(pVM); 977 1042 } 978 1043
Note:
See TracChangeset
for help on using the changeset viewer.