- Timestamp:
- Mar 13, 2015 9:35:30 PM (10 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PATM.cpp
r54746 r54761 763 763 { 764 764 case FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL: 765 Assert(pRec->pDest == pRec->pSource); 765 Assert(pRec->pDest == pRec->pSource); Assert(PATM_IS_FIXUP_TYPE(pRec->pSource)); 766 766 Log(("Absolute patch template fixup type %#x at %RHv -> %RHv at %RRv\n", pRec->pSource, *(RTRCUINTPTR *)pRec->pRelocPos, *(RTRCINTPTR*)pRec->pRelocPos + delta, pRec->pRelocPos)); 767 767 *(RTRCUINTPTR *)pRec->pRelocPos += delta; … … 916 916 break; 917 917 } 918 919 case FIXUP_CONSTANT_IN_PATCH_ASM_TMPL: 920 /* Only applicable when loading state. */ 921 Assert(pRec->pDest == pRec->pSource); 922 Assert(PATM_IS_FIXUP_TYPE(pRec->pSource)); 923 break; 918 924 919 925 default: -
trunk/src/VBox/VMM/VMMR3/PATMPatch.cpp
r54746 r54761 177 177 * A SAVED STATE WITH A DIFFERENT HYPERVISOR LAYOUT. 178 178 */ 179 uint32_t uRelocType = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL; 179 180 switch (pAsmRecord->aRelocs[i].uType) 180 181 { … … 353 354 /* 354 355 * The following fixups needs to be recalculated when loading saved state 355 * Note! Earlier saved state versions had different hacks for detecting these.356 * Note! Earlier saved state versions had different hacks for detecting some of these. 356 357 */ 357 358 case PATM_VM_FORCEDACTIONS: … … 367 368 dest = CPUMR3GetGuestCpuIdPatmArrayEndRCPtr(pVM); 368 369 break; 370 371 case PATM_CPUID_STD_PTR: /* saved state only */ 372 dest = CPUMR3GetGuestCpuIdPatmStdRCPtr(pVM); 373 break; 374 case PATM_CPUID_EXT_PTR: /* saved state only */ 375 dest = CPUMR3GetGuestCpuIdPatmExtRCPtr(pVM); 376 break; 377 case PATM_CPUID_CENTAUR_PTR: /* saved state only */ 378 dest = CPUMR3GetGuestCpuIdPatmCentaurRCPtr(pVM); 379 break; 380 381 /* 382 * The following fixups are constants that needs to be corrected when 383 * loading saved state as these may change between VBox versions. 384 */ 369 385 case PATM_CPUID_ARRAY_ENTRY_SIZE: 370 386 dest = sizeof(CPUMCPUIDLEAF); 387 uRelocType = FIXUP_CONSTANT_IN_PATCH_ASM_TMPL; 371 388 break; 372 389 case PATM_CPUID_UNKNOWN_METHOD: 373 390 dest = CPUMR3GetGuestCpuIdPatmUnknownLeafMethod(pVM); 374 break; 375 376 case PATM_CPUID_STD_PTR: /* saved state only */ 377 dest = CPUMR3GetGuestCpuIdPatmStdRCPtr(pVM); 378 break; 379 case PATM_CPUID_EXT_PTR: /* saved state only */ 380 dest = CPUMR3GetGuestCpuIdPatmExtRCPtr(pVM); 381 break; 382 case PATM_CPUID_CENTAUR_PTR: /* saved state only */ 383 dest = CPUMR3GetGuestCpuIdPatmCentaurRCPtr(pVM); 384 break; 385 391 uRelocType = FIXUP_CONSTANT_IN_PATCH_ASM_TMPL; 392 break; 393 394 /* 395 * Unknown fixup. 396 */ 386 397 default: 398 AssertReleaseMsgFailed(("Unknown fixup: %#x\n", pAsmRecord->aRelocs[i].uType)); 387 399 dest = PATM_ILLEGAL_DESTINATION; 388 AssertReleaseFailed();389 400 break; 390 401 } … … 393 404 if (pAsmRecord->aRelocs[i].uType < PATM_NO_FIXUP) 394 405 { 395 patmPatchAddReloc32(pVM, pPatch, &pPB[j], FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL,406 patmPatchAddReloc32(pVM, pPatch, &pPB[j], uRelocType, 396 407 pAsmRecord->aRelocs[i].uType /*pSources*/, pAsmRecord->aRelocs[i].uType /*pDest*/); 397 408 } -
trunk/src/VBox/VMM/VMMR3/PATMSSM.cpp
r54737 r54761 142 142 * Internal Functions * 143 143 *******************************************************************************/ 144 static void patmCorrectFixup(PVM pVM, unsigned ulSSMVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec, int32_t offset, RTRCPTR *pFixup); 144 static int patmCorrectFixup(PVM pVM, unsigned ulSSMVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec, 145 int32_t offset, RTRCPTR *pFixup); 146 145 147 146 148 /******************************************************************************* … … 981 983 } 982 984 983 patmCorrectFixup(pVM, uVersion, patmInfo, &pPatchRec->patch, &rec, offset, pFixup); 985 rc = patmCorrectFixup(pVM, uVersion, patmInfo, &pPatchRec->patch, &rec, offset, pFixup); 986 AssertRCReturn(rc, rc); 984 987 } 985 988 … … 1067 1070 1068 1071 /* Correct fixups that refer to PATM structures in the hypervisor region (their addresses might have changed). */ 1069 patmCorrectFixup(pVM, uVersion, patmInfo, &pVM->patm.s.pGlobalPatchRec->patch, pRec, offset, pFixup); 1072 rc = patmCorrectFixup(pVM, uVersion, patmInfo, &pVM->patm.s.pGlobalPatchRec->patch, pRec, offset, pFixup); 1073 AssertRCReturn(rc, rc); 1070 1074 } 1071 1075 … … 1095 1099 * @param pFixup Fixup address 1096 1100 */ 1097 static voidpatmCorrectFixup(PVM pVM, unsigned uVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec,1098 1101 static int patmCorrectFixup(PVM pVM, unsigned uVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec, 1102 int32_t offset, RTRCPTR *pFixup) 1099 1103 { 1100 1104 int32_t delta = pVM->patm.s.pPatchMemGC - patmInfo.pPatchMemGC; … … 1363 1367 *pFixup = CPUMR3GetGuestCpuIdPatmArrayEndRCPtr(pVM); 1364 1368 break; 1365 case PATM_CPUID_ARRAY_ENTRY_SIZE:1366 *pFixup = sizeof(CPUMCPUIDLEAF);1367 break;1368 case PATM_CPUID_UNKNOWN_METHOD:1369 *pFixup = CPUMR3GetGuestCpuIdPatmUnknownLeafMethod(pVM);1370 break;1371 1369 case PATM_CPUID_STD_PTR: /* Saved again patches only. */ 1372 1370 *pFixup = CPUMR3GetGuestCpuIdPatmStdRCPtr(pVM); … … 1378 1376 *pFixup = CPUMR3GetGuestCpuIdPatmCentaurRCPtr(pVM); 1379 1377 break; 1378 } 1379 } 1380 /* 1381 * Constant that may change between VM version needs fixing up. 1382 */ 1383 else if (pRec->uType == FIXUP_CONSTANT_IN_PATCH_ASM_TMPL) 1384 { 1385 AssertLogRelReturn(uVersion > PATM_SAVED_STATE_VERSION_NO_RAW_MEM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED); 1386 Assert(pRec->pSource == pRec->pDest); Assert(PATM_IS_FIXUP_TYPE(pRec->pSource)); 1387 switch (pRec->pSource) 1388 { 1389 case PATM_CPUID_ARRAY_ENTRY_SIZE: 1390 *pFixup = sizeof(CPUMCPUIDLEAF); 1391 break; 1392 case PATM_CPUID_UNKNOWN_METHOD: 1393 *pFixup = CPUMR3GetGuestCpuIdPatmUnknownLeafMethod(pVM); 1394 break; 1395 default: 1396 AssertLogRelMsgFailed(("Unknown FIXUP_CONSTANT_IN_PATCH_ASM_TMPL fixup: %#x\n", pRec->pSource)); 1397 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 1380 1398 } 1381 1399 } … … 1480 1498 } 1481 1499 } 1500 return VINF_SUCCESS; 1482 1501 } 1483 1502 -
trunk/src/VBox/VMM/include/PATMInternal.h
r54714 r54761 114 114 * as FIXUP_ABSOLUTE. */ 115 115 #define FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL 3 116 /** Constant value that only needs fixing up when loading state. Structure 117 * size, member offset, or similar. The source and destination address are set 118 * like for FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL. */ 119 #define FIXUP_CONSTANT_IN_PATCH_ASM_TMPL 4 116 120 /** @} */ 117 121
Note:
See TracChangeset
for help on using the changeset viewer.