VirtualBox

Changeset 45532 in vbox for trunk


Ignore:
Timestamp:
Apr 13, 2013 9:34:06 AM (12 years ago)
Author:
vboxsync
Message:

VMMR0/HMVMXR0: HM bits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r45531 r45532  
    49854985               || uIntrState == VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS);
    49864986        rc  = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
    4987         rc |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);    /* for hmR0VmxLoadGuestIntrState(). */
     4987        rc |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);    /* for hmR0VmxGetGuestIntrState(). */
    49884988        AssertRC(rc);
    49894989        EMSetInhibitInterruptsPC(pVCpu, pMixedCtx->rip);
     
    55585558
    55595559/**
    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).
    55615562 *
    55625563 * @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 */
     5566static void hmR0VmxUpdatePendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx)
    55655567{
    55665568    if (!TRPMHasTrap(pVCpu))
     
    56065608                u32IntrInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
    56075609                if (uVector == X86_XCPT_PF)
    5608                     pMixedCtx->cr2 = TRPMGetFaultAddress(pVCpu);
     5610                    pCtx->cr2 = TRPMGetFaultAddress(pVCpu);
    56095611                break;
    56105612            }
     
    56245626
    56255627    rc = TRPMResetTrap(pVCpu);
     5628    AssertRC(rc);
    56265629    Log(("Converted TRPM trap: u32IntrInfo=%#RX32 enmTrpmEvent=%d cbInstr=%u u32ErrCode=%#RX32 GCPtrFaultAddress=%#RGv\n",
    56275630         u32IntrInfo, enmTrpmEvent, u32ErrCode, GCPtrFaultAddress));
     
    56365639 * @param   pvCpu           Pointer to the VMCPU.
    56375640 */
    5638 static void hmR0VmxUpdateTRPMTrap(PVMCPU pVCpu)
     5641static void hmR0VmxUpdateTRPM(PVMCPU pVCpu)
    56395642{
    56405643    if (pVCpu->hm.s.Event.fPending)
     
    56705673
    56715674        Log(("Converting pending HM event to TRPM trap uVector=%#x enmTrapType=%d\n", uVector, enmTrapType));
    5672 
    56735675        int rc = TRPMAssertTrap(pVCpu, uVector, enmTrapType);
    56745676        AssertRC(rc);
     5677
    56755678        if (fErrorCodeValid)
    56765679            TRPMSetErrorCode(pVCpu, uErrorCode);
    5677 
    56785680        /* A page-fault exception during a page-fault would become a double-fault. */
    56795681        if (   uVectorType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT
     
    57805782
    57815783    /* We need to do this only while truly exiting the "inner loop" back to ring-3 and -not- for any longjmp to ring3. */
    5782     hmR0VmxUpdateTRPMTrap(pVCpu);
     5784    hmR0VmxUpdateTRPM(pVCpu);
    57835785
    57845786    /* Sync. the guest state. */
     
    58565858
    58575859/**
    5858  * Checks if there are any pending guest interrupts to be delivered and injects
    5859  * 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.
    58605862 *
    58615863 * @returns VBox status code (informational status codes included).
     
    59585960     * VT-x clears the valid bit on every VM-exit. See Intel spec. 24.8.3 "VM-Entry Controls for Event Injection".
    59595961     */
    5960     hmR0VmxLoadGuestIntrState(pVCpu, uIntrState);
     5962    int rc2 = hmR0VmxLoadGuestIntrState(pVCpu, uIntrState);
     5963    AssertRC(rc2);
     5964    Assert(rc == VINF_SUCCESS || rc == VINF_EM_RESET);
    59615965    return rc;
    59625966}
     
    59735977DECLINLINE(void) hmR0VmxSetPendingXcptUD(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
    59745978{
    5975     /* Refer Intel spec. 24.8.3 "VM-entry Controls for Event Injection" for the format of u32IntrInfo. */
    59765979    uint32_t u32IntrInfo = X86_XCPT_UD | (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT);
    59775980    STAM_COUNTER_INC(&pVCpu->hm.s.StatIntInject);
     
    61446147 *                          exceptions).
    61456148 * @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.
    61466152 *
    61476153 * @remarks No-long-jump zone!!!
     
    61626168    Assert(   uIntrType != VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI
    61636169           || !((*puIntrState) & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS));
    6164 
    6165     STAM_COUNTER_INC(&pVCpu->hm.s.paStatInjectedIrqsR0[uVector & MASK_INJECT_IRQ_STAT]);
    61666170
    61676171    /* We require CR0 to check if the guest is in real-mode. */
     
    62686272    }
    62696273
    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. */
    62736276    Assert(!VMX_EXIT_INTERRUPTION_INFO_NMI_UNBLOCK(u32IntrInfo));       /* Bit 12 MBZ. */
    62746277    Assert(!(u32IntrInfo & 0x7ffff000));                                /* Bits 30:12 MBZ. */
     6278
     6279    /* Inject. */
    62756280    Log(("Injecting u32IntrInfo=%#x u32ErrCode=%#x instrlen=%#x\n", u32IntrInfo, u32ErrCode, cbInstr));
    62766281    rc  = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INTERRUPTION_INFO, u32IntrInfo);
     
    62796284    rc |= VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INSTR_LENGTH, cbInstr);
    62806285    AssertRCReturn(rc, rc);
    6281 
    6282     Assert(uIntrType != VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT);
    62836286    return rc;
    62846287}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette