Changeset 66706 in vbox
- Timestamp:
- Apr 27, 2017 5:56:12 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r66705 r66706 51 51 # define HMVMX_ALWAYS_FLUSH_TLB 52 52 # define HMVMX_ALWAYS_SWAP_EFER 53 # define HMVMX_USE_IEM_EVENT_REFLECTION 53 54 #endif 54 55 … … 5734 5735 5735 5736 5736 #if 0 5737 /** 5738 * Determines if an exception is a contributory exception. 5739 * 5740 * Contributory exceptions are ones which can cause double-faults unless the 5741 * original exception was a benign exception. Page-fault is intentionally not 5742 * included here as it's a conditional contributory exception. 5743 * 5744 * @returns true if the exception is contributory, false otherwise. 5745 * @param uVector The exception vector. 5746 */ 5747 DECLINLINE(bool) hmR0VmxIsContributoryXcpt(const uint32_t uVector) 5748 { 5749 switch (uVector) 5750 { 5751 case X86_XCPT_GP: 5752 case X86_XCPT_SS: 5753 case X86_XCPT_NP: 5754 case X86_XCPT_TS: 5755 case X86_XCPT_DE: 5756 return true; 5757 default: 5758 break; 5759 } 5760 return false; 5761 } 5762 #endif 5763 5764 /** 5765 * Sets an event as a pending event to be injected into the guest. 5766 * 5767 * @param pVCpu The cross context virtual CPU structure. 5768 * @param u32IntInfo The VM-entry interruption-information field. 5769 * @param cbInstr The VM-entry instruction length in bytes (for software 5770 * interrupts, exceptions and privileged software 5771 * exceptions). 5772 * @param u32ErrCode The VM-entry exception error code. 5773 * @param GCPtrFaultAddress The fault-address (CR2) in case it's a 5774 * page-fault. 5775 * 5776 * @remarks Statistics counter assumes this is a guest event being injected or 5777 * re-injected into the guest, i.e. 'StatInjectPendingReflect' is 5778 * always incremented. 5779 */ 5780 DECLINLINE(void) hmR0VmxSetPendingEvent(PVMCPU pVCpu, uint32_t u32IntInfo, uint32_t cbInstr, uint32_t u32ErrCode, 5781 RTGCUINTPTR GCPtrFaultAddress) 5782 { 5783 Assert(!pVCpu->hm.s.Event.fPending); 5784 pVCpu->hm.s.Event.fPending = true; 5785 pVCpu->hm.s.Event.u64IntInfo = u32IntInfo; 5786 pVCpu->hm.s.Event.u32ErrCode = u32ErrCode; 5787 pVCpu->hm.s.Event.cbInstr = cbInstr; 5788 pVCpu->hm.s.Event.GCPtrFaultAddress = GCPtrFaultAddress; 5789 } 5790 5791 5792 /** 5793 * Sets a double-fault (\#DF) exception as pending-for-injection into the VM. 5794 * 5795 * @param pVCpu The cross context virtual CPU structure. 5796 * @param pMixedCtx Pointer to the guest-CPU context. The data may be 5797 * out-of-sync. Make sure to update the required fields 5798 * before using them. 5799 */ 5800 DECLINLINE(void) hmR0VmxSetPendingXcptDF(PVMCPU pVCpu, PCPUMCTX pMixedCtx) 5801 { 5802 NOREF(pMixedCtx); 5803 uint32_t u32IntInfo = X86_XCPT_DF | VMX_EXIT_INTERRUPTION_INFO_VALID; 5804 u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 5805 u32IntInfo |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID; 5806 hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */); 5807 } 5808 5809 5737 #ifdef HMVMX_USE_IEM_EVENT_REFLECTION 5810 5738 /** 5811 5739 * Gets the IEM exception flags for the specified vector and IDT vectoring / … … 5857 5785 } 5858 5786 5787 #else 5788 /** 5789 * Determines if an exception is a contributory exception. 5790 * 5791 * Contributory exceptions are ones which can cause double-faults unless the 5792 * original exception was a benign exception. Page-fault is intentionally not 5793 * included here as it's a conditional contributory exception. 5794 * 5795 * @returns true if the exception is contributory, false otherwise. 5796 * @param uVector The exception vector. 5797 */ 5798 DECLINLINE(bool) hmR0VmxIsContributoryXcpt(const uint32_t uVector) 5799 { 5800 switch (uVector) 5801 { 5802 case X86_XCPT_GP: 5803 case X86_XCPT_SS: 5804 case X86_XCPT_NP: 5805 case X86_XCPT_TS: 5806 case X86_XCPT_DE: 5807 return true; 5808 default: 5809 break; 5810 } 5811 return false; 5812 } 5813 #endif /* HMVMX_USE_IEM_EVENT_REFLECTION */ 5814 5815 5816 /** 5817 * Sets an event as a pending event to be injected into the guest. 5818 * 5819 * @param pVCpu The cross context virtual CPU structure. 5820 * @param u32IntInfo The VM-entry interruption-information field. 5821 * @param cbInstr The VM-entry instruction length in bytes (for software 5822 * interrupts, exceptions and privileged software 5823 * exceptions). 5824 * @param u32ErrCode The VM-entry exception error code. 5825 * @param GCPtrFaultAddress The fault-address (CR2) in case it's a 5826 * page-fault. 5827 * 5828 * @remarks Statistics counter assumes this is a guest event being injected or 5829 * re-injected into the guest, i.e. 'StatInjectPendingReflect' is 5830 * always incremented. 5831 */ 5832 DECLINLINE(void) hmR0VmxSetPendingEvent(PVMCPU pVCpu, uint32_t u32IntInfo, uint32_t cbInstr, uint32_t u32ErrCode, 5833 RTGCUINTPTR GCPtrFaultAddress) 5834 { 5835 Assert(!pVCpu->hm.s.Event.fPending); 5836 pVCpu->hm.s.Event.fPending = true; 5837 pVCpu->hm.s.Event.u64IntInfo = u32IntInfo; 5838 pVCpu->hm.s.Event.u32ErrCode = u32ErrCode; 5839 pVCpu->hm.s.Event.cbInstr = cbInstr; 5840 pVCpu->hm.s.Event.GCPtrFaultAddress = GCPtrFaultAddress; 5841 } 5842 5843 5844 /** 5845 * Sets a double-fault (\#DF) exception as pending-for-injection into the VM. 5846 * 5847 * @param pVCpu The cross context virtual CPU structure. 5848 * @param pMixedCtx Pointer to the guest-CPU context. The data may be 5849 * out-of-sync. Make sure to update the required fields 5850 * before using them. 5851 */ 5852 DECLINLINE(void) hmR0VmxSetPendingXcptDF(PVMCPU pVCpu, PCPUMCTX pMixedCtx) 5853 { 5854 NOREF(pMixedCtx); 5855 uint32_t u32IntInfo = X86_XCPT_DF | VMX_EXIT_INTERRUPTION_INFO_VALID; 5856 u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 5857 u32IntInfo |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID; 5858 hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */); 5859 } 5860 5859 5861 5860 5862 /** … … 5889 5891 uint32_t const uIdtVectorType = VMX_IDT_VECTORING_INFO_TYPE(pVmxTransient->uIdtVectoringInfo); 5890 5892 uint32_t const uIdtVector = VMX_IDT_VECTORING_INFO_VECTOR(pVmxTransient->uIdtVectoringInfo); 5891 #if 15893 #ifdef HMVMX_USE_IEM_EVENT_REFLECTION 5892 5894 /* See Intel spec. 30.7.1.1 "Reflecting Exceptions to Guest Software". */ 5893 5895 IEMXCPTRAISE enmRaise; … … 6178 6180 break; 6179 6181 } 6180 #endif 6182 #endif /* HMVMX_USE_IEM_EVENT_REFLECTION */ 6181 6183 } 6182 6184 else if ( VMX_EXIT_INTERRUPTION_INFO_IS_VALID(pVmxTransient->uExitIntInfo)
Note:
See TracChangeset
for help on using the changeset viewer.

