Changeset 21709 in vbox
- Timestamp:
- Jul 17, 2009 4:07:35 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r21708 r21709 1382 1382 1383 1383 /* Clear all patch information. */ 1384 pVM->hwaccm.s.pGuestPatchMem = 0; 1385 pVM->hwaccm.s.pFreeGuestPatchMem = 0; 1386 pVM->hwaccm.s.cbGuestPatchMem = 0; 1387 pVM->hwaccm.s.svm.cPatches = 0; 1388 pVM->hwaccm.s.svm.PatchTree = 0; 1384 pVM->hwaccm.s.pGuestPatchMem = 0; 1385 pVM->hwaccm.s.pFreeGuestPatchMem = 0; 1386 pVM->hwaccm.s.cbGuestPatchMem = 0; 1387 pVM->hwaccm.s.svm.cPatches = 0; 1388 pVM->hwaccm.s.svm.PatchTree = 0; 1389 pVM->hwaccm.s.svm.fTPRPatchingActive = false; 1389 1390 ASMMemZero32(pVM->hwaccm.s.svm.aPatches, sizeof(pVM->hwaccm.s.svm.aPatches)); 1390 1391 } … … 1443 1444 pVM->hwaccm.s.svm.PatchTree = 0; 1444 1445 pVM->hwaccm.s.pFreeGuestPatchMem = pVM->hwaccm.s.pGuestPatchMem; 1446 pVM->hwaccm.s.svm.fTPRPatchingActive = false; 1445 1447 return VINF_SUCCESS; 1446 1448 } … … 1494 1496 pVM->hwaccm.s.pFreeGuestPatchMem = 0; 1495 1497 pVM->hwaccm.s.cbGuestPatchMem = 0; 1498 pVM->hwaccm.s.svm.fTPRPatchingActive = false; 1496 1499 return VINF_SUCCESS; 1497 1500 } … … 1883 1886 1884 1887 pVM->hwaccm.s.svm.cPatches++; 1888 pVM->hwaccm.s.svm.fTPRPatchingActive = true; 1885 1889 return VINF_SUCCESS; 1886 1890 } -
trunk/src/VBox/VMM/HWACCMInternal.h
r21652 r21709 406 406 /** Set if erratum 170 affects the AMD cpu. */ 407 407 bool fAlwaysFlushTLB; 408 /** Explicit alignment padding to make 32-bit gcc align u64RegisterMask 409 * naturally. */ 410 bool padding[1]; 408 /** Set when TPR patching is active. */ 409 bool fTPRPatchingActive; 411 410 412 411 /** R0 memory object for the IO bitmap (12kb). */ -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r21696 r21709 1076 1076 int rc = PDMApicGetTPR(pVCpu, &u8LastTPR, &fPending); 1077 1077 AssertRC(rc); 1078 pVMCB->ctrl.IntCtrl.n.u8VTPR = (u8LastTPR >> 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */ 1079 1080 if (fPending) 1081 { 1082 /* A TPR change could activate a pending interrupt, so catch cr8 writes. */ 1083 pVMCB->ctrl.u16InterceptWrCRx |= RT_BIT(8); 1078 1079 if (pVM->hwaccm.s.svm.fTPRPatchingActive) 1080 { 1081 /* Our patch code uses LSTAR for TPR caching. */ 1082 pCtx->msrLSTAR = u8LastTPR; 1084 1083 } 1085 1084 else 1086 /* No interrupts are pending, so we don't need to be explicitely notified. 1087 * There are enough world switches for detecting pending interrupts. 1088 */ 1089 pVMCB->ctrl.u16InterceptWrCRx &= ~RT_BIT(8); 1090 1085 { 1086 pVMCB->ctrl.IntCtrl.n.u8VTPR = (u8LastTPR >> 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */ 1087 1088 if (fPending) 1089 { 1090 /* A TPR change could activate a pending interrupt, so catch cr8 writes. */ 1091 pVMCB->ctrl.u16InterceptWrCRx |= RT_BIT(8); 1092 } 1093 else 1094 /* No interrupts are pending, so we don't need to be explicitely notified. 1095 * There are enough world switches for detecting pending interrupts. 1096 */ 1097 pVMCB->ctrl.u16InterceptWrCRx &= ~RT_BIT(8); 1098 } 1091 1099 fSyncTPR = !fPending; 1092 1100 } … … 1473 1481 /* Sync back the TPR if it was changed. */ 1474 1482 if ( fSyncTPR 1475 && (u8LastTPR >> 4) != pVMCB->ctrl.IntCtrl.n.u8VTPR) 1476 { 1477 rc = PDMApicSetTPR(pVCpu, pVMCB->ctrl.IntCtrl.n.u8VTPR << 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */ 1483 && pVM->hwaccm.s.svm.fTPRPatchingActive 1484 && (pCtx->msrLSTAR & 0xff) != u8LastTPR) 1485 { 1486 /* Our patch code uses LSTAR for TPR caching. */ 1487 rc = PDMApicSetTPR(pVCpu, pCtx->msrLSTAR & 0xff); 1478 1488 AssertRC(rc); 1489 } 1490 else 1491 { 1492 if ( fSyncTPR 1493 && (u8LastTPR >> 4) != pVMCB->ctrl.IntCtrl.n.u8VTPR) 1494 { 1495 rc = PDMApicSetTPR(pVCpu, pVMCB->ctrl.IntCtrl.n.u8VTPR << 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */ 1496 AssertRC(rc); 1497 } 1479 1498 } 1480 1499
Note:
See TracChangeset
for help on using the changeset viewer.