Changeset 22480 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 26, 2009 5:14:13 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/CPUM.cpp
r22070 r22480 100 100 static int cpumR3CpuIdInit(PVM pVM); 101 101 static DECLCALLBACK(int) cpumR3Save(PVM pVM, PSSMHANDLE pSSM); 102 static DECLCALLBACK(int) cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);102 static DECLCALLBACK(int) cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 103 103 static DECLCALLBACK(void) cpumR3InfoAll(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs); 104 104 static DECLCALLBACK(void) cpumR3InfoGuest(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs); … … 199 199 */ 200 200 int rc = SSMR3RegisterInternal(pVM, "cpum", 1, CPUM_SAVED_STATE_VERSION, sizeof(CPUM), 201 NULL, NULL, NULL, 201 202 NULL, cpumR3Save, NULL, 202 203 NULL, cpumR3Load, NULL); … … 990 991 * @param pVM VM Handle. 991 992 * @param pSSM SSM operation handle. 992 * @param u32Version Data layout version. 993 */ 994 static DECLCALLBACK(int) cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 995 { 993 * @param uVersion Data layout version. 994 */ 995 static DECLCALLBACK(int) cpumR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 996 { 997 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 998 996 999 /* 997 1000 * Validate version. 998 1001 */ 999 if ( u 32Version != CPUM_SAVED_STATE_VERSION1000 && u 32Version != CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR1001 && u 32Version != CPUM_SAVED_STATE_VERSION_VER2_01002 && u 32Version != CPUM_SAVED_STATE_VERSION_VER1_6)1003 { 1004 AssertMsgFailed(("cpuR3Load: Invalid version u 32Version=%d!\n", u32Version));1002 if ( uVersion != CPUM_SAVED_STATE_VERSION 1003 && uVersion != CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR 1004 && uVersion != CPUM_SAVED_STATE_VERSION_VER2_0 1005 && uVersion != CPUM_SAVED_STATE_VERSION_VER1_6) 1006 { 1007 AssertMsgFailed(("cpuR3Load: Invalid version uVersion=%d!\n", uVersion)); 1005 1008 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 1006 1009 } 1007 1010 1008 1011 /* Set the size of RTGCPTR for SSMR3GetGCPtr. */ 1009 if (u 32Version == CPUM_SAVED_STATE_VERSION_VER1_6)1012 if (uVersion == CPUM_SAVED_STATE_VERSION_VER1_6) 1010 1013 SSMR3SetGCPtrSize(pSSM, sizeof(RTGCPTR32)); 1011 else if (u 32Version <= CPUM_SAVED_STATE_VERSION)1014 else if (uVersion <= CPUM_SAVED_STATE_VERSION) 1012 1015 SSMR3SetGCPtrSize(pSSM, HC_ARCH_BITS == 32 ? sizeof(RTGCPTR32) : sizeof(RTGCPTR)); 1013 1016 … … 1015 1018 * Restore. 1016 1019 */ 1017 for ( unsigned i=0;i<pVM->cCPUs;i++)1020 for (VMCPUID i = 0; i < pVM->cCPUs; i++) 1018 1021 { 1019 1022 PVMCPU pVCpu = &pVM->aCpus[i]; … … 1026 1029 } 1027 1030 1028 if (u 32Version == CPUM_SAVED_STATE_VERSION_VER1_6)1031 if (uVersion == CPUM_SAVED_STATE_VERSION_VER1_6) 1029 1032 { 1030 1033 CPUMCTX_VER1_6 cpumctx16; … … 1040 1043 else 1041 1044 { 1042 if (u 32Version >= CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR)1045 if (uVersion >= CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR) 1043 1046 { 1044 1047 int rc = SSMR3GetU32(pSSM, &pVM->cCPUs); … … 1048 1051 if ( !pVM->cCPUs 1049 1052 || pVM->cCPUs > VMM_MAX_CPU_COUNT 1050 || ( u 32Version == CPUM_SAVED_STATE_VERSION_VER2_01053 || ( uVersion == CPUM_SAVED_STATE_VERSION_VER2_0 1051 1054 && pVM->cCPUs != 1)) 1052 1055 { … … 1055 1058 } 1056 1059 1057 for ( unsigned i=0;i<pVM->cCPUs;i++)1060 for (VMCPUID i = 0; i < pVM->cCPUs; i++) 1058 1061 { 1059 1062 SSMR3GetMem(pSSM, &pVM->aCpus[i].cpum.s.Guest, sizeof(pVM->aCpus[i].cpum.s.Guest)); 1060 1063 SSMR3GetU32(pSSM, &pVM->aCpus[i].cpum.s.fUseFlags); 1061 1064 SSMR3GetU32(pSSM, &pVM->aCpus[i].cpum.s.fChanged); 1062 if (u 32Version == CPUM_SAVED_STATE_VERSION)1065 if (uVersion == CPUM_SAVED_STATE_VERSION) 1063 1066 SSMR3GetMem(pSSM, &pVM->aCpus[i].cpum.s.GuestMsr, sizeof(pVM->aCpus[i].cpum.s.GuestMsr)); 1064 1067 } -
trunk/src/VBox/VMM/EM.cpp
r21403 r22480 84 84 *******************************************************************************/ 85 85 static DECLCALLBACK(int) emR3Save(PVM pVM, PSSMHANDLE pSSM); 86 static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);86 static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 87 87 static int emR3Debug(PVM pVM, PVMCPU pVCpu, int rc); 88 88 static int emR3RemStep(PVM pVM, PVMCPU pVCpu); … … 131 131 */ 132 132 rc = SSMR3RegisterInternal(pVM, "em", 0, EM_SAVED_STATE_VERSION, 16, 133 NULL, NULL, NULL, 133 134 NULL, emR3Save, NULL, 134 135 NULL, emR3Load, NULL); … … 516 517 * @param pVM VM Handle. 517 518 * @param pSSM SSM operation handle. 518 * @param u32Version Data layout version. 519 */ 520 static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 519 * @param uVersion Data layout version. 520 * @param uPhase The data phase. 521 */ 522 static DECLCALLBACK(int) emR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 521 523 { 522 int rc = VINF_SUCCESS;523 524 524 /* 525 525 * Validate version. 526 526 */ 527 if ( u 32Version != EM_SAVED_STATE_VERSION528 && u 32Version != EM_SAVED_STATE_VERSION_PRE_SMP)529 { 530 AssertMsgFailed(("emR3Load: Invalid version u 32Version=%d (current %d)!\n", u32Version, EM_SAVED_STATE_VERSION));527 if ( uVersion != EM_SAVED_STATE_VERSION 528 && uVersion != EM_SAVED_STATE_VERSION_PRE_SMP) 529 { 530 AssertMsgFailed(("emR3Load: Invalid version uVersion=%d (current %d)!\n", uVersion, EM_SAVED_STATE_VERSION)); 531 531 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 532 532 } … … 539 539 PVMCPU pVCpu = &pVM->aCpus[i]; 540 540 541 rc = SSMR3GetBool(pSSM, &pVCpu->em.s.fForceRAW);541 int rc = SSMR3GetBool(pSSM, &pVCpu->em.s.fForceRAW); 542 542 if (RT_FAILURE(rc)) 543 543 pVCpu->em.s.fForceRAW = false; 544 545 if (u32Version > EM_SAVED_STATE_VERSION_PRE_SMP) 544 AssertRCReturn(rc, rc); 545 546 if (uVersion > EM_SAVED_STATE_VERSION_PRE_SMP) 546 547 { 547 548 AssertCompile(sizeof(pVCpu->em.s.enmPrevState) == sizeof(uint32_t)); … … 554 555 Assert(!pVCpu->em.s.pCliStatTree); 555 556 } 556 return rc;557 return VINF_SUCCESS; 557 558 } 558 559 -
trunk/src/VBox/VMM/HWACCM.cpp
r22290 r22480 270 270 *******************************************************************************/ 271 271 static DECLCALLBACK(int) hwaccmR3Save(PVM pVM, PSSMHANDLE pSSM); 272 static DECLCALLBACK(int) hwaccmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);272 static DECLCALLBACK(int) hwaccmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 273 273 274 274 … … 308 308 */ 309 309 int rc = SSMR3RegisterInternal(pVM, "HWACCM", 0, HWACCM_SSM_VERSION, sizeof(HWACCM), 310 NULL, NULL, NULL, 310 311 NULL, hwaccmR3Save, NULL, 311 312 NULL, hwaccmR3Load, NULL); … … 327 328 * Check CFGM options. 328 329 */ 329 PCFGMNODE pRoot = CFGMR3GetRoot(pVM); 330 PCFGMNODE pRoot = CFGMR3GetRoot(pVM); 330 331 PCFGMNODE pHWVirtExt = CFGMR3GetChild(pRoot, "HWVirtExt/"); 331 332 /* Nested paging: disabled by default. */ … … 409 410 STAM_REG(pVM, &pVM->hwaccm.s.StatTPRReplaceSuccess, STAMTYPE_COUNTER, "/HWACCM/TPR/Replace/Success", STAMUNIT_OCCURENCES, "Number of times an instruction was successfully patched."); 410 411 STAM_REG(pVM, &pVM->hwaccm.s.StatTPRReplaceFailure, STAMTYPE_COUNTER, "/HWACCM/TPR/Replace/Failed", STAMUNIT_OCCURENCES, "Number of unsuccessful patch attempts."); 411 412 412 413 /* 413 414 * Statistics. … … 512 513 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatTSCIntercept, "/HWACCM/CPU%d/TSC/Intercept"); 513 514 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatTSCInterceptOverFlow, "/HWACCM/CPU%d/TSC/InterceptOverflow"); 514 515 515 516 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatDRxArmed, "/HWACCM/CPU%d/Debug/Armed"); 516 517 HWACCM_REG_COUNTER(&pVCpu->hwaccm.s.StatDRxContextSwitch, "/HWACCM/CPU%d/Debug/ContextSwitch"); … … 1419 1420 * @returns VBox status code. 1420 1421 * @param pVM The VM handle. 1421 * @param pVCpu The VMCPU for the EMT we're being called on. 1422 * @param pVCpu The VMCPU for the EMT we're being called on. 1422 1423 * @param pvUser Unused 1423 1424 * … … 1560 1561 * @returns VBox status code. 1561 1562 * @param pVM The VM handle. 1562 * @param pVCpu The VMCPU for the EMT we're being called on. 1563 * @param pVCpu The VMCPU for the EMT we're being called on. 1563 1564 * @param pvUser User specified CPU context 1564 1565 * … … 1717 1718 * @returns VBox status code. 1718 1719 * @param pVM The VM handle. 1719 * @param pVCpu The VMCPU for the EMT we're being called on. 1720 * @param pVCpu The VMCPU for the EMT we're being called on. 1720 1721 * @param pvUser User specified CPU context 1721 1722 * … … 2243 2244 uint32_t u32Val = 0; 2244 2245 2245 rc = IOMIOPortRead(pVM, pVCpu->hwaccm.s.PendingIO.s.Port.uPort, 2246 &u32Val, 2246 rc = IOMIOPortRead(pVM, pVCpu->hwaccm.s.PendingIO.s.Port.uPort, 2247 &u32Val, 2247 2248 pVCpu->hwaccm.s.PendingIO.s.Port.cbSize); 2248 2249 if (IOM_SUCCESS(rc)) … … 2256 2257 2257 2258 case HWACCMPENDINGIO_PORT_WRITE: 2258 rc = IOMIOPortWrite(pVM, pVCpu->hwaccm.s.PendingIO.s.Port.uPort, 2259 pCtx->eax & pVCpu->hwaccm.s.PendingIO.s.Port.uAndVal, 2259 rc = IOMIOPortWrite(pVM, pVCpu->hwaccm.s.PendingIO.s.Port.uPort, 2260 pCtx->eax & pVCpu->hwaccm.s.PendingIO.s.Port.uAndVal, 2260 2261 pVCpu->hwaccm.s.PendingIO.s.Port.cbSize); 2261 2262 if (IOM_SUCCESS(rc)) … … 2417 2418 * @param pVM VM Handle. 2418 2419 * @param pSSM SSM operation handle. 2419 * @param u32Version Data layout version. 2420 */ 2421 static DECLCALLBACK(int) hwaccmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 2420 * @param uVersion Data layout version. 2421 * @param uPhase The data phase. 2422 */ 2423 static DECLCALLBACK(int) hwaccmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 2422 2424 { 2423 2425 int rc; 2424 2426 2425 2427 Log(("hwaccmR3Load:\n")); 2428 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 2426 2429 2427 2430 /* 2428 2431 * Validate version. 2429 2432 */ 2430 if ( u 32Version != HWACCM_SSM_VERSION2431 && u 32Version != HWACCM_SSM_VERSION_NO_PATCHING2432 && u 32Version != HWACCM_SSM_VERSION_2_0_X)2433 { 2434 AssertMsgFailed(("hwaccmR3Load: Invalid version u 32Version=%d!\n", u32Version));2433 if ( uVersion != HWACCM_SSM_VERSION 2434 && uVersion != HWACCM_SSM_VERSION_NO_PATCHING 2435 && uVersion != HWACCM_SSM_VERSION_2_0_X) 2436 { 2437 AssertMsgFailed(("hwaccmR3Load: Invalid version uVersion=%d!\n", uVersion)); 2435 2438 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 2436 2439 } 2437 for ( unsigned i=0;i<pVM->cCPUs;i++)2440 for (VMCPUID i = 0; i < pVM->cCPUs; i++) 2438 2441 { 2439 2442 rc = SSMR3GetU32(pSSM, &pVM->aCpus[i].hwaccm.s.Event.fPending); … … 2444 2447 AssertRCReturn(rc, rc); 2445 2448 2446 if (u 32Version >= HWACCM_SSM_VERSION_NO_PATCHING)2449 if (uVersion >= HWACCM_SSM_VERSION_NO_PATCHING) 2447 2450 { 2448 2451 uint32_t val; … … 2462 2465 } 2463 2466 #ifdef VBOX_HWACCM_WITH_GUEST_PATCHING 2464 if (u 32Version > HWACCM_SSM_VERSION_NO_PATCHING)2467 if (uVersion > HWACCM_SSM_VERSION_NO_PATCHING) 2465 2468 { 2466 2469 rc = SSMR3GetGCPtr(pSSM, &pVM->hwaccm.s.pGuestPatchMem); … … 2508 2511 rc = SSMR3GetU32(pSSM, &pPatch->pJumpTarget); 2509 2512 AssertRCReturn(rc, rc); 2510 2513 2511 2514 rc = RTAvloU32Insert(&pVM->hwaccm.s.svm.PatchTree, &pPatch->Core); 2512 2515 AssertRC(rc); -
trunk/src/VBox/VMM/MM.cpp
r19663 r22480 177 177 *******************************************************************************/ 178 178 static DECLCALLBACK(int) mmR3Save(PVM pVM, PSSMHANDLE pSSM); 179 static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);179 static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 180 180 181 181 … … 266 266 */ 267 267 rc = SSMR3RegisterInternal(pVM, "mm", 1, MM_SAVED_STATE_VERSION, sizeof(uint32_t) * 2, 268 NULL, NULL, NULL, 268 269 NULL, mmR3Save, NULL, 269 270 NULL, mmR3Load, NULL); … … 528 529 * @param pVM VM Handle. 529 530 * @param pSSM SSM operation handle. 530 * @param u32Version Data layout version. 531 */ 532 static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 531 * @param uVersion Data layout version. 532 * @param uPhase The data phase. 533 */ 534 static DECLCALLBACK(int) mmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 533 535 { 534 536 LogFlow(("mmR3Load:\n")); 537 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 535 538 536 539 /* 537 540 * Validate version. 538 541 */ 539 if ( SSM_VERSION_MAJOR_CHANGED(u 32Version, MM_SAVED_STATE_VERSION)540 || !u 32Version)541 { 542 AssertMsgFailed(("mmR3Load: Invalid version u 32Version=%d!\n", u32Version));542 if ( SSM_VERSION_MAJOR_CHANGED(uVersion, MM_SAVED_STATE_VERSION) 543 || !uVersion) 544 { 545 AssertMsgFailed(("mmR3Load: Invalid version uVersion=%d!\n", uVersion)); 543 546 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 544 547 } … … 552 555 /* cBasePages (ignored) */ 553 556 uint64_t cPages; 554 if (u 32Version >= 2)557 if (uVersion >= 2) 555 558 rc = SSMR3GetU64(pSSM, &cPages); 556 559 else … … 564 567 /* cbRamBase */ 565 568 uint64_t cb; 566 if (u 32Version != 1)569 if (uVersion != 1) 567 570 rc = SSMR3GetU64(pSSM, &cb); 568 571 else -
trunk/src/VBox/VMM/PATM/CSAM.cpp
r21876 r22480 70 70 *******************************************************************************/ 71 71 static DECLCALLBACK(int) csamr3Save(PVM pVM, PSSMHANDLE pSSM); 72 static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);72 static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 73 73 static DECLCALLBACK(int) CSAMCodePageWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser); 74 74 static DECLCALLBACK(int) CSAMCodePageInvalidate(PVM pVM, RTGCPTR GCPtr); … … 130 130 */ 131 131 rc = SSMR3RegisterInternal(pVM, "CSAM", 0, CSAM_SSM_VERSION, sizeof(pVM->csam.s) + PAGE_SIZE*16, 132 NULL, NULL, NULL, 132 133 NULL, csamr3Save, NULL, 133 134 NULL, csamr3Load, NULL); … … 440 441 * @param pVM VM Handle. 441 442 * @param pSSM SSM operation handle. 442 * @param u32Version Data layout version. 443 */ 444 static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 443 * @param uVersion Data layout version. 444 * @param uPhase The data phase. 445 */ 446 static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 445 447 { 446 448 int rc; 447 449 CSAM csamInfo; 448 450 449 if (u32Version != CSAM_SSM_VERSION) 450 { 451 AssertMsgFailed(("csamR3Load: Invalid version u32Version=%d!\n", u32Version)); 451 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 452 if (uVersion != CSAM_SSM_VERSION) 453 { 454 AssertMsgFailed(("csamR3Load: Invalid version uVersion=%d!\n", uVersion)); 452 455 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 453 456 } -
trunk/src/VBox/VMM/PATM/PATM.cpp
r22147 r22480 177 177 */ 178 178 rc = SSMR3RegisterInternal(pVM, "PATM", 0, PATM_SSM_VERSION, sizeof(pVM->patm.s) + PATCH_MEMORY_SIZE + PAGE_SIZE + PATM_STACK_TOTAL_SIZE + PAGE_SIZE, 179 NULL, patmr3Save, NULL, 180 NULL, patmr3Load, NULL); 181 if (RT_FAILURE(rc)) 182 { 183 AssertRC(rc); 184 return rc; 185 } 179 NULL, NULL, NULL, 180 NULL, patmR3Save, NULL, 181 NULL, patmR3Load, NULL); 182 AssertRCReturn(rc, rc); 186 183 187 184 #ifdef VBOX_WITH_DEBUGGER -
trunk/src/VBox/VMM/PATM/PATMInternal.h
r20374 r22480 524 524 525 525 526 /**527 * Execute state save operation.528 *529 * @returns VBox status code.530 * @param pVM VM Handle.531 * @param pSSM SSM operation handle.532 */533 DECLCALLBACK(int) patmr3Save(PVM pVM, PSSMHANDLE pSSM);534 526 535 527 DECLCALLBACK(int) patmVirtPageHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser); 536 528 537 /** 538 * Execute state load operation. 539 * 540 * @returns VBox status code. 541 * @param pVM VM Handle. 542 * @param pSSM SSM operation handle. 543 * @param u32Version Data layout version. 544 */ 545 DECLCALLBACK(int) patmr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version); 529 DECLCALLBACK(int) patmR3Save(PVM pVM, PSSMHANDLE pSSM); 530 DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 546 531 547 532 #ifdef IN_RING3 -
trunk/src/VBox/VMM/PATM/PATMSSM.cpp
r19144 r22480 153 153 if (*pFixup == pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions)) 154 154 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPU_FF_ACTION; 155 else 155 else 156 156 if (*pFixup == CPUMR3GetGuestCpuIdDefRCPtr(pVM)) 157 157 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_DEFAULT; 158 else 158 else 159 159 if (*pFixup == CPUMR3GetGuestCpuIdStdRCPtr(pVM)) 160 160 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_STANDARD; 161 else 161 else 162 162 if (*pFixup == CPUMR3GetGuestCpuIdExtRCPtr(pVM)) 163 163 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_EXTENDED; 164 else 164 else 165 165 if (*pFixup == CPUMR3GetGuestCpuIdCentaurRCPtr(pVM)) 166 166 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_CENTAUR; … … 236 236 * @param pSSM SSM operation handle. 237 237 */ 238 DECLCALLBACK(int) patm r3Save(PVM pVM, PSSMHANDLE pSSM)238 DECLCALLBACK(int) patmR3Save(PVM pVM, PSSMHANDLE pSSM) 239 239 { 240 240 PATM patmInfo = pVM->patm.s; … … 299 299 * @param pVM VM Handle. 300 300 * @param pSSM SSM operation handle. 301 * @param u32Version Data layout version. 301 * @param uVersion Data layout version. 302 * @param uPhase The data phase. 302 303 */ 303 DECLCALLBACK(int) patm r3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version)304 DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 304 305 { 305 306 PATM patmInfo; 306 307 int rc; 307 308 308 if ( u 32Version != PATM_SSM_VERSION309 && u 32Version != PATM_SSM_VERSION_FIXUP_HACK310 && u 32Version != PATM_SSM_VERSION_VER16309 if ( uVersion != PATM_SSM_VERSION 310 && uVersion != PATM_SSM_VERSION_FIXUP_HACK 311 && uVersion != PATM_SSM_VERSION_VER16 311 312 #ifdef PATM_WITH_NEW_SSM 312 && u 32Version != PATM_SSM_VERSION_GETPUTMEM)313 && uVersion != PATM_SSM_VERSION_GETPUTMEM) 313 314 #else 314 315 ) 315 316 #endif 316 317 { 317 AssertMsgFailed(("patmR3Load: Invalid version u 32Version=%d!\n", u32Version));318 AssertMsgFailed(("patmR3Load: Invalid version uVersion=%d!\n", uVersion)); 318 319 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 319 320 } … … 325 326 */ 326 327 #ifdef PATM_WITH_NEW_SSM 327 if (u 32Version == PATM_SSM_VERSION_GETPUTMEM)328 if (uVersion == PATM_SSM_VERSION_GETPUTMEM) 328 329 { 329 330 #endif … … 478 479 */ 479 480 #ifdef PATM_WITH_NEW_SSM 480 if (u 32Version == PATM_SSM_VERSION_GETPUTMEM)481 if (uVersion == PATM_SSM_VERSION_GETPUTMEM) 481 482 { 482 483 #endif … … 644 645 } 645 646 646 patmCorrectFixup(pVM, u 32Version, patmInfo, &pPatchRec->patch, &rec, offset, pFixup);647 patmCorrectFixup(pVM, uVersion, patmInfo, &pPatchRec->patch, &rec, offset, pFixup); 647 648 } 648 649 … … 719 720 720 721 /* Correct fixups that refer to PATM structures in the hypervisor region (their addresses might have changed). */ 721 patmCorrectFixup(pVM, u 32Version, patmInfo, &pVM->patm.s.pGlobalPatchRec->patch, pRec, offset, pFixup);722 patmCorrectFixup(pVM, uVersion, patmInfo, &pVM->patm.s.pGlobalPatchRec->patch, pRec, offset, pFixup); 722 723 } 723 724 -
trunk/src/VBox/VMM/PDM.cpp
r21144 r22480 288 288 *******************************************************************************/ 289 289 static DECLCALLBACK(int) pdmR3Save(PVM pVM, PSSMHANDLE pSSM); 290 static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);290 static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 291 291 static DECLCALLBACK(int) pdmR3LoadPrep(PVM pVM, PSSMHANDLE pSSM); 292 292 … … 357 357 */ 358 358 rc = SSMR3RegisterInternal(pVM, "pdm", 1, PDM_SAVED_STATE_VERSION, 128, 359 NULL, NULL, NULL, 359 360 NULL, pdmR3Save, NULL, 360 361 pdmR3LoadPrep, pdmR3Load, NULL); … … 717 718 * @param pVM VM Handle. 718 719 * @param pSSM SSM operation handle. 719 * @param u32Version Data layout version. 720 */ 721 static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 720 * @param uVersion Data layout version. 721 * @param uPhase The data phase. 722 */ 723 static DECLCALLBACK(int) pdmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 722 724 { 723 725 int rc; 724 726 725 727 LogFlow(("pdmR3Load:\n")); 728 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 726 729 727 730 /* 728 731 * Validate version. 729 732 */ 730 if ( u 32Version != PDM_SAVED_STATE_VERSION731 && u 32Version != PDM_SAVED_STATE_VERSION_PRE_NMI_FF)732 { 733 AssertMsgFailed(("pdmR3Load: Invalid version u 32Version=%d!\n", u32Version));733 if ( uVersion != PDM_SAVED_STATE_VERSION 734 && uVersion != PDM_SAVED_STATE_VERSION_PRE_NMI_FF) 735 { 736 AssertMsgFailed(("pdmR3Load: Invalid version uVersion=%d!\n", uVersion)); 734 737 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 735 738 } … … 738 741 * Load the interrupt and DMA states. 739 742 */ 740 for ( unsignedidCpu = 0; idCpu < pVM->cCPUs; idCpu++)743 for (VMCPUID idCpu = 0; idCpu < pVM->cCPUs; idCpu++) 741 744 { 742 745 PVMCPU pVCpu = &pVM->aCpus[idCpu]; … … 770 773 VMCPU_FF_SET(pVCpu, VMCPU_FF_INTERRUPT_PIC); 771 774 772 if (u 32Version > PDM_SAVED_STATE_VERSION_PRE_NMI_FF)775 if (uVersion > PDM_SAVED_STATE_VERSION_PRE_NMI_FF) 773 776 { 774 777 /* NMI interrupt */ … … 824 827 uint32_t i = 0; 825 828 PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; 826 for (;; pDevIns = pDevIns->Internal.s.pNextR3, i++)829 for (;; pDevIns = pDevIns->Internal.s.pNextR3, i++) 827 830 { 828 831 /* Get the separator / terminator. */ -
trunk/src/VBox/VMM/PDMDevHlp.cpp
r22277 r22480 399 399 400 400 /** @copydoc PDMDEVHLPR3::pfnSSMRegister */ 401 static DECLCALLBACK(int) pdmR3DevHlp_SSMRegister(PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess, 401 static DECLCALLBACK(int) pdmR3DevHlp_SSMRegister(PPDMDEVINS pDevIns, uint32_t uVersion, size_t cbGuess, const char *pszBefore, 402 PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote, 402 403 PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone, 403 404 PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone) … … 405 406 PDMDEV_ASSERT_DEVINS(pDevIns); 406 407 VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3); 407 LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x u32Version=#x cbGuess=%#x pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n", 408 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, pszName, pszName, u32Instance, u32Version, cbGuess, pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone)); 409 410 int rc = SSMR3RegisterDevice(pDevIns->Internal.s.pVMR3, pDevIns, pszName, u32Instance, u32Version, cbGuess, NULL, 408 LogFlow(("pdmR3DevHlp_SSMRegister: caller='%s'/%d: uVersion=#x cbGuess=%#x pszBefore=%p:{%s}\n" 409 " pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoadDone=%p\n", 410 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, uVersion, cbGuess, pszBefore, pszBefore, 411 pfnLivePrep, pfnLiveExec, pfnLiveVote, 412 pfnSavePrep, pfnSaveExec, pfnSaveDone, 413 pfnLoadPrep, pfnLoadExec, pfnLoadDone)); 414 415 int rc = SSMR3RegisterDevice(pDevIns->Internal.s.pVMR3, pDevIns, pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, 416 uVersion, cbGuess, pszBefore, 417 pfnLivePrep, pfnLiveExec, pfnLiveVote, 411 418 pfnSavePrep, pfnSaveExec, pfnSaveDone, 412 419 pfnLoadPrep, pfnLoadExec, pfnLoadDone); -
trunk/src/VBox/VMM/PDMDriver.cpp
r22277 r22480 278 278 AssertMsgReturn(pDrvReg->u32Version == PDM_DRVREG_VERSION, ("%#x\n", pDrvReg->u32Version), VERR_PDM_UNKNOWN_DRVREG_VERSION); 279 279 AssertReturn(pDrvReg->szDriverName[0], VERR_PDM_INVALID_DRIVER_REGISTRATION); 280 AssertMsgReturn(memchr(pDrvReg->szDriverName, '\0', sizeof(pDrvReg->szDriverName)), 280 AssertMsgReturn(memchr(pDrvReg->szDriverName, '\0', sizeof(pDrvReg->szDriverName)), 281 281 (".*s\n", sizeof(pDrvReg->szDriverName), pDrvReg->szDriverName), 282 282 VERR_PDM_INVALID_DRIVER_REGISTRATION); 283 283 AssertMsgReturn((pDrvReg->fFlags & PDM_DRVREG_FLAGS_HOST_BITS_MASK) == PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT, 284 ("%s: fFlags=%#x\n", pDrvReg->szDriverName, pDrvReg->fFlags), 284 ("%s: fFlags=%#x\n", pDrvReg->szDriverName, pDrvReg->fFlags), 285 285 VERR_PDM_INVALID_DRIVER_HOST_BITS); 286 286 AssertMsgReturn(pDrvReg->cMaxInstances > 0, ("%s: %#x\n", pDrvReg->szDriverName, pDrvReg->cMaxInstances), … … 290 290 AssertMsgReturn(VALID_PTR(pDrvReg->pfnConstruct), ("%s: %p\n", pDrvReg->szDriverName, pDrvReg->pfnConstruct), 291 291 VERR_PDM_INVALID_DRIVER_REGISTRATION); 292 AssertMsgReturn(pDrvReg->pfnSoftReset == NULL, ("%s: %p\n", pDrvReg->szDriverName, pDrvReg->pfnSoftReset), 292 AssertMsgReturn(pDrvReg->pfnSoftReset == NULL, ("%s: %p\n", pDrvReg->szDriverName, pDrvReg->pfnSoftReset), 293 293 VERR_PDM_INVALID_DRIVER_REGISTRATION); 294 AssertMsgReturn(pDrvReg->u32VersionEnd == PDM_DRVREG_VERSION, ("%s: #x\n", pDrvReg->szDriverName, pDrvReg->u32VersionEnd), 294 AssertMsgReturn(pDrvReg->u32VersionEnd == PDM_DRVREG_VERSION, ("%s: #x\n", pDrvReg->szDriverName, pDrvReg->u32VersionEnd), 295 295 VERR_PDM_INVALID_DRIVER_REGISTRATION); 296 296 … … 393 393 * 394 394 * @param pDrvIns Pointer to the driver instance to start with. 395 * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG or 0. 395 * @param fFlags PDM_TACH_FLAGS_NOT_HOT_PLUG or 0. 396 396 */ 397 397 void pdmR3DrvDestroyChain(PPDMDRVINS pDrvIns, uint32_t fFlags) … … 855 855 856 856 /** @copydoc PDMDRVHLP::pfnSSMRegister */ 857 static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess, 857 static DECLCALLBACK(int) pdmR3DrvHlp_SSMRegister(PPDMDRVINS pDrvIns, uint32_t uVersion, size_t cbGuess, 858 PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote, 858 859 PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone, 859 860 PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone) … … 861 862 PDMDRV_ASSERT_DRVINS(pDrvIns); 862 863 VM_ASSERT_EMT(pDrvIns->Internal.s.pVM); 863 LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: pszName=%p:{%s} u32Instance=%#x u32Version=#x cbGuess=%#x pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n", 864 pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, pszName, pszName, u32Instance, u32Version, cbGuess, pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone)); 865 866 int rc = SSMR3RegisterDriver(pDrvIns->Internal.s.pVM, pDrvIns, pszName, u32Instance, u32Version, cbGuess, 864 LogFlow(("pdmR3DrvHlp_SSMRegister: caller='%s'/%d: uVersion=#x cbGuess=%#x \n" 865 " pfnLivePrep=%p pfnLiveExec=%p pfnLiveVote=%p pfnSavePrep=%p pfnSaveExec=%p pfnSaveDone=%p pszLoadPrep=%p pfnLoadExec=%p pfnLoaddone=%p\n", 866 pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, uVersion, cbGuess, 867 pfnLivePrep, pfnLiveExec, pfnLiveVote, 868 pfnSavePrep, pfnSaveExec, pfnSaveDone, pfnLoadPrep, pfnLoadExec, pfnLoadDone)); 869 870 int rc = SSMR3RegisterDriver(pDrvIns->Internal.s.pVM, pDrvIns, pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, 871 uVersion, cbGuess, 872 pfnLivePrep, pfnLiveExec, pfnLiveVote, 867 873 pfnSavePrep, pfnSaveExec, pfnSaveDone, 868 874 pfnLoadPrep, pfnLoadExec, pfnLoadDone); -
trunk/src/VBox/VMM/PGM.cpp
r22327 r22480 634 634 #endif 635 635 static DECLCALLBACK(int) pgmR3Save(PVM pVM, PSSMHANDLE pSSM); 636 static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);636 static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 637 637 static int pgmR3ModeDataInit(PVM pVM, bool fResolveGCAndR0); 638 638 static void pgmR3ModeDataSwitch(PVM pVM, PVMCPU pVCpu, PGMMODE enmShw, PGMMODE enmGst); … … 1283 1283 1284 1284 rc = SSMR3RegisterInternal(pVM, "pgm", 1, PGM_SAVED_STATE_VERSION, (size_t)cbRam + sizeof(PGM), 1285 NULL, NULL, NULL, 1285 1286 NULL, pgmR3Save, NULL, 1286 1287 NULL, pgmR3Load, NULL); … … 2675 2676 * @param pVM The VM handle. 2676 2677 * @param pSSM The SSM handle. 2677 * @param u 32VersionThe saved state version.2678 */ 2679 static int pgmR3LoadLocked(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version)2678 * @param uVersion The saved state version. 2679 */ 2680 static int pgmR3LoadLocked(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion) 2680 2681 { 2681 2682 PPGM pPGM = &pVM->pgm.s; … … 2686 2687 * Load basic data (required / unaffected by relocation). 2687 2688 */ 2688 if (u 32Version >= PGM_SAVED_STATE_VERSION)2689 if (uVersion >= PGM_SAVED_STATE_VERSION) 2689 2690 { 2690 2691 rc = SSMR3GetStruct(pSSM, pPGM, &s_aPGMFields[0]); … … 2697 2698 } 2698 2699 } 2699 else if (u 32Version >= PGM_SAVED_STATE_VERSION_RR_DESC)2700 else if (uVersion >= PGM_SAVED_STATE_VERSION_RR_DESC) 2700 2701 { 2701 2702 AssertRelease(pVM->cCPUs == 1); … … 2835 2836 char szDesc[256]; 2836 2837 szDesc[0] = '\0'; 2837 if (u 32Version >= PGM_SAVED_STATE_VERSION_RR_DESC)2838 if (uVersion >= PGM_SAVED_STATE_VERSION_RR_DESC) 2838 2839 { 2839 2840 rc = SSMR3GetStrZ(pSSM, szDesc, sizeof(szDesc)); … … 2842 2843 /* Since we've modified the description strings in r45878, only compare 2843 2844 them if the saved state is more recent. */ 2844 if (u 32Version != PGM_SAVED_STATE_VERSION_RR_DESC)2845 if (uVersion != PGM_SAVED_STATE_VERSION_RR_DESC) 2845 2846 cchDesc = strlen(szDesc); 2846 2847 } … … 2859 2860 && strcmp(szDesc, pRam->pszDesc)) ) 2860 2861 /* Hack for PDMDevHlpPhysReserve(pDevIns, 0xfff80000, 0x80000, "High ROM Region"); */ 2861 && ( u 32Version != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE2862 && ( uVersion != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE 2862 2863 || GCPhys != UINT32_C(0xfff80000) 2863 2864 || GCPhysLast != UINT32_C(0xffffffff) … … 2884 2885 2885 2886 uint32_t cPages = (GCPhysLast - GCPhys + 1) >> PAGE_SHIFT; 2886 if (u 32Version >= PGM_SAVED_STATE_VERSION_RR_DESC)2887 if (uVersion >= PGM_SAVED_STATE_VERSION_RR_DESC) 2887 2888 { 2888 2889 /* … … 3029 3030 * @param pVM VM Handle. 3030 3031 * @param pSSM SSM operation handle. 3031 * @param u32Version Data layout version. 3032 */ 3033 static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 3032 * @param uVersion Data layout version. 3033 * @param uPhase The data phase. 3034 */ 3035 static DECLCALLBACK(int) pgmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 3034 3036 { 3035 3037 int rc; 3036 3038 PPGM pPGM = &pVM->pgm.s; 3039 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 3037 3040 3038 3041 /* 3039 3042 * Validate version. 3040 3043 */ 3041 if ( u 32Version != PGM_SAVED_STATE_VERSION3042 && u 32Version != PGM_SAVED_STATE_VERSION_2_2_23043 && u 32Version != PGM_SAVED_STATE_VERSION_RR_DESC3044 && u 32Version != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE)3045 { 3046 AssertMsgFailed(("pgmR3Load: Invalid version u 32Version=%d (current %d)!\n", u32Version, PGM_SAVED_STATE_VERSION));3044 if ( uVersion != PGM_SAVED_STATE_VERSION 3045 && uVersion != PGM_SAVED_STATE_VERSION_2_2_2 3046 && uVersion != PGM_SAVED_STATE_VERSION_RR_DESC 3047 && uVersion != PGM_SAVED_STATE_VERSION_OLD_PHYS_CODE) 3048 { 3049 AssertMsgFailed(("pgmR3Load: Invalid version uVersion=%d (current %d)!\n", uVersion, PGM_SAVED_STATE_VERSION)); 3047 3050 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 3048 3051 } … … 3058 3061 */ 3059 3062 pgmLock(pVM); 3060 rc = pgmR3LoadLocked(pVM, pSSM, u 32Version);3063 rc = pgmR3LoadLocked(pVM, pSSM, uVersion); 3061 3064 pgmUnlock(pVM); 3062 3065 if (RT_SUCCESS(rc)) … … 3065 3068 * We require a full resync now. 3066 3069 */ 3067 for ( unsigned i=0;i<pVM->cCPUs;i++)3070 for (VMCPUID i = 0; i < pVM->cCPUs; i++) 3068 3071 { 3069 3072 PVMCPU pVCpu = &pVM->aCpus[i]; … … 3076 3079 pgmR3HandlerPhysicalUpdateAll(pVM); 3077 3080 3078 for ( unsigned i=0;i<pVM->cCPUs;i++)3081 for (VMCPUID i = 0; i < pVM->cCPUs; i++) 3079 3082 { 3080 3083 PVMCPU pVCpu = &pVM->aCpus[i]; -
trunk/src/VBox/VMM/SELM.cpp
r22105 r22480 112 112 *******************************************************************************/ 113 113 static DECLCALLBACK(int) selmR3Save(PVM pVM, PSSMHANDLE pSSM); 114 static DECLCALLBACK(int) selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);114 static DECLCALLBACK(int) selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 115 115 static DECLCALLBACK(int) selmR3LoadDone(PVM pVM, PSSMHANDLE pSSM); 116 116 static DECLCALLBACK(int) selmR3GuestGDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser); … … 199 199 */ 200 200 rc = SSMR3RegisterInternal(pVM, "selm", 1, SELM_SAVED_STATE_VERSION, sizeof(SELM), 201 NULL, NULL, NULL, 201 202 NULL, selmR3Save, NULL, 202 203 NULL, selmR3Load, selmR3LoadDone); … … 695 696 * @param pVM VM Handle. 696 697 * @param pSSM SSM operation handle. 697 * @param u32Version Data layout version. 698 */ 699 static DECLCALLBACK(int) selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 698 * @param uVersion Data layout version. 699 * @param uPhase The data phase. 700 */ 701 static DECLCALLBACK(int) selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 700 702 { 701 703 LogFlow(("selmR3Load:\n")); 704 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 702 705 703 706 /* 704 707 * Validate version. 705 708 */ 706 if (u 32Version != SELM_SAVED_STATE_VERSION)707 { 708 AssertMsgFailed(("selmR3Load: Invalid version u 32Version=%d!\n", u32Version));709 if (uVersion != SELM_SAVED_STATE_VERSION) 710 { 711 AssertMsgFailed(("selmR3Load: Invalid version uVersion=%d!\n", uVersion)); 709 712 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 710 713 } -
trunk/src/VBox/VMM/SSM.cpp
r22255 r22480 163 163 * Defined Constants And Macros * 164 164 *******************************************************************************/ 165 /** The special value for the final phase. */166 #define SSM_PHASE_FINAL UINT32_MAX167 168 165 /** The max length of a unit name. */ 169 166 #define SSM_MAX_NAME_SIZE 48 … … 754 751 *******************************************************************************/ 755 752 static int ssmR3LazyInit(PVM pVM); 753 static DECLCALLBACK(int) ssmR3SelfLiveExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uPhase); 756 754 static DECLCALLBACK(int) ssmR3SelfSaveExec(PVM pVM, PSSMHANDLE pSSM); 757 static DECLCALLBACK(int) ssmR3SelfLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);758 static int ssmR3Register(PVM pVM, const char *pszName, uint32_t u 32Instance, uint32_t u32Version, size_t cbGuess, const char *pszBefore, PSSMUNIT *ppUnit);755 static DECLCALLBACK(int) ssmR3SelfLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 756 static int ssmR3Register(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, const char *pszBefore, PSSMUNIT *ppUnit); 759 757 static int ssmR3StrmWriteBuffers(PSSMSTRM pStrm); 760 758 static int ssmR3StrmReadMore(PSSMSTRM pStrm); 761 759 static int ssmR3CalcChecksum(RTFILE File, uint64_t cbFile, uint32_t *pu32CRC); 762 760 static void ssmR3Progress(PSSMHANDLE pSSM, uint64_t cbAdvance); 763 static PSSMUNIT ssmR3Find(PVM pVM, const char *pszName, uint32_t u 32Instance);761 static PSSMUNIT ssmR3Find(PVM pVM, const char *pszName, uint32_t uInstance); 764 762 static int ssmR3DataWriteFinish(PSSMHANDLE pSSM); 765 763 static void ssmR3DataWriteBegin(PSSMHANDLE pSSM); … … 787 785 */ 788 786 pVM->ssm.s.fInitialized = true; 789 int rc = SSMR3RegisterInternal(pVM, "SSM", 0 /*u32Instance*/, 1/*u32Version*/, 64 /*cbGuess*/, 787 int rc = SSMR3RegisterInternal(pVM, "SSM", 0 /*uInstance*/, 1 /*uVersion*/, 64 /*cbGuess*/, 788 NULL /*pfnLivePrep*/, ssmR3SelfLiveExec, NULL /*pfnLiveVote*/, 790 789 NULL /*pfnSavePrep*/, ssmR3SelfSaveExec, NULL /*pfnSaveDone*/, 791 790 NULL /*pfnSavePrep*/, ssmR3SelfLoadExec, NULL /*pfnSaveDone*/); … … 796 795 797 796 /** 797 * Do ssmR3SelfSaveExec in phase 0. 798 * 799 * @returns VBox status code. 800 * @param pVM Pointer to the shared VM structure. 801 * @param pSSM The SSM handle. 802 * @param uPhase The data phase number. 803 */ 804 static DECLCALLBACK(int) ssmR3SelfLiveExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uPhase) 805 { 806 if (uPhase == 0) 807 return ssmR3SelfSaveExec(pVM, pSSM); 808 return VINF_SUCCESS; 809 } 810 811 812 /** 798 813 * For saving usful things without having to go thru the tedious process of 799 814 * adding it to the header. … … 826 841 * @param pVM Pointer to the shared VM structure. 827 842 * @param pSSM The SSM handle. 828 * @param u32Version The version (1). 829 */ 830 static DECLCALLBACK(int) ssmR3SelfLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 831 { 832 AssertLogRelMsgReturn(u32Version == 1, ("%d", u32Version), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION); 843 * @param uVersion The version (1). 844 * @param uPhase The phase. 845 */ 846 static DECLCALLBACK(int) ssmR3SelfLoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 847 { 848 AssertLogRelMsgReturn(uVersion == 1, ("%d", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION); 833 849 834 850 /* … … 860 876 * @param pVM The VM handle. 861 877 * @param pszName Data unit name. 862 * @param u 32InstanceThe instance id.863 * @param u 32VersionThe data unit version.878 * @param uInstance The instance id. 879 * @param uVersion The data unit version. 864 880 * @param cbGuess The guessed data unit size. 865 881 * @param pszBefore Name of data unit to be placed in front of. … … 868 884 * Caller must fill in the missing details. 869 885 */ 870 static int ssmR3Register(PVM pVM, const char *pszName, uint32_t u 32Instance,871 uint32_t u 32Version, size_t cbGuess, const char *pszBefore, PSSMUNIT *ppUnit)886 static int ssmR3Register(PVM pVM, const char *pszName, uint32_t uInstance, 887 uint32_t uVersion, size_t cbGuess, const char *pszBefore, PSSMUNIT *ppUnit) 872 888 { 873 889 /* … … 901 917 while (pUnit) 902 918 { 903 if ( pUnit->u32Instance == u 32Instance919 if ( pUnit->u32Instance == uInstance 904 920 && pUnit->cchName == cchName 905 921 && !memcmp(pUnit->szName, pszName, cchName)) … … 931 947 * Fill in (some) data. (Stuff is zero'ed.) 932 948 */ 933 pUnit->u32Version = u 32Version;934 pUnit->u32Instance = u 32Instance;949 pUnit->u32Version = uVersion; 950 pUnit->u32Instance = uInstance; 935 951 pUnit->cbGuess = cbGuess; 936 952 pUnit->cchName = cchName; … … 967 983 * @param pDevIns Device instance. 968 984 * @param pszName Data unit name. 969 * @param u 32InstanceThe instance identifier of the data unit.985 * @param uInstance The instance identifier of the data unit. 970 986 * This must together with the name be unique. 971 * @param u 32VersionData layout version number.987 * @param uVersion Data layout version number. 972 988 * @param cbGuess The approximate amount of data in the unit. 973 989 * Only for progress indicators. 974 990 * @param pszBefore Name of data unit which we should be put in front 975 991 * of. Optional (NULL). 992 * 993 * @param pfnLivePrep Prepare live save callback, optional. 994 * @param pfnLiveExec Execute live save callback, optional. 995 * @param pfnLiveVote Vote live save callback, optional. 996 * 976 997 * @param pfnSavePrep Prepare save callback, optional. 977 998 * @param pfnSaveExec Execute save callback, optional. 978 999 * @param pfnSaveDone Done save callback, optional. 1000 * 979 1001 * @param pfnLoadPrep Prepare load callback, optional. 980 1002 * @param pfnLoadExec Execute load callback, optional. 981 1003 * @param pfnLoadDone Done load callback, optional. 982 1004 */ 983 VMMR3DECL(int) SSMR3RegisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess, const char *pszBefore, 1005 VMMR3DECL(int) SSMR3RegisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, const char *pszBefore, 1006 PFNSSMDEVLIVEPREP pfnLivePrep, PFNSSMDEVLIVEEXEC pfnLiveExec, PFNSSMDEVLIVEVOTE pfnLiveVote, 984 1007 PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone, 985 1008 PFNSSMDEVLOADPREP pfnLoadPrep, PFNSSMDEVLOADEXEC pfnLoadExec, PFNSSMDEVLOADDONE pfnLoadDone) 986 1009 { 987 1010 PSSMUNIT pUnit; 988 int rc = ssmR3Register(pVM, pszName, u 32Instance, u32Version, cbGuess, pszBefore, &pUnit);1011 int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, pszBefore, &pUnit); 989 1012 if (RT_SUCCESS(rc)) 990 1013 { 991 1014 pUnit->enmType = SSMUNITTYPE_DEV; 1015 pUnit->u.Dev.pfnLivePrep = pfnLivePrep; 1016 pUnit->u.Dev.pfnLiveExec = pfnLiveExec; 1017 pUnit->u.Dev.pfnLiveVote = pfnLiveVote; 992 1018 pUnit->u.Dev.pfnSavePrep = pfnSavePrep; 993 1019 pUnit->u.Dev.pfnSaveExec = pfnSaveExec; … … 1010 1036 * @param pDrvIns Driver instance. 1011 1037 * @param pszName Data unit name. 1012 * @param u 32InstanceThe instance identifier of the data unit.1038 * @param uInstance The instance identifier of the data unit. 1013 1039 * This must together with the name be unique. 1014 * @param u 32VersionData layout version number.1040 * @param uVersion Data layout version number. 1015 1041 * @param cbGuess The approximate amount of data in the unit. 1016 1042 * Only for progress indicators. 1043 * 1044 * @param pfnLivePrep Prepare live save callback, optional. 1045 * @param pfnLiveExec Execute live save callback, optional. 1046 * @param pfnLiveVote Vote live save callback, optional. 1047 * 1017 1048 * @param pfnSavePrep Prepare save callback, optional. 1018 1049 * @param pfnSaveExec Execute save callback, optional. 1019 1050 * @param pfnSaveDone Done save callback, optional. 1051 * 1020 1052 * @param pfnLoadPrep Prepare load callback, optional. 1021 1053 * @param pfnLoadExec Execute load callback, optional. 1022 1054 * @param pfnLoadDone Done load callback, optional. 1023 1055 */ 1024 VMMR3DECL(int) SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess, 1056 VMMR3DECL(int) SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, 1057 PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote, 1025 1058 PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone, 1026 1059 PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone) 1027 1060 { 1028 1061 PSSMUNIT pUnit; 1029 int rc = ssmR3Register(pVM, pszName, u 32Instance, u32Version, cbGuess, NULL, &pUnit);1062 int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit); 1030 1063 if (RT_SUCCESS(rc)) 1031 1064 { … … 1050 1083 * @param pVM The VM handle. 1051 1084 * @param pszName Data unit name. 1052 * @param u 32InstanceThe instance identifier of the data unit.1085 * @param uInstance The instance identifier of the data unit. 1053 1086 * This must together with the name be unique. 1054 * @param u 32VersionData layout version number.1087 * @param uVersion Data layout version number. 1055 1088 * @param cbGuess The approximate amount of data in the unit. 1056 1089 * Only for progress indicators. 1090 * 1091 * @param pfnLivePrep Prepare live save callback, optional. 1092 * @param pfnLiveExec Execute live save callback, optional. 1093 * @param pfnLiveVote Vote live save callback, optional. 1094 * 1057 1095 * @param pfnSavePrep Prepare save callback, optional. 1058 1096 * @param pfnSaveExec Execute save callback, optional. 1059 1097 * @param pfnSaveDone Done save callback, optional. 1098 * 1060 1099 * @param pfnLoadPrep Prepare load callback, optional. 1061 1100 * @param pfnLoadExec Execute load callback, optional. 1062 1101 * @param pfnLoadDone Done load callback, optional. 1063 1102 */ 1064 VMMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess, 1103 VMMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, 1104 PFNSSMINTLIVEPREP pfnLivePrep, PFNSSMINTLIVEEXEC pfnLiveExec, PFNSSMINTLIVEVOTE pfnLiveVote, 1065 1105 PFNSSMINTSAVEPREP pfnSavePrep, PFNSSMINTSAVEEXEC pfnSaveExec, PFNSSMINTSAVEDONE pfnSaveDone, 1066 1106 PFNSSMINTLOADPREP pfnLoadPrep, PFNSSMINTLOADEXEC pfnLoadExec, PFNSSMINTLOADDONE pfnLoadDone) 1067 1107 { 1068 1108 PSSMUNIT pUnit; 1069 int rc = ssmR3Register(pVM, pszName, u 32Instance, u32Version, cbGuess, NULL, &pUnit);1109 int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit); 1070 1110 if (RT_SUCCESS(rc)) 1071 1111 { 1072 1112 pUnit->enmType = SSMUNITTYPE_INTERNAL; 1113 pUnit->u.Internal.pfnLivePrep = pfnLivePrep; 1114 pUnit->u.Internal.pfnLiveExec = pfnLiveExec; 1115 pUnit->u.Internal.pfnLiveVote = pfnLiveVote; 1073 1116 pUnit->u.Internal.pfnSavePrep = pfnSavePrep; 1074 1117 pUnit->u.Internal.pfnSaveExec = pfnSaveExec; … … 1089 1132 * @param pVM The VM handle. 1090 1133 * @param pszName Data unit name. 1091 * @param u 32InstanceThe instance identifier of the data unit.1134 * @param uInstance The instance identifier of the data unit. 1092 1135 * This must together with the name be unique. 1093 * @param u 32VersionData layout version number.1136 * @param uVersion Data layout version number. 1094 1137 * @param cbGuess The approximate amount of data in the unit. 1095 1138 * Only for progress indicators. 1139 * 1140 * @param pfnLivePrep Prepare live save callback, optional. 1141 * @param pfnLiveExec Execute live save callback, optional. 1142 * @param pfnLiveVote Vote live save callback, optional. 1143 * 1096 1144 * @param pfnSavePrep Prepare save callback, optional. 1097 1145 * @param pfnSaveExec Execute save callback, optional. 1098 1146 * @param pfnSaveDone Done save callback, optional. 1147 * 1099 1148 * @param pfnLoadPrep Prepare load callback, optional. 1100 1149 * @param pfnLoadExec Execute load callback, optional. … … 1102 1151 * @param pvUser User argument. 1103 1152 */ 1104 VMMR3DECL(int) SSMR3RegisterExternal(PVM pVM, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess, 1153 VMMR3DECL(int) SSMR3RegisterExternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess, 1154 PFNSSMEXTLIVEPREP pfnLivePrep, PFNSSMEXTLIVEEXEC pfnLiveExec, PFNSSMEXTLIVEVOTE pfnLiveVote, 1105 1155 PFNSSMEXTSAVEPREP pfnSavePrep, PFNSSMEXTSAVEEXEC pfnSaveExec, PFNSSMEXTSAVEDONE pfnSaveDone, 1106 1156 PFNSSMEXTLOADPREP pfnLoadPrep, PFNSSMEXTLOADEXEC pfnLoadExec, PFNSSMEXTLOADDONE pfnLoadDone, void *pvUser) 1107 1157 { 1108 1158 PSSMUNIT pUnit; 1109 int rc = ssmR3Register(pVM, pszName, u 32Instance, u32Version, cbGuess, NULL, &pUnit);1159 int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit); 1110 1160 if (RT_SUCCESS(rc)) 1111 1161 { 1112 1162 pUnit->enmType = SSMUNITTYPE_EXTERNAL; 1163 pUnit->u.External.pfnLivePrep = pfnLivePrep; 1164 pUnit->u.External.pfnLiveExec = pfnLiveExec; 1165 pUnit->u.External.pfnLiveVote = pfnLiveVote; 1113 1166 pUnit->u.External.pfnSavePrep = pfnSavePrep; 1114 1167 pUnit->u.External.pfnSaveExec = pfnSaveExec; … … 1132 1185 * @param pszName Data unit name. 1133 1186 * Use NULL to deregister all data units for that device instance. 1134 * @param u 32InstanceThe instance identifier of the data unit.1187 * @param uInstance The instance identifier of the data unit. 1135 1188 * This must together with the name be unique. 1136 1189 * @remark Only for dynmaic data units and dynamic unloaded modules. 1137 1190 */ 1138 VMMR3DECL(int) SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t u 32Instance)1191 VMMR3DECL(int) SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance) 1139 1192 { 1140 1193 /* … … 1160 1213 || ( pUnit->cchName == cchName 1161 1214 && !memcmp(pUnit->szName, pszName, cchName))) 1162 && pUnit->u32Instance == u 32Instance1215 && pUnit->u32Instance == uInstance 1163 1216 ) 1164 1217 { … … 1208 1261 * @param pszName Data unit name. 1209 1262 * Use NULL to deregister all data units for that driver instance. 1210 * @param u 32InstanceThe instance identifier of the data unit.1263 * @param uInstance The instance identifier of the data unit. 1211 1264 * This must together with the name be unique. Ignored if pszName is NULL. 1212 1265 * @remark Only for dynmaic data units and dynamic unloaded modules. 1213 1266 */ 1214 VMMR3DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t u 32Instance)1267 VMMR3DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance) 1215 1268 { 1216 1269 /* … … 1236 1289 || ( pUnit->cchName == cchName 1237 1290 && !memcmp(pUnit->szName, pszName, cchName) 1238 && pUnit->u32Instance == u 32Instance))1291 && pUnit->u32Instance == uInstance)) 1239 1292 ) 1240 1293 { … … 3398 3451 * @param pVM VM handle. 3399 3452 * @param pszName Data unit name. 3400 * @param u 32InstanceThe data unit instance id.3401 */ 3402 static PSSMUNIT ssmR3Find(PVM pVM, const char *pszName, uint32_t u 32Instance)3453 * @param uInstance The data unit instance id. 3454 */ 3455 static PSSMUNIT ssmR3Find(PVM pVM, const char *pszName, uint32_t uInstance) 3403 3456 { 3404 3457 size_t cchName = strlen(pszName); 3405 3458 PSSMUNIT pUnit = pVM->ssm.s.pHead; 3406 3459 while ( pUnit 3407 && ( pUnit->u32Instance != u 32Instance3460 && ( pUnit->u32Instance != uInstance 3408 3461 || pUnit->cchName != cchName 3409 3462 || memcmp(pUnit->szName, pszName, cchName))) … … 3498 3551 { 3499 3552 case SSMUNITTYPE_DEV: 3500 rc = pUnit->u.Dev.pfnLoadExec(pUnit->u.Dev.pDevIns, pSSM, UnitHdr.u32Version );3553 rc = pUnit->u.Dev.pfnLoadExec(pUnit->u.Dev.pDevIns, pSSM, UnitHdr.u32Version, SSM_PHASE_FINAL); 3501 3554 break; 3502 3555 case SSMUNITTYPE_DRV: 3503 rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version );3556 rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version, SSM_PHASE_FINAL); 3504 3557 break; 3505 3558 case SSMUNITTYPE_INTERNAL: 3506 rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version );3559 rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version, SSM_PHASE_FINAL); 3507 3560 break; 3508 3561 case SSMUNITTYPE_EXTERNAL: 3509 rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version );3562 rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version, SSM_PHASE_FINAL); 3510 3563 break; 3511 3564 } … … 3677 3730 { 3678 3731 case SSMUNITTYPE_DEV: 3679 rc = pUnit->u.Dev.pfnLoadExec(pUnit->u.Dev.pDevIns, pSSM, UnitHdr.u32Version );3732 rc = pUnit->u.Dev.pfnLoadExec(pUnit->u.Dev.pDevIns, pSSM, UnitHdr.u32Version, UnitHdr.u32Phase); 3680 3733 break; 3681 3734 case SSMUNITTYPE_DRV: 3682 rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version );3735 rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version, UnitHdr.u32Phase); 3683 3736 break; 3684 3737 case SSMUNITTYPE_INTERNAL: 3685 rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version );3738 rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version, UnitHdr.u32Phase); 3686 3739 break; 3687 3740 case SSMUNITTYPE_EXTERNAL: 3688 rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version );3741 rc = pUnit->u.External.pfnLoadExec(pSSM, pUnit->u.External.pvUser, UnitHdr.u32Version, UnitHdr.u32Phase); 3689 3742 break; 3690 3743 } -
trunk/src/VBox/VMM/SSMInternal.h
r21798 r22480 74 74 struct 75 75 { 76 /** Prepare live save. */ 77 PFNSSMDEVLIVEPREP pfnLivePrep; 78 /** Execute live save. */ 79 PFNSSMDEVLIVEEXEC pfnLiveExec; 80 /** Vote live save complete. */ 81 PFNSSMDEVLIVEVOTE pfnLiveVote; 76 82 /** Prepare save. */ 77 83 PFNSSMDEVSAVEPREP pfnSavePrep; … … 93 99 struct 94 100 { 101 /** Prepare live save. */ 102 PFNSSMDRVLIVEPREP pfnLivePrep; 103 /** Execute live save. */ 104 PFNSSMDRVLIVEEXEC pfnLiveExec; 105 /** Vote live save complete. */ 106 PFNSSMDRVLIVEVOTE pfnLiveVote; 95 107 /** Prepare save. */ 96 108 PFNSSMDRVSAVEPREP pfnSavePrep; … … 112 124 struct 113 125 { 126 /** Prepare live save. */ 127 PFNSSMINTLIVEPREP pfnLivePrep; 128 /** Execute live save. */ 129 PFNSSMINTLIVEEXEC pfnLiveExec; 130 /** Vote live save complete. */ 131 PFNSSMINTLIVEVOTE pfnLiveVote; 114 132 /** Prepare save. */ 115 133 PFNSSMINTSAVEPREP pfnSavePrep; … … 129 147 struct 130 148 { 149 /** Prepare live save. */ 150 PFNSSMEXTLIVEPREP pfnLivePrep; 151 /** Execute live save. */ 152 PFNSSMEXTLIVEEXEC pfnLiveExec; 153 /** Vote live save complete. */ 154 PFNSSMEXTLIVEVOTE pfnLiveVote; 131 155 /** Prepare save. */ 132 156 PFNSSMEXTSAVEPREP pfnSavePrep; … … 147 171 struct 148 172 { 173 /** Prepare live save. */ 174 PFNRT pfnLivePrep; 175 /** Execute live save. */ 176 PFNRT pfnLiveExec; 177 /** Vote live save complete. */ 178 PFNRT pfnLiveVote; 149 179 /** Prepare save. */ 150 180 PFNRT pfnSavePrep; … … 178 208 } SSMUNIT; 179 209 210 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.Dev.pfnLivePrep); 211 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.Dev.pfnLiveExec); 212 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.Dev.pfnLiveVote); 180 213 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Dev.pfnSavePrep); 181 214 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Dev.pfnSaveExec); … … 186 219 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey, u.Dev.pDevIns); 187 220 221 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.Drv.pfnLivePrep); 222 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.Drv.pfnLiveExec); 223 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.Drv.pfnLiveVote); 188 224 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Drv.pfnSavePrep); 189 225 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Drv.pfnSaveExec); … … 194 230 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey, u.Drv.pDrvIns); 195 231 232 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.Internal.pfnLivePrep); 233 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.Internal.pfnLiveExec); 234 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.Internal.pfnLiveVote); 196 235 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Internal.pfnSavePrep); 197 236 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Internal.pfnSaveExec); … … 201 240 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadDone, u.Internal.pfnLoadDone); 202 241 242 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.External.pfnLivePrep); 243 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.External.pfnLiveExec); 244 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.External.pfnLiveVote); 203 245 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.External.pfnSavePrep); 204 246 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.External.pfnSaveExec); -
trunk/src/VBox/VMM/TM.cpp
r22242 r22480 162 162 static uint64_t tmR3CalibrateTSC(PVM pVM); 163 163 static DECLCALLBACK(int) tmR3Save(PVM pVM, PSSMHANDLE pSSM); 164 static DECLCALLBACK(int) tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);164 static DECLCALLBACK(int) tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 165 165 static DECLCALLBACK(void) tmR3TimerCallback(PRTTIMER pTimer, void *pvUser, uint64_t iTick); 166 166 static void tmR3TimerQueueRun(PVM pVM, PTMTIMERQUEUE pQueue); … … 526 526 */ 527 527 rc = SSMR3RegisterInternal(pVM, "tm", 1, TM_SAVED_STATE_VERSION, sizeof(uint64_t) * 8, 528 NULL, NULL, NULL, 528 529 NULL, tmR3Save, NULL, 529 530 NULL, tmR3Load, NULL); … … 1088 1089 * @param pVM VM Handle. 1089 1090 * @param pSSM SSM operation handle. 1090 * @param u32Version Data layout version. 1091 */ 1092 static DECLCALLBACK(int) tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 1091 * @param uVersion Data layout version. 1092 * @param uPhase The data phase. 1093 */ 1094 static DECLCALLBACK(int) tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 1093 1095 { 1094 1096 LogFlow(("tmR3Load:\n")); 1095 1097 1098 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 1096 1099 #ifdef VBOX_STRICT 1097 1100 for (VMCPUID i = 0; i < pVM->cCPUs; i++) … … 1107 1110 * Validate version. 1108 1111 */ 1109 if (u 32Version != TM_SAVED_STATE_VERSION)1110 { 1111 AssertMsgFailed(("tmR3Load: Invalid version u 32Version=%d!\n", u32Version));1112 if (uVersion != TM_SAVED_STATE_VERSION) 1113 { 1114 AssertMsgFailed(("tmR3Load: Invalid version uVersion=%d!\n", uVersion)); 1112 1115 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 1113 1116 } -
trunk/src/VBox/VMM/TRPM.cpp
r20841 r22480 439 439 *******************************************************************************/ 440 440 static DECLCALLBACK(int) trpmR3Save(PVM pVM, PSSMHANDLE pSSM); 441 static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);441 static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 442 442 static DECLCALLBACK(int) trpmR3GuestIDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser); 443 443 … … 508 508 */ 509 509 int rc = SSMR3RegisterInternal(pVM, "trpm", 1, TRPM_SAVED_STATE_VERSION, sizeof(TRPM), 510 NULL, NULL, NULL, 510 511 NULL, trpmR3Save, NULL, 511 512 NULL, trpmR3Load, NULL); … … 818 819 * @param pVM VM Handle. 819 820 * @param pSSM SSM operation handle. 820 * @param u32Version Data layout version. 821 */ 822 static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 821 * @param uVersion Data layout version. 822 * @param uPhase The data phase. 823 */ 824 static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 823 825 { 824 826 LogFlow(("trpmR3Load:\n")); 827 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 825 828 826 829 /* 827 830 * Validate version. 828 831 */ 829 if ( u 32Version != TRPM_SAVED_STATE_VERSION830 && u 32Version != TRPM_SAVED_STATE_VERSION_UNI)831 { 832 AssertMsgFailed(("trpmR3Load: Invalid version u 32Version=%d!\n", u32Version));832 if ( uVersion != TRPM_SAVED_STATE_VERSION 833 && uVersion != TRPM_SAVED_STATE_VERSION_UNI) 834 { 835 AssertMsgFailed(("trpmR3Load: Invalid version uVersion=%d!\n", uVersion)); 833 836 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 834 837 } … … 844 847 PTRPM pTrpm = &pVM->trpm.s; 845 848 846 if (u 32Version == TRPM_SAVED_STATE_VERSION)847 { 848 for ( unsigned i=0;i<pVM->cCPUs;i++)849 if (uVersion == TRPM_SAVED_STATE_VERSION) 850 { 851 for (VMCPUID i = 0; i < pVM->cCPUs; i++) 849 852 { 850 853 PTRPMCPU pTrpmCpu = &pVM->aCpus[i].trpm.s; -
trunk/src/VBox/VMM/VMM.cpp
r21963 r22480 110 110 static void vmmR3InitRegisterStats(PVM pVM); 111 111 static DECLCALLBACK(int) vmmR3Save(PVM pVM, PSSMHANDLE pSSM); 112 static DECLCALLBACK(int) vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u 32Version);112 static DECLCALLBACK(int) vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase); 113 113 static DECLCALLBACK(void) vmmR3YieldEMT(PVM pVM, PTMTIMER pTimer, void *pvUser); 114 114 static int vmmR3ServiceCallRing3Request(PVM pVM, PVMCPU pVCpu); … … 169 169 */ 170 170 rc = SSMR3RegisterInternal(pVM, "vmm", 1, VMM_SAVED_STATE_VERSION, VMM_STACK_SIZE + sizeof(RTGCPTR), 171 NULL, NULL, NULL, 171 172 NULL, vmmR3Save, NULL, 172 173 NULL, vmmR3Load, NULL); … … 252 253 253 254 #ifdef VBOX_STRICT_VMM_STACK 254 rc = MMR3HyperAllocOnceNoRelEx(pVM, PAGE_SIZE + VMM_STACK_SIZE + PAGE_SIZE, 255 rc = MMR3HyperAllocOnceNoRelEx(pVM, PAGE_SIZE + VMM_STACK_SIZE + PAGE_SIZE, 255 256 #else 256 rc = MMR3HyperAllocOnceNoRelEx(pVM, VMM_STACK_SIZE, 257 rc = MMR3HyperAllocOnceNoRelEx(pVM, VMM_STACK_SIZE, 257 258 #endif 258 259 PAGE_SIZE, MM_TAG_VMM, fFlags, (void **)&pVCpu->vmm.s.pbEMTStackR3); … … 934 935 * @param pVM VM Handle. 935 936 * @param pSSM SSM operation handle. 936 * @param u32Version Data layout version. 937 */ 938 static DECLCALLBACK(int) vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t u32Version) 937 * @param uVersion Data layout version. 938 * @param uPhase The data phase. 939 */ 940 static DECLCALLBACK(int) vmmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 939 941 { 940 942 LogFlow(("vmmR3Load:\n")); 943 Assert(uPhase == SSM_PHASE_FINAL); NOREF(uPhase); 941 944 942 945 /* 943 946 * Validate version. 944 947 */ 945 if (u 32Version != VMM_SAVED_STATE_VERSION)946 { 947 AssertMsgFailed(("vmmR3Load: Invalid version u 32Version=%d!\n", u32Version));948 if (uVersion != VMM_SAVED_STATE_VERSION) 949 { 950 AssertMsgFailed(("vmmR3Load: Invalid version uVersion=%d!\n", uVersion)); 948 951 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 949 952 } -
trunk/src/VBox/VMM/testcase/tstSSM.cpp
r22025 r22480 186 186 * @param pDevIns Device instance of the device which registered the data unit. 187 187 * @param pSSM SSM operation handle. 188 */ 189 DECLCALLBACK(int) Item01Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version) 190 { 191 if (u32Version != 0) 192 { 193 RTPrintf("Item01: u32Version=%#x, expected 0\n", u32Version); 188 * @param uVersion The data layout version. 189 * @param uPhase The data phase. 190 */ 191 DECLCALLBACK(int) Item01Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 192 { 193 if (uVersion != 0) 194 { 195 RTPrintf("Item01: uVersion=%#x, expected 0\n", uVersion); 194 196 return VERR_GENERAL_FAILURE; 195 197 } … … 340 342 * @param pDevIns Device instance of the device which registered the data unit. 341 343 * @param pSSM SSM operation handle. 342 */ 343 DECLCALLBACK(int) Item02Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version) 344 { 345 if (u32Version != 0) 346 { 347 RTPrintf("Item02: u32Version=%#x, expected 0\n", u32Version); 344 * @param uVersion The data layout version. 345 * @param uPhase The data phase. 346 */ 347 DECLCALLBACK(int) Item02Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 348 { 349 if (uVersion != 0) 350 { 351 RTPrintf("Item02: uVersion=%#x, expected 0\n", uVersion); 348 352 return VERR_GENERAL_FAILURE; 349 353 } … … 452 456 * @param pDevIns Device instance of the device which registered the data unit. 453 457 * @param pSSM SSM operation handle. 454 */ 455 DECLCALLBACK(int) Item03Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version) 456 { 457 if (u32Version != 123) 458 { 459 RTPrintf("Item03: u32Version=%#x, expected 123\n", u32Version); 458 * @param uVersion The data layout version. 459 * @param uPhase The data phase. 460 */ 461 DECLCALLBACK(int) Item03Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 462 { 463 if (uVersion != 123) 464 { 465 RTPrintf("Item03: uVersion=%#x, expected 123\n", uVersion); 460 466 return VERR_GENERAL_FAILURE; 461 467 } … … 556 562 * @param pDevIns Device instance of the device which registered the data unit. 557 563 * @param pSSM SSM operation handle. 558 */ 559 DECLCALLBACK(int) Item04Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version) 560 { 561 if (u32Version != 42) 562 { 563 RTPrintf("Item04: u32Version=%#x, expected 42\n", u32Version); 564 * @param uVersion The data layout version. 565 * @param uPhase The data phase. 566 */ 567 DECLCALLBACK(int) Item04Load(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPhase) 568 { 569 if (uVersion != 42) 570 { 571 RTPrintf("Item04: uVersion=%#x, expected 42\n", uVersion); 564 572 return VERR_GENERAL_FAILURE; 565 573 } … … 698 706 */ 699 707 rc = SSMR3RegisterDevice(pVM, NULL, "SSM Testcase Data Item no.1 (all types)", 1, 0, 256, NULL, 700 NULL, Item01Save, NULL, 701 NULL, Item01Load, NULL); 708 NULL, NULL, NULL, 709 NULL, Item01Save, NULL, 710 NULL, Item01Load, NULL); 702 711 if (RT_FAILURE(rc)) 703 712 { … … 707 716 708 717 rc = SSMR3RegisterDevice(pVM, NULL, "SSM Testcase Data Item no.2 (rand mem)", 2, 0, _1M * 8, NULL, 709 NULL, Item02Save, NULL, 710 NULL, Item02Load, NULL); 718 NULL, NULL, NULL, 719 NULL, Item02Save, NULL, 720 NULL, Item02Load, NULL); 711 721 if (RT_FAILURE(rc)) 712 722 { … … 716 726 717 727 rc = SSMR3RegisterDevice(pVM, NULL, "SSM Testcase Data Item no.3 (big mem)", 0, 123, 512*_1M, NULL, 718 NULL, Item03Save, NULL, 719 NULL, Item03Load, NULL); 728 NULL, NULL, NULL, 729 NULL, Item03Save, NULL, 730 NULL, Item03Load, NULL); 720 731 if (RT_FAILURE(rc)) 721 732 { … … 725 736 726 737 rc = SSMR3RegisterDevice(pVM, NULL, "SSM Testcase Data Item no.4 (big zero mem)", 0, 42, 512*_1M, NULL, 727 NULL, Item04Save, NULL, 728 NULL, Item04Load, NULL); 738 NULL, NULL, NULL, 739 NULL, Item04Save, NULL, 740 NULL, Item04Load, NULL); 729 741 if (RT_FAILURE(rc)) 730 742 { … … 831 843 return 1; 832 844 } 833 uint32_t u 32Version = 0xbadc0ded;834 rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 2, &u 32Version);845 uint32_t uVersion = 0xbadc0ded; 846 rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.2 (rand mem)", 2, &uVersion); 835 847 if (RT_FAILURE(rc)) 836 848 { … … 839 851 } 840 852 u64Start = RTTimeNanoTS(); 841 rc = Item02Load(NULL, pSSM, u 32Version);853 rc = Item02Load(NULL, pSSM, uVersion, SSM_PHASE_FINAL); 842 854 if (RT_FAILURE(rc)) 843 855 { … … 849 861 850 862 /* 1st unit */ 851 u 32Version = 0xbadc0ded;852 rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.1 (all types)", 1, &u 32Version);863 uVersion = 0xbadc0ded; 864 rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.1 (all types)", 1, &uVersion); 853 865 if (RT_FAILURE(rc)) 854 866 { … … 857 869 } 858 870 u64Start = RTTimeNanoTS(); 859 rc = Item01Load(NULL, pSSM, u 32Version);871 rc = Item01Load(NULL, pSSM, uVersion, SSM_PHASE_FINAL); 860 872 if (RT_FAILURE(rc)) 861 873 { … … 867 879 868 880 /* 3st unit */ 869 u 32Version = 0xbadc0ded;870 rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.3 (big mem)", 0, &u 32Version);881 uVersion = 0xbadc0ded; 882 rc = SSMR3Seek(pSSM, "SSM Testcase Data Item no.3 (big mem)", 0, &uVersion); 871 883 if (RT_FAILURE(rc)) 872 884 { … … 875 887 } 876 888 u64Start = RTTimeNanoTS(); 877 rc = Item03Load(NULL, pSSM, u 32Version);889 rc = Item03Load(NULL, pSSM, uVersion, SSM_PHASE_FINAL); 878 890 if (RT_FAILURE(rc)) 879 891 {
Note:
See TracChangeset
for help on using the changeset viewer.