Changeset 48237 in vbox for trunk/src/VBox
- Timestamp:
- Sep 2, 2013 9:26:02 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r48230 r48237 1265 1265 * @param pVM Pointer to the VM. 1266 1266 * @param pVCpu Pointer to the VMCPU. 1267 * @param pCpu Pointer to the global HM struct. 1267 1268 * 1268 1269 * @remarks Called with interrupts disabled. 1269 1270 */ 1270 static void hmR0VmxFlushTaggedTlbNone(PVM pVM, PVMCPU pVCpu) 1271 { 1271 static void hmR0VmxFlushTaggedTlbNone(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu) 1272 { 1273 AssertPtr(pVCpu); 1274 AssertPtr(pCpu); 1272 1275 NOREF(pVM); 1273 AssertPtr(pVCpu); 1276 1274 1277 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TLB_FLUSH); 1275 1278 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TLB_SHOOTDOWN); 1276 1277 PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();1278 AssertPtr(pCpu);1279 1279 1280 1280 pVCpu->hm.s.TlbShootdown.cPages = 0; … … 1291 1291 * @param pVM Pointer to the VM. 1292 1292 * @param pVCpu Pointer to the VMCPU. 1293 * @param pCpu Pointer to the global HM CPU struct. 1293 1294 * @remarks All references to "ASID" in this function pertains to "VPID" in 1294 1295 * Intel's nomenclature. The reason is, to avoid confusion in compare … … 1297 1298 * @remarks Called with interrupts disabled. 1298 1299 */ 1299 static void hmR0VmxFlushTaggedTlbBoth(PVM pVM, PVMCPU pVCpu )1300 static void hmR0VmxFlushTaggedTlbBoth(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu) 1300 1301 { 1301 1302 #ifdef VBOX_WITH_STATISTICS … … 1312 1313 1313 1314 AssertPtr(pVM); 1315 AssertPtr(pCpu); 1314 1316 AssertPtr(pVCpu); 1315 1317 AssertMsg(pVM->hm.s.fNestedPaging && pVM->hm.s.vmx.fVpid, … … 1317 1319 "fNestedPaging=%RTbool fVpid=%RTbool", pVM->hm.s.fNestedPaging, pVM->hm.s.vmx.fVpid)); 1318 1320 1319 PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();1320 AssertPtr(pCpu);1321 1321 1322 1322 /* … … 1416 1416 * @param pVM Pointer to the VM. 1417 1417 * @param pVCpu Pointer to the VMCPU. 1418 * @param pCpu Pointer to the global HM CPU struct. 1418 1419 * 1419 1420 * @remarks Called with interrupts disabled. 1420 1421 */ 1421 static void hmR0VmxFlushTaggedTlbEpt(PVM pVM, PVMCPU pVCpu )1422 static void hmR0VmxFlushTaggedTlbEpt(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu) 1422 1423 { 1423 1424 AssertPtr(pVM); 1424 1425 AssertPtr(pVCpu); 1426 AssertPtr(pCpu); 1425 1427 AssertMsg(pVM->hm.s.fNestedPaging, ("hmR0VmxFlushTaggedTlbEpt cannot be invoked with NestedPaging disabled.")); 1426 1428 AssertMsg(!pVM->hm.s.vmx.fVpid, ("hmR0VmxFlushTaggedTlbEpt cannot be invoked with VPID enabled.")); 1427 1428 PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();1429 AssertPtr(pCpu);1430 1429 1431 1430 /* … … 1481 1480 * @param pVM Pointer to the VM. 1482 1481 * @param pVCpu Pointer to the VMCPU. 1482 * @param pCpu Pointer to the global HM CPU struct. 1483 1483 * 1484 1484 * @remarks Called with interrupts disabled. 1485 1485 */ 1486 static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu )1486 static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu) 1487 1487 { 1488 1488 AssertPtr(pVM); 1489 1489 AssertPtr(pVCpu); 1490 AssertPtr(pCpu); 1490 1491 AssertMsg(pVM->hm.s.vmx.fVpid, ("hmR0VmxFlushTlbVpid cannot be invoked with VPID disabled.")); 1491 1492 AssertMsg(!pVM->hm.s.fNestedPaging, ("hmR0VmxFlushTlbVpid cannot be invoked with NestedPaging enabled")); 1492 1493 PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();1494 1493 1495 1494 /* … … 1577 1576 * Flushes the guest TLB entry based on CPU capabilities. 1578 1577 * 1579 * @param pVCpu Pointer to the VMCPU. 1580 */ 1581 DECLINLINE(void) hmR0VmxFlushTaggedTlb(PVMCPU pVCpu) 1578 * @param pVCpu Pointer to the VMCPU. 1579 * @param pCpu Pointer to the global HM CPU struct. 1580 */ 1581 DECLINLINE(void) hmR0VmxFlushTaggedTlb(PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu) 1582 1582 { 1583 1583 PVM pVM = pVCpu->CTX_SUFF(pVM); 1584 1584 switch (pVM->hm.s.vmx.uFlushTaggedTlb) 1585 1585 { 1586 case HMVMX_FLUSH_TAGGED_TLB_EPT_VPID: hmR0VmxFlushTaggedTlbBoth(pVM, pVCpu ); break;1587 case HMVMX_FLUSH_TAGGED_TLB_EPT: hmR0VmxFlushTaggedTlbEpt(pVM, pVCpu ); break;1588 case HMVMX_FLUSH_TAGGED_TLB_VPID: hmR0VmxFlushTaggedTlbVpid(pVM, pVCpu ); break;1589 case HMVMX_FLUSH_TAGGED_TLB_NONE: hmR0VmxFlushTaggedTlbNone(pVM, pVCpu ); break;1586 case HMVMX_FLUSH_TAGGED_TLB_EPT_VPID: hmR0VmxFlushTaggedTlbBoth(pVM, pVCpu, pCpu); break; 1587 case HMVMX_FLUSH_TAGGED_TLB_EPT: hmR0VmxFlushTaggedTlbEpt(pVM, pVCpu, pCpu); break; 1588 case HMVMX_FLUSH_TAGGED_TLB_VPID: hmR0VmxFlushTaggedTlbVpid(pVM, pVCpu, pCpu); break; 1589 case HMVMX_FLUSH_TAGGED_TLB_NONE: hmR0VmxFlushTaggedTlbNone(pVM, pVCpu, pCpu); break; 1590 1590 default: 1591 1591 AssertMsgFailed(("Invalid flush-tag function identifier\n")); … … 4466 4466 DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu) 4467 4467 { 4468 uint32_t aParam[6];4468 uint32_t aParam[6]; 4469 4469 PHMGLOBALCPUINFO pCpu = NULL; 4470 RTHCPHYS HCPhysCpuPage = 0;4471 int rc = VERR_INTERNAL_ERROR_5;4470 RTHCPHYS HCPhysCpuPage = 0; 4471 int rc = VERR_INTERNAL_ERROR_5; 4472 4472 4473 4473 pCpu = HMR0GetCurrentCpu(); … … 4852 4852 /* We can't use TSC-offsetting (non-fixed TSC, warp drive active etc.), VM-exit on RDTSC(P). */ 4853 4853 pVCpu->hm.s.vmx.u32ProcCtls |= VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT; 4854 rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls); 4854 rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls); AssertRC(rc); 4855 4855 STAM_COUNTER_INC(&pVCpu->hm.s.StatTscIntercept); 4856 4856 } … … 4951 4951 { 4952 4952 int rc = hmR0VmxReadIdtVectoringInfoVmcs(pVmxTransient); 4953 AssertRC (rc);4953 AssertRCReturn(rc, rc); 4954 4954 if (VMX_IDT_VECTORING_INFO_VALID(pVmxTransient->uIdtVectoringInfo)) 4955 4955 { … … 5417 5417 case MSR_K8_TSC_AUX: CPUMSetGuestMsr(pVCpu, MSR_K8_TSC_AUX, pMsr->u64Value); break; 5418 5418 case MSR_K8_KERNEL_GS_BASE: pMixedCtx->msrKERNELGSBASE = pMsr->u64Value; break; 5419 case MSR_K6_EFER: /* EFER can't be changed without causing a VM-exit. */break;5419 case MSR_K6_EFER: /* EFER can't be changed without causing a VM-exit. */ break; 5420 5420 default: 5421 5421 { … … 5793 5793 return VINF_SUCCESS; 5794 5794 5795 /* Though we can longjmp to ring-3 due to log-flushes here and get recalled again on the ring-3 callback path,5796 there is no real need to. */5795 /* Though we can longjmp to ring-3 due to log-flushes here and get recalled 5796 again on the ring-3 callback path, there is no real need to. */ 5797 5797 if (VMMRZCallRing3IsEnabled(pVCpu)) 5798 5798 VMMR0LogFlushDisable(pVCpu); … … 5898 5898 if (VMCPU_FF_IS_PENDING(pVCpu,VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL)) 5899 5899 { 5900 int rc2 = PGMSyncCR3(pVCpu, pMixedCtx->cr0, pMixedCtx->cr3, pMixedCtx->cr4, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 5900 int rc2 = PGMSyncCR3(pVCpu, pMixedCtx->cr0, pMixedCtx->cr3, pMixedCtx->cr4, 5901 VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3)); 5901 5902 if (rc2 != VINF_SUCCESS) 5902 5903 { … … 5908 5909 5909 5910 /* Pending HM-to-R3 operations (critsects, timers, EMT rendezvous etc.) */ 5910 /* -XXX- what was that about single stepping? */5911 5911 if ( VM_FF_IS_PENDING(pVM, VM_FF_HM_TO_R3_MASK) 5912 5912 || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK)) … … 5941 5941 } 5942 5942 5943 /* Paranoia. */5944 5943 return VINF_SUCCESS; 5945 5944 } … … 6298 6297 6299 6298 /* 6300 * Clear the X86_EFL_TF if necessary 6299 * Clear the X86_EFL_TF if necessary. 6301 6300 */ 6302 6301 if (pVCpu->hm.s.fClearTrapFlag) … … 7452 7451 pVmxTransient->u8GuestTpr = pVCpu->hm.s.vmx.pbVirtApic[0x80]; 7453 7452 7453 PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu(); 7454 RTCPUID idCurrentCpu = pCpu->idCpu; 7454 7455 if ( pVmxTransient->fUpdateTscOffsettingAndPreemptTimer 7455 || HMR0GetCurrentCpu()->idCpu != pVCpu->hm.s.idLastCpu)7456 || idCurrentCpu != pVCpu->hm.s.idLastCpu) 7456 7457 { 7457 7458 hmR0VmxUpdateTscOffsettingAndPreemptTimer(pVCpu, pMixedCtx); … … 7460 7461 7461 7462 ASMAtomicWriteBool(&pVCpu->hm.s.fCheckedTLBFlush, true); /* Used for TLB-shootdowns, set this across the world switch. */ 7462 hmR0VmxFlushTaggedTlb(pVCpu); /* Invalidate the appropriate guest entries from the TLB. */ 7463 7464 RTCPUID idCurrentCpu = HMR0GetCurrentCpu()->idCpu; 7463 hmR0VmxFlushTaggedTlb(pVCpu, pCpu); /* Invalidate the appropriate guest entries from the TLB. */ 7464 7465 7465 Assert(idCurrentCpu == pVCpu->hm.s.idLastCpu); 7466 7466 pVCpu->hm.s.vmx.LastError.idCurrentCpu = idCurrentCpu; /* Update the error reporting info. with the current host CPU. */
Note:
See TracChangeset
for help on using the changeset viewer.