VirtualBox

Changeset 77573 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 6, 2019 9:25:20 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Inline helpers for injecting NMI and external interrupt.

File:
1 edited

Legend:

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

    r77572 r77573  
    58025802
    58035803/**
     5804 * Sets an external interrupt as pending-for-injection into the VM.
     5805 *
     5806 * @param   pVCpu           The cross context virtual CPU structure.
     5807 * @param   u8Interrupt     The external interrupt vector.
     5808 */
     5809DECLINLINE(void) hmR0VmxSetPendingExtInt(PVMCPU pVCpu, uint8_t u8Interrupt)
     5810{
     5811    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_EXIT_INT_INFO_VECTOR,          u8Interrupt)
     5812                              | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_TYPE,           VMX_ENTRY_INT_INFO_TYPE_EXT_INT)
     5813                              | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_ERR_CODE_VALID, 0)
     5814                              | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VALID,          1);
     5815    hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
     5816}
     5817
     5818
     5819/**
     5820 * Sets an NMI (\#NMI) exception as pending-for-injection into the VM.
     5821 *
     5822 * @param   pVCpu           The cross context virtual CPU structure.
     5823 */
     5824DECLINLINE(void) hmR0VmxSetPendingXcptNmi(PVMCPU pVCpu)
     5825{
     5826    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VECTOR,         X86_XCPT_NMI)
     5827                              | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_TYPE,           VMX_ENTRY_INT_INFO_TYPE_NMI)
     5828                              | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_ERR_CODE_VALID, 0)
     5829                              | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VALID,          1);
     5830    hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
     5831}
     5832
     5833
     5834/**
    58045835 * Sets a double-fault (\#DF) exception as pending-for-injection into the VM.
    58055836 *
     
    58125843                              | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_ERR_CODE_VALID, 1)
    58135844                              | RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VALID,          1);
    5814     hmR0VmxSetPendingEvent(pVCpu, u32IntInfo,  0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
     5845    hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
    58155846}
    58165847
     
    75597590            && !fBlockMovSS)
    75607591        {
     7592            hmR0VmxSetPendingXcptNmi(pVCpu);
     7593            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI);
    75617594            Log4Func(("Pending NMI\n"));
    7562             uint32_t u32IntInfo = X86_XCPT_NMI | VMX_EXIT_INT_INFO_VALID;
    7563             u32IntInfo         |= (VMX_EXIT_INT_INFO_TYPE_NMI << VMX_EXIT_INT_INFO_TYPE_SHIFT);
    7564 
    7565             hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
    7566             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI);
    75677595        }
    75687596        else
     
    75897617            if (RT_SUCCESS(rc))
    75907618            {
    7591                 Log4Func(("Pending external interrupt u8Interrupt=%#x\n", u8Interrupt));
    7592                 uint32_t u32IntInfo = u8Interrupt
    7593                                     | VMX_EXIT_INT_INFO_VALID
    7594                                     | (VMX_EXIT_INT_INFO_TYPE_EXT_INT << VMX_EXIT_INT_INFO_TYPE_SHIFT);
    7595 
    7596                 hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrfaultAddress */);
     7619                hmR0VmxSetPendingExtInt(pVCpu, u8Interrupt);
     7620                Log4Func(("Pending external interrupt vector %#x\n", u8Interrupt));
    75977621            }
    75987622            else if (rc == VERR_APIC_INTR_MASKED_BY_TPR)
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