VirtualBox

Changeset 74632 in vbox for trunk


Ignore:
Timestamp:
Oct 6, 2018 3:14:32 AM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 Let the caller check for VMX non-root mode and free-up the intercept functions to check
only the intercepts. Allows code to check non-root mode once in different places if a lot of intercepts need to be checked.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/cpum.h

    r74539 r74632  
    18891889{
    18901890    RT_NOREF(pVCpu);
    1891     if (pCtx->hwvirt.enmHwvirt != CPUMHWVIRT_VMX)
    1892         return false;
    1893     if (!pCtx->hwvirt.vmx.fInVmxNonRootMode)
    1894         return false;
     1891    Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_VMX);
     1892    Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode);
    18951893    Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs));
    18961894    return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32PinCtls & uPinCtl);
     
    19121910{
    19131911    RT_NOREF(pVCpu);
    1914     if (pCtx->hwvirt.enmHwvirt != CPUMHWVIRT_VMX)
    1915         return false;
    1916     if (!pCtx->hwvirt.vmx.fInVmxNonRootMode)
    1917         return false;
     1912    Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_VMX);
     1913    Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode);
    19181914    Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs));
    19191915    return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls & uProcCtl);
     
    19371933{
    19381934    RT_NOREF(pVCpu);
    1939     if (pCtx->hwvirt.enmHwvirt != CPUMHWVIRT_VMX)
    1940         return false;
    1941     if (!pCtx->hwvirt.vmx.fInVmxNonRootMode)
    1942         return false;
     1935    Assert(pCtx->hwvirt.enmHwvirt == CPUMHWVIRT_VMX);
     1936    Assert(pCtx->hwvirt.vmx.fInVmxNonRootMode);
    19431937    Assert(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs));
    19441938    return RT_BOOL(pCtx->hwvirt.vmx.CTX_SUFF(pVmcs)->u32ProcCtls2 & uProcCtl2);
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h

    r74631 r74632  
    46324632    Assert(!pVCpu->cpum.GstCtx.eflags.Bits.u1VM);
    46334633
    4634     if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
     4634    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     4635        && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
    46354636    {
    46364637        Log(("lgdt: Guest intercept -> VM-exit\n"));
     
    46834684     *       you really must know.
    46844685     */
    4685     if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
     4686    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     4687        && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
    46864688    {
    46874689        Log(("sgdt: Guest intercept -> VM-exit\n"));
     
    47974799    }
    47984800    /* Nested-guest VMX intercept. */
    4799     if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
     4801    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     4802        && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
    48004803    {
    48014804        Log(("lldt: Guest intercept -> VM-exit\n"));
     
    49214924IEM_CIMPL_DEF_2(iemCImpl_sldt_reg, uint8_t, iGReg, uint8_t, enmEffOpSize)
    49224925{
    4923     if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
     4926    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     4927        && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
    49244928    {
    49254929        Log(("sldt: Guest intercept -> VM-exit\n"));
     
    49814985        return iemRaiseGeneralProtectionFault0(pVCpu);
    49824986    }
    4983     if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
     4987    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     4988        && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
    49844989    {
    49854990        Log(("ltr: Guest intercept -> VM-exit\n"));
     
    50975102IEM_CIMPL_DEF_2(iemCImpl_str_reg, uint8_t, iGReg, uint8_t, enmEffOpSize)
    50985103{
    5099     if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
     5104    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     5105        && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
    51005106    {
    51015107        Log(("str_reg: Guest intercept -> VM-exit\n"));
     
    51275133IEM_CIMPL_DEF_2(iemCImpl_str_mem, uint8_t, iEffSeg, RTGCPTR, GCPtrEffDst)
    51285134{
    5129     if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
     5135    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     5136        && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_DESC_TABLE_EXIT))
    51305137    {
    51315138        Log(("str_mem: Guest intercept -> VM-exit\n"));
     
    60856092
    60866093#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    6087     if (IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_INVLPG_EXIT))
     6094    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     6095        && IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_INVLPG_EXIT))
    60886096    {
    60896097        Log(("invlpg: Guest intercept (%RGp) -> VM-exit\n", GCPtrPage));
     
    61626170     *        higher or lower priority than a VM-exit, we assume higher for the time
    61636171     *        being. */
    6164     if (IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_INVLPG_EXIT))
     6172    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     6173        && IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_INVLPG_EXIT))
    61656174    {
    61666175        Log(("invpcid: Guest intercept -> #VM-exit\n"));
     
    63166325    }
    63176326
    6318     if (IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_RDTSC_EXIT))
     6327    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     6328        && IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_RDTSC_EXIT))
    63196329    {
    63206330        Log(("rdtsc: Guest intercept -> VM-exit\n"));
     
    63656375    }
    63666376
    6367     if (IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_RDTSCP))
     6377    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     6378        && IEM_VMX_IS_PROCCTLS2_SET(pVCpu, VMX_PROC_CTLS2_RDTSCP))
    63686379    {
    63696380        Log(("rdtscp: Guest intercept -> VM-exit\n"));
     
    64126423        return iemRaiseGeneralProtectionFault0(pVCpu);
    64136424
    6414     if (IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_RDPMC_EXIT))
     6425    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     6426        && IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_RDPMC_EXIT))
    64156427    {
    64166428        Log(("rdpmc: Guest intercept -> VM-exit\n"));
     
    68716883        return iemRaiseGeneralProtectionFault0(pVCpu);
    68726884
    6873     if (IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_HLT_EXIT))
     6885    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     6886        && IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_HLT_EXIT))
    68746887    {
    68756888        Log2(("hlt: Guest intercept -> VM-exit\n"));
     
    69136926     * See Intel spec. 25.1.1 "Relative Priority of Faults and VM Exits".
    69146927     */
    6915     if (IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_MONITOR_EXIT))
     6928    if (   IEM_VMX_IS_NON_ROOT_MODE(pVCpu)
     6929        && IEM_VMX_IS_PROCCTLS_SET(pVCpu, VMX_PROC_CTLS_MONITOR_EXIT))
    69166930    {
    69176931        Log2(("monitor: Guest intercept -> #VMEXIT\n"));
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r74630 r74632  
    456456        return VERR_VMX_VMEXIT_FAILED; \
    457457    } while (0)
    458 
    459458
    460459
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