Changeset 38683 in vbox for trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
- Timestamp:
- Sep 8, 2011 8:34:02 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r38677 r38683 70 70 * Local Functions * 71 71 *******************************************************************************/ 72 static void VMXR0ReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rc, PCPUMCTX pCtx);73 static void vmxR0SetupTLBEPT(PVM pVM, PVMCPU pVCpu);74 static void vmxR0SetupTLBVPID(PVM pVM, PVMCPU pVCpu);75 static void vmxR0SetupTLBDummy(PVM pVM, PVMCPU pVCpu);76 static void vmxR0FlushEPT(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPHYS GCPhys);77 static void vmxR0FlushVPID(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPTR GCPtr);78 static void vmxR0UpdateExceptionBitmap(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);72 static void hmR0VmxReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rc, PCPUMCTX pCtx); 73 static void hmR0VmxSetupTLBEPT(PVM pVM, PVMCPU pVCpu); 74 static void hmR0VmxSetupTLBVPID(PVM pVM, PVMCPU pVCpu); 75 static void hmR0VmxSetupTLBDummy(PVM pVM, PVMCPU pVCpu); 76 static void hmR0VmxFlushEPT(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPHYS GCPhys); 77 static void hmR0VmxFlushVPID(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPTR GCPtr); 78 static void hmR0VmxUpdateExceptionBitmap(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx); 79 79 #ifdef VBOX_STRICT 80 static bool vmxR0IsValidReadField(uint32_t idxField); 81 static bool vmxR0IsValidWriteField(uint32_t idxField); 82 #endif 83 static void vmxR0SetMSRPermission(PVMCPU pVCpu, unsigned ulMSR, bool fRead, bool fWrite); 84 85 static void VMXR0CheckError(PVM pVM, PVMCPU pVCpu, int rc) 80 static bool hmR0VmxIsValidReadField(uint32_t idxField); 81 static bool hmR0VmxIsValidWriteField(uint32_t idxField); 82 #endif 83 static void hmR0VmxSetMSRPermission(PVMCPU pVCpu, unsigned ulMSR, bool fRead, bool fWrite); 84 85 86 static void hmR0VmxCheckError(PVM pVM, PVMCPU pVCpu, int rc) 86 87 { 87 88 if (rc == VERR_VMX_GENERIC) … … 526 527 527 528 /* Allow the guest to directly modify these MSRs; they are restored and saved automatically. */ 528 vmxR0SetMSRPermission(pVCpu, MSR_IA32_SYSENTER_CS, true, true);529 vmxR0SetMSRPermission(pVCpu, MSR_IA32_SYSENTER_ESP, true, true);530 vmxR0SetMSRPermission(pVCpu, MSR_IA32_SYSENTER_EIP, true, true);531 vmxR0SetMSRPermission(pVCpu, MSR_K8_LSTAR, true, true);532 vmxR0SetMSRPermission(pVCpu, MSR_K6_STAR, true, true);533 vmxR0SetMSRPermission(pVCpu, MSR_K8_SF_MASK, true, true);534 vmxR0SetMSRPermission(pVCpu, MSR_K8_KERNEL_GS_BASE, true, true);535 vmxR0SetMSRPermission(pVCpu, MSR_K8_GS_BASE, true, true);536 vmxR0SetMSRPermission(pVCpu, MSR_K8_FS_BASE, true, true);529 hmR0VmxSetMSRPermission(pVCpu, MSR_IA32_SYSENTER_CS, true, true); 530 hmR0VmxSetMSRPermission(pVCpu, MSR_IA32_SYSENTER_ESP, true, true); 531 hmR0VmxSetMSRPermission(pVCpu, MSR_IA32_SYSENTER_EIP, true, true); 532 hmR0VmxSetMSRPermission(pVCpu, MSR_K8_LSTAR, true, true); 533 hmR0VmxSetMSRPermission(pVCpu, MSR_K6_STAR, true, true); 534 hmR0VmxSetMSRPermission(pVCpu, MSR_K8_SF_MASK, true, true); 535 hmR0VmxSetMSRPermission(pVCpu, MSR_K8_KERNEL_GS_BASE, true, true); 536 hmR0VmxSetMSRPermission(pVCpu, MSR_K8_GS_BASE, true, true); 537 hmR0VmxSetMSRPermission(pVCpu, MSR_K8_FS_BASE, true, true); 537 538 } 538 539 … … 630 631 if (pVM->hwaccm.s.fNestedPaging) 631 632 { 632 pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = vmxR0SetupTLBEPT;633 pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = hmR0VmxSetupTLBEPT; 633 634 634 635 /* Default values for flushing. */ … … 650 651 if (pVM->hwaccm.s.vmx.fVPID) 651 652 { 652 pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = vmxR0SetupTLBVPID;653 pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = hmR0VmxSetupTLBVPID; 653 654 654 655 /* Default values for flushing. */ … … 668 669 #endif /* HWACCM_VTX_WITH_VPID */ 669 670 else 670 pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = vmxR0SetupTLBDummy;671 pVM->hwaccm.s.vmx.pfnSetupTaggedTLB = hmR0VmxSetupTLBDummy; 671 672 672 673 vmx_end: 673 VMXR0CheckError(pVM, &pVM->aCpus[0], rc);674 hmR0VmxCheckError(pVM, &pVM->aCpus[0], rc); 674 675 return rc; 675 676 } … … 683 684 * @param fWrite Writing allowed/disallowed 684 685 */ 685 static void vmxR0SetMSRPermission(PVMCPU pVCpu, unsigned ulMSR, bool fRead, bool fWrite)686 static void hmR0VmxSetMSRPermission(PVMCPU pVCpu, unsigned ulMSR, bool fRead, bool fWrite) 686 687 { 687 688 unsigned ulBit; … … 739 740 * @param errCode Error code (optional) 740 741 */ 741 static int VMXR0InjectEvent(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t intInfo, uint32_t cbInstr, uint32_t errCode)742 static int hmR0VmxInjectEvent(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t intInfo, uint32_t cbInstr, uint32_t errCode) 742 743 { 743 744 int rc; … … 750 751 #ifdef VBOX_STRICT 751 752 if (iGate == 0xE) 752 LogFlow((" VMXR0InjectEvent: Injecting interrupt %d at %RGv error code=%08x CR2=%RGv intInfo=%08x\n", iGate, (RTGCPTR)pCtx->rip, errCode, pCtx->cr2, intInfo));753 LogFlow(("hmR0VmxInjectEvent: Injecting interrupt %d at %RGv error code=%08x CR2=%RGv intInfo=%08x\n", iGate, (RTGCPTR)pCtx->rip, errCode, pCtx->cr2, intInfo)); 753 754 else 754 755 if (iGate < 0x20) 755 LogFlow((" VMXR0InjectEvent: Injecting interrupt %d at %RGv error code=%08x\n", iGate, (RTGCPTR)pCtx->rip, errCode));756 LogFlow(("hmR0VmxInjectEvent: Injecting interrupt %d at %RGv error code=%08x\n", iGate, (RTGCPTR)pCtx->rip, errCode)); 756 757 else 757 758 { … … 790 791 intInfo2 |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HWEXCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 791 792 792 return VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, 0, 0 /* no error code according to the Intel docs */);793 return hmR0VmxInjectEvent(pVM, pVCpu, pCtx, intInfo2, 0, 0 /* no error code according to the Intel docs */); 793 794 } 794 795 Log(("Triple fault -> reset the VM!\n")); … … 852 853 * @param pCtx CPU Context 853 854 */ 854 static int VMXR0CheckPendingInterrupt(PVM pVM, PVMCPU pVCpu, CPUMCTX *pCtx)855 static int hmR0VmxCheckPendingInterrupt(PVM pVM, PVMCPU pVCpu, CPUMCTX *pCtx) 855 856 { 856 857 int rc; … … 861 862 Log(("CPU%d: Reinjecting event %RX64 %08x at %RGv cr2=%RX64\n", pVCpu->idCpu, pVCpu->hwaccm.s.Event.intInfo, pVCpu->hwaccm.s.Event.errCode, (RTGCPTR)pCtx->rip, pCtx->cr2)); 862 863 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntReinject); 863 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, pVCpu->hwaccm.s.Event.intInfo, 0, pVCpu->hwaccm.s.Event.errCode);864 rc = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, pVCpu->hwaccm.s.Event.intInfo, 0, pVCpu->hwaccm.s.Event.errCode); 864 865 AssertRC(rc); 865 866 … … 881 882 intInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 882 883 883 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo, 0, 0);884 rc = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, intInfo, 0, 0); 884 885 AssertRC(rc); 885 886 … … 985 986 986 987 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatIntInject); 987 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo, 0, errCode);988 rc = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, intInfo, 0, errCode); 988 989 AssertRC(rc); 989 990 } /* if (interrupts can be dispatched) */ … … 1242 1243 * @param pCtx Guest context 1243 1244 */ 1244 static int vmxR0PrefetchPAEPdptrs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)1245 static int hmR0VmxPrefetchPAEPdptrs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1245 1246 { 1246 1247 if (CPUMIsGuestInPAEModeEx(pCtx)) … … 1266 1267 * @param pCtx Guest context 1267 1268 */ 1268 static void vmxR0UpdateExceptionBitmap(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)1269 static void hmR0VmxUpdateExceptionBitmap(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx) 1269 1270 { 1270 1271 uint32_t u32TrapMask; … … 1753 1754 val = pCtx->cr3; 1754 1755 /* Prefetch the four PDPT entries in PAE mode. */ 1755 rc = vmxR0PrefetchPAEPdptrs(pVM, pVCpu, pCtx);1756 rc = hmR0VmxPrefetchPAEPdptrs(pVM, pVCpu, pCtx); 1756 1757 AssertRCReturn(rc, rc); 1757 1758 } … … 1854 1855 } 1855 1856 1856 vmxR0UpdateExceptionBitmap(pVM, pVCpu, pCtx);1857 hmR0VmxUpdateExceptionBitmap(pVM, pVCpu, pCtx); 1857 1858 1858 1859 #ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE … … 2028 2029 } 2029 2030 /* Prefetch the four PDPT entries in PAE mode. */ 2030 rc = vmxR0PrefetchPAEPdptrs(pVM, pVCpu, pCtx);2031 rc = hmR0VmxPrefetchPAEPdptrs(pVM, pVCpu, pCtx); 2031 2032 AssertRCReturn(rc, rc); 2032 2033 } … … 2126 2127 * @param pVCpu The VMCPU to operate on. 2127 2128 */ 2128 static void vmxR0SetupTLBDummy(PVM pVM, PVMCPU pVCpu)2129 static void hmR0VmxSetupTLBDummy(PVM pVM, PVMCPU pVCpu) 2129 2130 { 2130 2131 NOREF(pVM); … … 2142 2143 * @param pVCpu The VMCPU to operate on. 2143 2144 */ 2144 static void vmxR0SetupTLBEPT(PVM pVM, PVMCPU pVCpu)2145 static void hmR0VmxSetupTLBEPT(PVM pVM, PVMCPU pVCpu) 2145 2146 { 2146 2147 PHMGLOBLCPUINFO pCpu; … … 2174 2175 if (pVCpu->hwaccm.s.fForceTLBFlush) 2175 2176 { 2176 vmxR0FlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushContext, 0);2177 hmR0VmxFlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushContext, 0); 2177 2178 } 2178 2179 else … … 2185 2186 { 2186 2187 /* aTlbShootdownPages contains physical addresses in this case. */ 2187 vmxR0FlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushPage, pVCpu->hwaccm.s.TlbShootdown.aPages[i]);2188 hmR0VmxFlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushPage, pVCpu->hwaccm.s.TlbShootdown.aPages[i]); 2188 2189 } 2189 2190 } … … 2207 2208 * @param pVCpu The VMCPU to operate on. 2208 2209 */ 2209 static void vmxR0SetupTLBVPID(PVM pVM, PVMCPU pVCpu)2210 static void hmR0VmxSetupTLBVPID(PVM pVM, PVMCPU pVCpu) 2210 2211 { 2211 2212 PHMGLOBLCPUINFO pCpu; … … 2243 2244 pCpu->uCurrentASID = 1; /* start at 1; host uses 0 */ 2244 2245 pCpu->cTLBFlushes++; 2245 vmxR0FlushVPID(pVM, pVCpu, VMX_FLUSH_ALL_CONTEXTS, 0);2246 hmR0VmxFlushVPID(pVM, pVCpu, VMX_FLUSH_ALL_CONTEXTS, 0); 2246 2247 } 2247 2248 else … … 2262 2263 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatTlbShootdown); 2263 2264 for (unsigned i = 0; i < pVCpu->hwaccm.s.TlbShootdown.cPages; i++) 2264 vmxR0FlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushPage, pVCpu->hwaccm.s.TlbShootdown.aPages[i]);2265 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushPage, pVCpu->hwaccm.s.TlbShootdown.aPages[i]); 2265 2266 } 2266 2267 } … … 2276 2277 2277 2278 if (pVCpu->hwaccm.s.fForceTLBFlush) 2278 vmxR0FlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushContext, 0);2279 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushContext, 0); 2279 2280 2280 2281 # ifdef VBOX_WITH_STATISTICS … … 2516 2517 * Interrupts are disabled before the call to make sure we don't miss any interrupt 2517 2518 * that would flag preemption (IPI, timer tick, ++). (Would've been nice to do this 2518 * further down, but VMXR0CheckPendingInterrupt makes that impossible.)2519 * further down, but hmR0VmxCheckPendingInterrupt makes that impossible.) 2519 2520 * 2520 2521 * Note! Interrupts must be disabled done *before* we check for TLB flushes; TLB … … 2533 2534 /* When external interrupts are pending, we should exit the VM when IF is set. */ 2534 2535 /* Note! *After* VM_FF_INHIBIT_INTERRUPTS check!!! */ 2535 rc = VMXR0CheckPendingInterrupt(pVM, pVCpu, pCtx);2536 rc = hmR0VmxCheckPendingInterrupt(pVM, pVCpu, pCtx); 2536 2537 if (RT_FAILURE(rc)) 2537 2538 goto end; … … 2573 2574 { 2574 2575 /* A TPR change could activate a pending interrupt, so catch lstar writes. */ 2575 vmxR0SetMSRPermission(pVCpu, MSR_K8_LSTAR, true, false);2576 hmR0VmxSetMSRPermission(pVCpu, MSR_K8_LSTAR, true, false); 2576 2577 } 2577 2578 else … … 2580 2581 * There are enough world switches for detecting pending interrupts. 2581 2582 */ 2582 vmxR0SetMSRPermission(pVCpu, MSR_K8_LSTAR, true, true);2583 hmR0VmxSetMSRPermission(pVCpu, MSR_K8_LSTAR, true, true); 2583 2584 } 2584 2585 } … … 2743 2744 if (RT_UNLIKELY(rc != VINF_SUCCESS)) 2744 2745 { 2745 VMXR0ReportWorldSwitchError(pVM, pVCpu, rc, pCtx);2746 hmR0VmxReportWorldSwitchError(pVM, pVCpu, rc, pCtx); 2746 2747 VMMR0LogFlushEnable(pVCpu); 2747 2748 goto end; … … 2890 2891 Log(("Forward #NM fault to the guest\n")); 2891 2892 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitGuestNM); 2892 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, 0);2893 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, 0); 2893 2894 AssertRC(rc2); 2894 2895 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3); … … 2911 2912 /* Now we must update CR2. */ 2912 2913 pCtx->cr2 = exitQualification; 2913 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);2914 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 2914 2915 AssertRC(rc2); 2915 2916 … … 3003 3004 /* Now we must update CR2. */ 3004 3005 pCtx->cr2 = exitQualification; 3005 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);3006 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 3006 3007 AssertRC(rc2); 3007 3008 … … 3029 3030 } 3030 3031 Log(("Trap %x at %04X:%RGv\n", vector, pCtx->cs, (RTGCPTR)pCtx->rip)); 3031 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);3032 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 3032 3033 AssertRC(rc2); 3033 3034 … … 3078 3079 3079 3080 Log(("Trap %x (debug) at %RGv exit qualification %RX64 dr6=%x dr7=%x\n", vector, (RTGCPTR)pCtx->rip, exitQualification, (uint32_t)pCtx->dr[6], (uint32_t)pCtx->dr[7])); 3080 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);3081 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 3081 3082 AssertRC(rc2); 3082 3083 … … 3095 3096 { 3096 3097 Log(("Guest #BP at %04x:%RGv\n", pCtx->cs, pCtx->rip)); 3097 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);3098 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 3098 3099 AssertRC(rc2); 3099 3100 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3); … … 3121 3122 { 3122 3123 Log(("Trap %x at %04X:%RGv errorCode=%RGv\n", vector, pCtx->cs, (RTGCPTR)pCtx->rip, errCode)); 3123 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);3124 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 3124 3125 AssertRC(rc2); 3125 3126 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit2Sub3, y3); … … 3290 3291 intInfo2 |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 3291 3292 3292 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0);3293 rc = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0); 3293 3294 AssertRC(VBOXSTRICTRC_VAL(rc)); 3294 3295 fUpdateRIP = false; … … 3308 3309 intInfo2 |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 3309 3310 3310 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0);3311 rc = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0); 3311 3312 AssertRC(VBOXSTRICTRC_VAL(rc)); 3312 3313 fUpdateRIP = false; … … 3325 3326 intInfo2 |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 3326 3327 3327 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0);3328 rc = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0); 3328 3329 AssertRC(VBOXSTRICTRC_VAL(rc)); 3329 3330 fUpdateRIP = false; … … 3381 3382 3382 3383 Log(("Trap %x at %04X:%RGv\n", vector, pCtx->cs, (RTGCPTR)pCtx->rip)); 3383 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);3384 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 3384 3385 AssertRC(rc2); 3385 3386 … … 3393 3394 { 3394 3395 Log(("Real Mode Trap %x at %04x:%04X error code %x\n", vector, pCtx->cs, pCtx->eip, errCode)); 3395 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode);3396 rc = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), cbInstr, errCode); 3396 3397 AssertRC(VBOXSTRICTRC_VAL(rc)); /* Strict RC check below. */ 3397 3398 … … 3956 3957 3957 3958 Log(("Inject IO debug trap at %RGv\n", (RTGCPTR)pCtx->rip)); 3958 rc2 = VMXR0InjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 0, 0);3959 rc2 = hmR0VmxInjectEvent(pVM, pVCpu, pCtx, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(intInfo), 0, 0); 3959 3960 AssertRC(rc2); 3960 3961 … … 4341 4342 * @param GCPhys Physical address of the page to flush 4342 4343 */ 4343 static void vmxR0FlushEPT(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPHYS GCPhys)4344 static void hmR0VmxFlushEPT(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPHYS GCPhys) 4344 4345 { 4345 4346 uint64_t descriptor[2]; 4346 4347 4347 LogFlow((" vmxR0FlushEPT %d %RGv\n", enmFlush, GCPhys));4348 LogFlow(("hmR0VmxFlushEPT %d %RGv\n", enmFlush, GCPhys)); 4348 4349 Assert(pVM->hwaccm.s.fNestedPaging); 4349 4350 descriptor[0] = pVCpu->hwaccm.s.vmx.GCPhysEPTP; … … 4363 4364 * @param GCPtr Virtual address of the page to flush 4364 4365 */ 4365 static void vmxR0FlushVPID(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPTR GCPtr)4366 static void hmR0VmxFlushVPID(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPTR GCPtr) 4366 4367 { 4367 4368 #if HC_ARCH_BITS == 32 … … 4408 4409 if ( !fFlushPending 4409 4410 && pVM->hwaccm.s.vmx.fVPID) 4410 vmxR0FlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushPage, GCVirt);4411 hmR0VmxFlushVPID(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushPage, GCVirt); 4411 4412 #endif /* HWACCM_VTX_WITH_VPID */ 4412 4413 … … 4434 4435 /* Skip it if a TLB flush is already pending. */ 4435 4436 if (!fFlushPending) 4436 vmxR0FlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushPage, GCPhys);4437 hmR0VmxFlushEPT(pVM, pVCpu, pVM->hwaccm.s.vmx.enmFlushPage, GCPhys); 4437 4438 4438 4439 return VINF_SUCCESS; … … 4447 4448 * @param pCtx Current CPU context (not updated) 4448 4449 */ 4449 static void VMXR0ReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rc, PCPUMCTX pCtx)4450 static void hmR0VmxReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rc, PCPUMCTX pCtx) 4450 4451 { 4451 4452 switch (VBOXSTRICTRC_VAL(rc)) … … 4696 4697 #ifdef VBOX_STRICT 4697 4698 for (unsigned i=0;i<pVCpu->hwaccm.s.vmx.VMCSCache.Write.cValidEntries;i++) 4698 Assert( vmxR0IsValidWriteField(pVCpu->hwaccm.s.vmx.VMCSCache.Write.aField[i]));4699 Assert(hmR0VmxIsValidWriteField(pVCpu->hwaccm.s.vmx.VMCSCache.Write.aField[i])); 4699 4700 4700 4701 for (unsigned i=0;i<pVCpu->hwaccm.s.vmx.VMCSCache.Read.cValidEntries;i++) 4701 Assert( vmxR0IsValidReadField(pVCpu->hwaccm.s.vmx.VMCSCache.Read.aField[i]));4702 Assert(hmR0VmxIsValidReadField(pVCpu->hwaccm.s.vmx.VMCSCache.Read.aField[i])); 4702 4703 #endif 4703 4704 … … 4850 4851 4851 4852 #ifdef VBOX_STRICT 4852 static bool vmxR0IsValidReadField(uint32_t idxField)4853 static bool hmR0VmxIsValidReadField(uint32_t idxField) 4853 4854 { 4854 4855 switch(idxField) … … 4918 4919 } 4919 4920 4920 static bool vmxR0IsValidWriteField(uint32_t idxField)4921 static bool hmR0VmxIsValidWriteField(uint32_t idxField) 4921 4922 { 4922 4923 switch(idxField) … … 4946 4947 4947 4948 #endif 4949
Note:
See TracChangeset
for help on using the changeset viewer.