Changeset 21927 in vbox for trunk/src/VBox
- Timestamp:
- Aug 2, 2009 5:19:29 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/SSM-new.cpp
r21926 r21927 2832 2832 } 2833 2833 } 2834 LogRel(("SSM: Failed to finalize state file! rc=%Rrc\n", rc)); 2834 if (RT_FAILURE(rc)) 2835 LogRel(("SSM: Failed to finalize state file! rc=%Rrc\n", rc)); 2835 2836 } 2836 2837 … … 2994 2995 { 2995 2996 LogRel(("SSM: Incorrect cHostBits value: %u\n", pSSM->u.Read.cHostBits)); 2996 return VERR_SSM_INTEGRITY_ SIZES;2997 return VERR_SSM_INTEGRITY_HEADER; 2997 2998 } 2998 2999 } 2999 3000 else 3000 AssertLogRelReturn(pSSM->u.Read.cHostBits == 0, VERR_SSM_INTEGRITY_ SIZES);3001 AssertLogRelReturn(pSSM->u.Read.cHostBits == 0, VERR_SSM_INTEGRITY_HEADER); 3001 3002 3002 3003 if ( pSSM->u.Read.cbGCPhys != sizeof(uint32_t) … … 3004 3005 { 3005 3006 LogRel(("SSM: Incorrect cbGCPhys value: %d\n", pSSM->u.Read.cbGCPhys)); 3006 return VERR_SSM_INTEGRITY_ SIZES;3007 return VERR_SSM_INTEGRITY_HEADER; 3007 3008 } 3008 3009 if ( pSSM->u.Read.cbGCPtr != sizeof(uint32_t) … … 3010 3011 { 3011 3012 LogRel(("SSM: Incorrect cbGCPtr value: %d\n", pSSM->u.Read.cbGCPtr)); 3012 return VERR_SSM_INTEGRITY_ SIZES;3013 return VERR_SSM_INTEGRITY_HEADER; 3013 3014 } 3014 3015 … … 3148 3149 { 3149 3150 LogRel(("SSM: Bad footer magic: %.*Rhxs\n", sizeof(Footer.szMagic), &Footer.szMagic[0])); 3150 return VERR_SSM_INTEGRITY ;3151 return VERR_SSM_INTEGRITY_FOOTER; 3151 3152 } 3152 3153 SSM_CHECK_CRC32_RET(&Footer, sizeof(Footer), ("Footer CRC mismatch: %08x, correct is %08x\n", u32CRC, u32ActualCRC)); … … 3154 3155 { 3155 3156 LogRel(("SSM: SSMFILEFTR::offStream is wrong: %llx, expected %llx\n", Footer.offStream, offFooter)); 3156 return VERR_SSM_INTEGRITY ;3157 return VERR_SSM_INTEGRITY_FOOTER; 3157 3158 } 3158 3159 if (Footer.u32Reserved) 3159 3160 { 3160 3161 LogRel(("SSM: Reserved footer field isn't zero: %08x\n", Footer.u32Reserved)); 3161 return VERR_SSM_INTEGRITY ;3162 return VERR_SSM_INTEGRITY_FOOTER; 3162 3163 } 3163 3164 if ( !fChecksummed … … 3165 3166 { 3166 3167 LogRel(("SSM: u32StreamCRC field isn't zero, but header says stream checksumming is disabled.\n")); 3167 return VERR_SSM_INTEGRITY ;3168 return VERR_SSM_INTEGRITY_FOOTER; 3168 3169 } 3169 3170 … … 3464 3465 { 3465 3466 LogRel(("SSM: Unit name '%.*s' was not properly terminated.\n", UnitHdr.cchName, pszName)); 3466 rc = VERR_SSM_INTEGRITY ;3467 rc = VERR_SSM_INTEGRITY_UNIT; 3467 3468 break; 3468 3469 } … … 3530 3531 { 3531 3532 LogRel(("SSM: Unit '%s' read %lld bytes too much!\n", pszName, i64Diff)); 3532 VMSetError(pVM, rc, RT_SRC_POS, N_("Unit '%s' read %lld bytes too much"), pszName, i64Diff);3533 rc = VERR_SSM_INTEGRITY;3533 rc = VMSetError(pVM, VERR_SSM_LOADED_TOO_MUCH, RT_SRC_POS, 3534 N_("Unit '%s' read %lld bytes too much"), pszName, i64Diff); 3534 3535 break; 3535 3536 } … … 3543 3544 VMSetError(pVM, rc, RT_SRC_POS, N_("Load exec failed for '%s' instance #%u (version %u)"), 3544 3545 pszName, UnitHdr.u32Instance, UnitHdr.u32Version); 3545 rc = VERR_SSM_INTEGRITY;3546 3546 break; 3547 3547 } … … 3610 3610 if (UnitHdr.cbName) 3611 3611 { 3612 if (RT_UNLIKELY(UnitHdr.cbName > sizeof(UnitHdr.szName))) 3613 { 3614 LogRel(("SSM: Unit at %#llx (%lld): UnitHdr.cbName=%u > %u\n", 3615 offUnit, offUnit, UnitHdr.cbName, sizeof(UnitHdr.szName))); 3616 return VERR_SSM_INTEGRITY; 3617 } 3612 AssertLogRelMsgReturn(UnitHdr.cbName <= sizeof(UnitHdr.szName), 3613 ("Unit at %#llx (%lld): UnitHdr.cbName=%u > %u\n", 3614 offUnit, offUnit, UnitHdr.cbName, sizeof(UnitHdr.szName)), 3615 VERR_SSM_INTEGRITY_UNIT); 3618 3616 rc = ssmR3StrmRead(&pSSM->Strm, &UnitHdr.szName[0], UnitHdr.cbName); 3619 3617 if (RT_FAILURE(rc)) 3620 3618 return rc; 3621 if (RT_UNLIKELY(UnitHdr.szName[UnitHdr.cbName - 1])) 3622 { 3623 LogRel(("SSM: Unit at %#llx (%lld): Name %.*Rhxs was not properly terminated.\n", 3624 offUnit, offUnit, UnitHdr.cbName, UnitHdr.szName)); 3625 return VERR_SSM_INTEGRITY; 3626 } 3619 AssertLogRelMsgReturn(!UnitHdr.szName[UnitHdr.cbName - 1], 3620 ("Unit at %#llx (%lld): Name %.*Rhxs was not properly terminated.\n", 3621 offUnit, offUnit, UnitHdr.cbName, UnitHdr.szName), 3622 VERR_SSM_INTEGRITY_UNIT); 3627 3623 } 3628 3624 SSM_CHECK_CRC32_RET(&UnitHdr, RT_OFFSETOF(SSMFILEUNITHDR, szName[UnitHdr.cbName]), 3629 3625 ("Unit at %#llx (%lld): CRC mismatch: %08x, correct is %08x\n", offUnit, offUnit, u32CRC, u32ActualCRC)); 3630 if (RT_UNLIKELY(UnitHdr.offStream != offUnit)) 3631 { 3632 LogRel(("SSM: Unit at %#llx (%lld): offStream=%#llx, expected %#llx\n", offUnit, offUnit, UnitHdr.offStream, offUnit)); 3633 return VERR_SSM_INTEGRITY; 3634 } 3626 AssertLogRelMsgReturn(UnitHdr.offStream == offUnit, 3627 ("Unit at %#llx (%lld): offStream=%#llx, expected %#llx\n", offUnit, offUnit, UnitHdr.offStream, offUnit), 3628 VERR_SSM_INTEGRITY_UNIT); 3635 3629 AssertLogRelMsgReturn(UnitHdr.u32CurStreamCRC == u32CurStreamCRC || !pSSM->Strm.fChecksummed, 3636 ("Unit at %#llx (%lld): Stream CRC mismatch: %08x, correct is %08x\n", offUnit, offUnit, UnitHdr.u32CurStreamCRC, u32CurStreamCRC), VERR_SSM_INTEGRITY); 3637 AssertLogRelMsgReturn(!UnitHdr.fFlags, ("Unit at %#llx (%lld): fFlags=%08x\n", offUnit, offUnit, UnitHdr.fFlags), VERR_SSM_INTEGRITY); 3630 ("Unit at %#llx (%lld): Stream CRC mismatch: %08x, correct is %08x\n", offUnit, offUnit, UnitHdr.u32CurStreamCRC, u32CurStreamCRC), 3631 VERR_SSM_INTEGRITY_UNIT); 3632 AssertLogRelMsgReturn(!UnitHdr.fFlags, ("Unit at %#llx (%lld): fFlags=%08x\n", offUnit, offUnit, UnitHdr.fFlags), 3633 VERR_SSM_INTEGRITY_UNIT); 3638 3634 if (!memcmp(&UnitHdr.szMagic[0], SSMFILEUNITHDR_END, sizeof(UnitHdr.szMagic))) 3639 3635 { … … 3643 3639 && UnitHdr.u32Phase == SSM_PHASE_FINAL, 3644 3640 ("Unit at %#llx (%lld): Malformed END unit\n", offUnit, offUnit), 3645 VERR_SSM_INTEGRITY );3641 VERR_SSM_INTEGRITY_UNIT); 3646 3642 3647 3643 /* … … 3704 3700 */ 3705 3701 LogRel(("SSM: Found no handler for unit '%s' instance #%u!\n", UnitHdr.szName, UnitHdr.u32Instance)); 3706 //if (pSSM->enmAfter != SSMAFTER_DEBUG_IT)3702 if (pSSM->enmAfter != SSMAFTER_DEBUG_IT) 3707 3703 return VMSetError(pVM, VERR_SSM_INTEGRITY_UNIT_NOT_FOUND, RT_SRC_POS, 3708 3704 N_("Found no handler for unit '%s' instance #%u"), UnitHdr.szName, UnitHdr.u32Instance); 3709 /** @todo Read data unit to /dev/null. */ 3705 SSMR3SkipToEndOfUnit(pSSM); 3706 ssmR3DataReadFinishV2(pSSM); 3710 3707 } 3711 3708 } … … 4040 4037 AssertLogRelMsgReturn(!szName[UnitHdr.cchName - 1], 4041 4038 (" Unit name '%.*s' was not properly terminated.\n", cbUnitNm, szName), 4042 VERR_SSM_INTEGRITY );4039 VERR_SSM_INTEGRITY_UNIT); 4043 4040 4044 4041 /* … … 4088 4085 int rc = ssmR3StrmPeekAt(&pSSM->Strm, offDir, pDir, cbDir, NULL); 4089 4086 AssertLogRelRCReturn(rc, rc); 4090 AssertLogRelReturn(!memcmp(pDir->szMagic, SSMFILEDIR_MAGIC, sizeof(pDir->szMagic)), VERR_SSM_INTEGRITY );4087 AssertLogRelReturn(!memcmp(pDir->szMagic, SSMFILEDIR_MAGIC, sizeof(pDir->szMagic)), VERR_SSM_INTEGRITY_DIR_MAGIC); 4091 4088 SSM_CHECK_CRC32_RET(pDir, cbDir, ("Bad directory CRC: %08x, actual %08x\n", u32CRC, u32ActualCRC)); 4092 4089 AssertLogRelMsgReturn(pDir->cEntries == cDirEntries, 4093 4090 ("Bad directory entry count: %#x, expected %#x (from the footer)\n", pDir->cEntries, cDirEntries), 4094 VERR_SSM_INTEGRITY);4091 VERR_SSM_INTEGRITY_DIR); 4095 4092 for (uint32_t i = 0; i < cDirEntries; i++) 4096 4093 AssertLogRelMsgReturn(pDir->aEntries[i].off < offDir, 4097 4094 ("i=%u off=%lld offDir=%lld\n", i, pDir->aEntries[i].off, offDir), 4098 VERR_SSM_INTEGRITY );4095 VERR_SSM_INTEGRITY_DIR); 4099 4096 4100 4097 /* … … 4123 4120 AssertLogRelMsgReturn(!memcmp(UnitHdr.szMagic, SSMFILEUNITHDR_MAGIC, sizeof(UnitHdr.szMagic)), 4124 4121 ("Bad unit header or dictionary offset: i=%u off=%lld\n", i, pDir->aEntries[i].off), 4125 VERR_SSM_INTEGRITY );4122 VERR_SSM_INTEGRITY_UNIT); 4126 4123 AssertLogRelMsgReturn(UnitHdr.offStream == pDir->aEntries[i].off, 4127 4124 ("Bad unit header: i=%d off=%lld offStream=%lld\n", i, pDir->aEntries[i].off, UnitHdr.offStream), 4128 VERR_SSM_INTEGRITY );4125 VERR_SSM_INTEGRITY_UNIT); 4129 4126 AssertLogRelMsgReturn(UnitHdr.u32Instance == pDir->aEntries[i].u32Instance, 4130 4127 ("Bad unit header: i=%d off=%lld u32Instance=%u Dir.u32Instance=%u\n", 4131 4128 i, pDir->aEntries[i].off, UnitHdr.u32Instance, pDir->aEntries[i].u32Instance), 4132 VERR_SSM_INTEGRITY );4129 VERR_SSM_INTEGRITY_UNIT); 4133 4130 uint32_t cbUnitHdr = RT_UOFFSETOF(SSMFILEUNITHDR, szName[UnitHdr.cbName]); 4134 4131 AssertLogRelMsgReturn( UnitHdr.cbName > 0 … … 4136 4133 && cbUnitHdr <= cbToRead, 4137 4134 ("Bad unit header: i=%u off=%lld cbName=%#x cbToRead=%#x\n", i, pDir->aEntries[i].off, UnitHdr.cbName, cbToRead), 4138 VERR_SSM_INTEGRITY );4135 VERR_SSM_INTEGRITY_UNIT); 4139 4136 SSM_CHECK_CRC32_RET(&UnitHdr, RT_OFFSETOF(SSMFILEUNITHDR, szName[UnitHdr.cbName]), 4140 4137 ("Bad unit header CRC: i=%u off=%lld u32CRC=%#x u32ActualCRC=%#x\n", … … 5041 5038 } 5042 5039 5043 /** @todo weed out lazy saving */5044 5040 if (pSSM->enmAfter != SSMAFTER_DEBUG_IT) 5045 5041 AssertMsgFailed(("SSM: attempted reading more than the unit!\n")); … … 5121 5117 if ( RT_SUCCESS(rc) 5122 5118 && !pSSM->u.Read.fEndOfData) 5123 rc = VERR_SSM_LOADED_TOO_MUCH; /** @todo More error codes! */ 5119 { 5120 rc = VERR_SSM_LOADED_TOO_LITTLE; 5121 AssertFailed(); 5122 } 5124 5123 pSSM->rc = rc; 5125 5124 } … … 5167 5166 && pSSM->u.Read.cbRecLeft <= RT_SIZEOFMEMB(SSMHANDLE, u.Read.abComprBuffer) + 2, 5168 5167 ("%#x\n", pSSM->u.Read.cbRecLeft), 5169 VERR_SSM_INTEGRITY); 5170 5171 /** @todo this isn't very efficient, we know we have to read it all, so both 5172 * reading the first byte separately. */ 5168 VERR_SSM_INTEGRITY_DECOMPRESSION); 5169 5173 5170 uint8_t cKB; 5174 5171 int rc = ssmR3DataReadV2Raw(pSSM, &cKB, 1); … … 5181 5178 && cbDecompr <= RT_SIZEOFMEMB(SSMHANDLE, u.Read.abDataBuffer), 5182 5179 ("%#x\n", cbDecompr), 5183 VERR_SSM_INTEGRITY );5180 VERR_SSM_INTEGRITY_DECOMPRESSION); 5184 5181 5185 5182 *pcbDecompr = cbDecompr; … … 5229 5226 if (RT_SUCCESS(rc)) 5230 5227 { 5231 AssertLogRelMsgReturn(cbDstActual == cbDecompr, ("%#x %#x\n", cbDstActual, cbDecompr), VERR_SSM_INTEGRITY );5228 AssertLogRelMsgReturn(cbDstActual == cbDecompr, ("%#x %#x\n", cbDstActual, cbDecompr), VERR_SSM_INTEGRITY_DECOMPRESSION); 5232 5229 return VINF_SUCCESS; 5233 5230 } 5234 return rc; 5231 5232 AssertLogRelMsgFailed(("cbCompr=%#x cbDecompr=%#x rc=%Rrc\n", cbCompr, cbDecompr, rc)); 5233 return VERR_SSM_INTEGRITY_DECOMPRESSION; 5235 5234 } 5236 5235 … … 5263 5262 */ 5264 5263 pSSM->u.Read.u8TypeAndFlags = abHdr[0]; 5265 AssertLogRelMsgReturn(SSM_REC_ARE_TYPE_AND_FLAGS_VALID(abHdr[0]), ("%#x %#x\n", abHdr[0], abHdr[1]), VERR_SSM_INTEGRITY );5264 AssertLogRelMsgReturn(SSM_REC_ARE_TYPE_AND_FLAGS_VALID(abHdr[0]), ("%#x %#x\n", abHdr[0], abHdr[1]), VERR_SSM_INTEGRITY_REC_HDR); 5266 5265 if ((abHdr[0] & SSM_REC_TYPE_MASK) == SSM_REC_TYPE_TERM) 5267 5266 { 5268 5267 pSSM->u.Read.cbRecLeft = 0; 5269 5268 pSSM->u.Read.fEndOfData = true; 5270 AssertLogRelMsgReturn(abHdr[1] == sizeof(SSMRECTERM) - 2, ("%#x\n", abHdr[1]), VERR_SSM_INTEGRITY );5271 AssertLogRelMsgReturn(abHdr[0] & SSM_REC_FLAGS_IMPORTANT, ("%#x\n", abHdr[0]), VERR_SSM_INTEGRITY );5269 AssertLogRelMsgReturn(abHdr[1] == sizeof(SSMRECTERM) - 2, ("%#x\n", abHdr[1]), VERR_SSM_INTEGRITY_REC_TERM); 5270 AssertLogRelMsgReturn(abHdr[0] & SSM_REC_FLAGS_IMPORTANT, ("%#x\n", abHdr[0]), VERR_SSM_INTEGRITY_REC_TERM); 5272 5271 5273 5272 /* get the rest */ … … 5281 5280 AssertLogRelMsgReturn(TermRec.cbUnit == pSSM->offUnit, 5282 5281 ("cbUnit=%#llx offUnit=%#llx\n", TermRec.cbUnit, pSSM->offUnit), 5283 VERR_SSM_INTEGRITY );5284 AssertLogRelMsgReturn(!(TermRec.fFlags & ~SSMRECTERM_FLAGS_CRC32), ("%#x\n", TermRec.fFlags), VERR_SSM_INTEGRITY );5282 VERR_SSM_INTEGRITY_REC_TERM); 5283 AssertLogRelMsgReturn(!(TermRec.fFlags & ~SSMRECTERM_FLAGS_CRC32), ("%#x\n", TermRec.fFlags), VERR_SSM_INTEGRITY_REC_TERM); 5285 5284 if (!(TermRec.fFlags & SSMRECTERM_FLAGS_CRC32)) 5286 AssertLogRelMsgReturn(TermRec.u32StreamCRC == 0, ("%#x\n", TermRec.u32StreamCRC), VERR_SSM_INTEGRITY );5285 AssertLogRelMsgReturn(TermRec.u32StreamCRC == 0, ("%#x\n", TermRec.u32StreamCRC), VERR_SSM_INTEGRITY_REC_TERM); 5287 5286 else if (pSSM->Strm.fChecksummed) 5288 AssertLogRelMsgReturn(TermRec.u32StreamCRC == u32StreamCRC, ("%#x, %#x\n", TermRec.u32StreamCRC, u32StreamCRC), VERR_SSM_INTEGRITY_CRC); 5287 AssertLogRelMsgReturn(TermRec.u32StreamCRC == u32StreamCRC, ("%#x, %#x\n", TermRec.u32StreamCRC, u32StreamCRC), 5288 VERR_SSM_INTEGRITY_REC_TERM_CRC); 5289 5289 5290 5290 Log3(("ssmR3DataReadRecHdrV2: %08llx|%08llx: TERM\n", ssmR3StrmTell(&pSSM->Strm) - sizeof(SSMRECTERM), pSSM->offUnit)); … … 5316 5316 cb = 6; 5317 5317 else 5318 AssertLogRelMsgFailedReturn(("Invalid record size byte: %#x\n", cb), VERR_SSM_INTEGRITY );5318 AssertLogRelMsgFailedReturn(("Invalid record size byte: %#x\n", cb), VERR_SSM_INTEGRITY_REC_HDR); 5319 5319 cbHdr = cb + 1; 5320 5320 … … 5329 5329 { 5330 5330 case 6: 5331 AssertLogRelMsgReturn((abHdr[6] & 0xc0) == 0x80, ("6/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY );5331 AssertLogRelMsgReturn((abHdr[6] & 0xc0) == 0x80, ("6/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY_REC_HDR); 5332 5332 case 5: 5333 AssertLogRelMsgReturn((abHdr[5] & 0xc0) == 0x80, ("5/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY );5333 AssertLogRelMsgReturn((abHdr[5] & 0xc0) == 0x80, ("5/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY_REC_HDR); 5334 5334 case 4: 5335 AssertLogRelMsgReturn((abHdr[4] & 0xc0) == 0x80, ("4/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY );5335 AssertLogRelMsgReturn((abHdr[4] & 0xc0) == 0x80, ("4/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY_REC_HDR); 5336 5336 case 3: 5337 AssertLogRelMsgReturn((abHdr[3] & 0xc0) == 0x80, ("3/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY );5337 AssertLogRelMsgReturn((abHdr[3] & 0xc0) == 0x80, ("3/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY_REC_HDR); 5338 5338 case 2: 5339 AssertLogRelMsgReturn((abHdr[2] & 0xc0) == 0x80, ("2/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY );5339 AssertLogRelMsgReturn((abHdr[2] & 0xc0) == 0x80, ("2/%u: %.*Rhxs\n", cb, cb + 1, &abHdr[0]), VERR_SSM_INTEGRITY_REC_HDR); 5340 5340 break; 5341 5341 default: … … 5355 5355 | ((uint32_t)(abHdr[2] & 0x3f) << 24) 5356 5356 | ((uint32_t)(abHdr[1] & 0x01) << 30); 5357 AssertLogRelMsgReturn(cb >= 0x04000000 && cb <= 0x7fffffff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY );5357 AssertLogRelMsgReturn(cb >= 0x04000000 && cb <= 0x7fffffff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY_REC_HDR); 5358 5358 break; 5359 5359 case 5: … … 5363 5363 | ((uint32_t)(abHdr[2] & 0x3f) << 18) 5364 5364 | ((uint32_t)(abHdr[1] & 0x03) << 24); 5365 AssertLogRelMsgReturn(cb >= 0x00200000 && cb <= 0x03ffffff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY );5365 AssertLogRelMsgReturn(cb >= 0x00200000 && cb <= 0x03ffffff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY_REC_HDR); 5366 5366 break; 5367 5367 case 4: … … 5370 5370 | ((uint32_t)(abHdr[2] & 0x3f) << 12) 5371 5371 | ((uint32_t)(abHdr[1] & 0x07) << 18); 5372 AssertLogRelMsgReturn(cb >= 0x00010000 && cb <= 0x001fffff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY );5372 AssertLogRelMsgReturn(cb >= 0x00010000 && cb <= 0x001fffff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY_REC_HDR); 5373 5373 break; 5374 5374 case 3: … … 5377 5377 | ((uint32_t)(abHdr[1] & 0x0f) << 12); 5378 5378 #if 0 /* disabled to optimize buffering */ 5379 AssertLogRelMsgReturn(cb >= 0x00000800 && cb <= 0x0000ffff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY );5379 AssertLogRelMsgReturn(cb >= 0x00000800 && cb <= 0x0000ffff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY_REC_HDR); 5380 5380 #endif 5381 5381 break; … … 5384 5384 | ((uint32_t)(abHdr[1] & 0x1f) << 6); 5385 5385 #if 0 /* disabled to optimize buffering */ 5386 AssertLogRelMsgReturn(cb >= 0x00000080 && cb <= 0x000007ff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY );5386 AssertLogRelMsgReturn(cb >= 0x00000080 && cb <= 0x000007ff, ("cb=%#x\n", cb), VERR_SSM_INTEGRITY_REC_HDR); 5387 5387 #endif 5388 5388 break; … … 6238 6238 6239 6239 /** 6240 * Skips to the end of the current data unit. 6241 * 6242 * Since version 2 of the format, the load exec callback have to explicitly call 6243 * this API if it wish to be lazy for some reason. This is because there seldom 6244 * is a good reason to not read your entire data unit and it was hiding bugs. 6245 * 6246 * @returns VBox status code. 6247 * @param pSSM The saved state handle. 6248 */ 6249 VMMR3DECL(int) SSMR3SkipToEndOfUnit(PSSMHANDLE pSSM) 6250 { 6251 AssertMsgReturn( pSSM->enmOp == SSMSTATE_LOAD_EXEC 6252 || pSSM->enmOp == SSMSTATE_OPEN_READ, 6253 ("Invalid state %d\n", pSSM->enmOp), 6254 VERR_SSM_INVALID_STATE); 6255 if (pSSM->u.Read.uFmtVerMajor >= 2) 6256 { 6257 /* 6258 * Read until we the end of data condition is raised. 6259 */ 6260 pSSM->u.Read.cbDataBuffer = 0; 6261 pSSM->u.Read.offDataBuffer = 0; 6262 if (!pSSM->u.Read.fEndOfData) 6263 { 6264 do 6265 { 6266 /* read the rest of the current record */ 6267 while (pSSM->u.Read.cbRecLeft) 6268 { 6269 uint8_t abBuf[8192]; 6270 size_t cbToRead = RT_MIN(sizeof(pSSM->u.Read.cbRecLeft), sizeof(abBuf)); 6271 int rc = ssmR3DataReadV2Raw(pSSM, abBuf, cbToRead); 6272 if (RT_FAILURE(rc)) 6273 return pSSM->rc = rc; 6274 pSSM->u.Read.cbRecLeft -= cbToRead; 6275 } 6276 6277 /* read the next header. */ 6278 int rc = ssmR3DataReadRecHdrV2(pSSM); 6279 if (RT_FAILURE(rc)) 6280 return pSSM->rc = rc; 6281 } while (!pSSM->u.Read.fEndOfData); 6282 } 6283 } 6284 /* else: Doesn't matter for the version 1 loading. */ 6285 6286 return VINF_SUCCESS; 6287 } 6288 6289 6290 /** 6240 6291 * Query what the VBox status code of the operation is. 6241 6292 * -
trunk/src/VBox/VMM/SSM.cpp
r21799 r21927 1507 1507 { 1508 1508 LogRel(("SSM: Incorrect cHostBits value: %d\n", pHdr->cHostBits)); 1509 return VERR_SSM_INTEGRITY_ SIZES;1509 return VERR_SSM_INTEGRITY_HEADER; 1510 1510 } 1511 1511 if ( pHdr->cbGCPhys != sizeof(uint32_t) … … 1513 1513 { 1514 1514 LogRel(("SSM: Incorrect cbGCPhys value: %d\n", pHdr->cbGCPhys)); 1515 return VERR_SSM_INTEGRITY_ SIZES;1515 return VERR_SSM_INTEGRITY_HEADER; 1516 1516 } 1517 1517 if ( pHdr->cbGCPtr != sizeof(uint32_t) … … 1519 1519 { 1520 1520 LogRel(("SSM: Incorrect cbGCPtr value: %d\n", pHdr->cbGCPtr)); 1521 return VERR_SSM_INTEGRITY_ SIZES;1521 return VERR_SSM_INTEGRITY_HEADER; 1522 1522 } 1523 1523 } … … 3502 3502 3503 3503 /** 3504 * Skips to the end of the current data unit. 3505 * 3506 * Since version 2 of the format, the load exec callback have to explicitly call 3507 * this API if it wish to be lazy for some reason. This is because there seldom 3508 * is a good reason to not read your entire data unit and it was hiding bugs. 3509 * 3510 * @returns VBox status code. 3511 * @param pSSM The saved state handle. 3512 */ 3513 VMMR3DECL(int) SSMR3SkipToEndOfUnit(PSSMHANDLE pSSM) 3514 { 3515 /* nothing to do here. */ 3516 return VINF_SUCCESS; 3517 } 3518 3519 3520 /** 3504 3521 * Query what the VBox status code of the operation is. 3505 3522 *
Note:
See TracChangeset
for help on using the changeset viewer.