- Timestamp:
- Apr 13, 2013 9:34:06 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r45531 r45532 4985 4985 || uIntrState == VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS); 4986 4986 rc = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx); 4987 rc |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx); /* for hmR0Vmx LoadGuestIntrState(). */4987 rc |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx); /* for hmR0VmxGetGuestIntrState(). */ 4988 4988 AssertRC(rc); 4989 4989 EMSetInhibitInterruptsPC(pVCpu, pMixedCtx->rip); … … 5558 5558 5559 5559 /** 5560 * Converts any TRPM trap into a pending VMX event. 5560 * Converts any TRPM trap into a pending VMX event. This is typically used when 5561 * entering from ring-3 (not longjmp returns). 5561 5562 * 5562 5563 * @param pVCpu Pointer to the VMCPU. 5563 */ 5564 static void hmR0VmxUpdatePendingEvent(PVMCPU pVCpu, PCPUMCTX pMixedCtx) 5564 * @param pCtx Pointer to the guest-CPU context. 5565 */ 5566 static void hmR0VmxUpdatePendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx) 5565 5567 { 5566 5568 if (!TRPMHasTrap(pVCpu)) … … 5606 5608 u32IntrInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 5607 5609 if (uVector == X86_XCPT_PF) 5608 p MixedCtx->cr2 = TRPMGetFaultAddress(pVCpu);5610 pCtx->cr2 = TRPMGetFaultAddress(pVCpu); 5609 5611 break; 5610 5612 } … … 5624 5626 5625 5627 rc = TRPMResetTrap(pVCpu); 5628 AssertRC(rc); 5626 5629 Log(("Converted TRPM trap: u32IntrInfo=%#RX32 enmTrpmEvent=%d cbInstr=%u u32ErrCode=%#RX32 GCPtrFaultAddress=%#RGv\n", 5627 5630 u32IntrInfo, enmTrpmEvent, u32ErrCode, GCPtrFaultAddress)); … … 5636 5639 * @param pvCpu Pointer to the VMCPU. 5637 5640 */ 5638 static void hmR0VmxUpdateTRPM Trap(PVMCPU pVCpu)5641 static void hmR0VmxUpdateTRPM(PVMCPU pVCpu) 5639 5642 { 5640 5643 if (pVCpu->hm.s.Event.fPending) … … 5670 5673 5671 5674 Log(("Converting pending HM event to TRPM trap uVector=%#x enmTrapType=%d\n", uVector, enmTrapType)); 5672 5673 5675 int rc = TRPMAssertTrap(pVCpu, uVector, enmTrapType); 5674 5676 AssertRC(rc); 5677 5675 5678 if (fErrorCodeValid) 5676 5679 TRPMSetErrorCode(pVCpu, uErrorCode); 5677 5678 5680 /* A page-fault exception during a page-fault would become a double-fault. */ 5679 5681 if ( uVectorType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT … … 5780 5782 5781 5783 /* We need to do this only while truly exiting the "inner loop" back to ring-3 and -not- for any longjmp to ring3. */ 5782 hmR0VmxUpdateTRPM Trap(pVCpu);5784 hmR0VmxUpdateTRPM(pVCpu); 5783 5785 5784 5786 /* Sync. the guest state. */ … … 5856 5858 5857 5859 /** 5858 * Checks if there are any pending guest interrupts to be delivered and injects5859 * them into the VM by updating the VMCS.5860 * Injects any pending events into the guest if the guest is in a state to 5861 * receive them. 5860 5862 * 5861 5863 * @returns VBox status code (informational status codes included). … … 5958 5960 * VT-x clears the valid bit on every VM-exit. See Intel spec. 24.8.3 "VM-Entry Controls for Event Injection". 5959 5961 */ 5960 hmR0VmxLoadGuestIntrState(pVCpu, uIntrState); 5962 int rc2 = hmR0VmxLoadGuestIntrState(pVCpu, uIntrState); 5963 AssertRC(rc2); 5964 Assert(rc == VINF_SUCCESS || rc == VINF_EM_RESET); 5961 5965 return rc; 5962 5966 } … … 5973 5977 DECLINLINE(void) hmR0VmxSetPendingXcptUD(PVMCPU pVCpu, PCPUMCTX pMixedCtx) 5974 5978 { 5975 /* Refer Intel spec. 24.8.3 "VM-entry Controls for Event Injection" for the format of u32IntrInfo. */5976 5979 uint32_t u32IntrInfo = X86_XCPT_UD | (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT); 5977 5980 STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject); … … 6144 6147 * exceptions). 6145 6148 * @param u32ErrCode The VM-entry exception error code. 6149 * @param puIntrState Pointer to the current guest interruptibility-state. 6150 * This interruptibility-state will be updated if 6151 * necessary. This cannot not be NULL. 6146 6152 * 6147 6153 * @remarks No-long-jump zone!!! … … 6162 6168 Assert( uIntrType != VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI 6163 6169 || !((*puIntrState) & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS)); 6164 6165 STAM_COUNTER_INC(&pVCpu->hm.s.paStatInjectedIrqsR0[uVector & MASK_INJECT_IRQ_STAT]);6166 6170 6167 6171 /* We require CR0 to check if the guest is in real-mode. */ … … 6268 6272 } 6269 6273 6270 /* Add the valid bit, maybe the caller was lazy. */ 6271 u32IntrInfo |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT); 6272 6274 /* Validate. */ 6275 Assert(VMX_EXIT_INTERRUPTION_INFO_VALID(u32IntrInfo)); /* Bit 31 (Valid bit) must be set by caller. */ 6273 6276 Assert(!VMX_EXIT_INTERRUPTION_INFO_NMI_UNBLOCK(u32IntrInfo)); /* Bit 12 MBZ. */ 6274 6277 Assert(!(u32IntrInfo & 0x7ffff000)); /* Bits 30:12 MBZ. */ 6278 6279 /* Inject. */ 6275 6280 Log(("Injecting u32IntrInfo=%#x u32ErrCode=%#x instrlen=%#x\n", u32IntrInfo, u32ErrCode, cbInstr)); 6276 6281 rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INTERRUPTION_INFO, u32IntrInfo); … … 6279 6284 rc |= VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INSTR_LENGTH, cbInstr); 6280 6285 AssertRCReturn(rc, rc); 6281 6282 Assert(uIntrType != VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT);6283 6286 return rc; 6284 6287 }
Note:
See TracChangeset
for help on using the changeset viewer.