VirtualBox

Ignore:
Timestamp:
Oct 17, 2022 9:06:03 PM (2 years ago)
Author:
vboxsync
Message:

VMM/CPUM,EM,HM,IEM,++: Moved VMCPU_FF_INHIBIT_INTERRUPTS and VMCPU_FF_BLOCK_NMIS to CPUMCTX::fInhibit. Moved ldtr and tr up to the CPUMCTXCORE area in hope for better cache alignment of rip, rflags and crX register fields. bugref:9941

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-linux.cpp

    r96407 r97178  
    14761476            pVCpu->cpum.GstCtx.rip = pRun->s.regs.regs.rip;
    14771477
    1478         if (KvmEvents.interrupt.shadow)
    1479             EMSetInhibitInterruptsPC(pVCpu, pVCpu->cpum.GstCtx.rip);
    1480         else if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
    1481             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
    1482 
    1483         if (KvmEvents.nmi.masked)
    1484             VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
    1485         else if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
    1486             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
     1478        CPUMUpdateInterruptShadowEx(&pVCpu->cpum.GstCtx, KvmEvents.interrupt.shadow != 0, pVCpu->cpum.GstCtx.rip);
     1479        CPUMUpdateInterruptInhibitingByNmi(&pVCpu->cpum.GstCtx, KvmEvents.nmi.masked != 0);
    14871480
    14881481        if (KvmEvents.interrupt.injected)
     
    18691862
    18701863        KvmEvents.flags = KVM_VCPUEVENT_VALID_SHADOW;
    1871         if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
    1872         {
    1873             if (pRun->s.regs.regs.rip == EMGetInhibitInterruptsPC(pVCpu))
    1874                 KvmEvents.interrupt.shadow = KVM_X86_SHADOW_INT_MOV_SS | KVM_X86_SHADOW_INT_STI;
    1875             else
    1876                 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
    1877         }
     1864        if (!CPUMIsInInterruptShadowWithUpdate(&pVCpu->cpum.GstCtx))
     1865        { /* probably likely */ }
     1866        else
     1867            KvmEvents.interrupt.shadow = KVM_X86_SHADOW_INT_MOV_SS | KVM_X86_SHADOW_INT_STI;
    18781868
    18791869        /* No flag - this is updated unconditionally. */
    1880         if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
    1881             KvmEvents.nmi.masked = 1;
     1870        KvmEvents.nmi.masked = CPUMAreInterruptsInhibitedByNmi(&pVCpu->cpum.GstCtx);
    18821871
    18831872        if (TRPMHasTrap(pVCpu))
     
    20592048    KvmEvents.flags |= KVM_VCPUEVENT_VALID_SHADOW;
    20602049    if (!(pVCpu->cpum.GstCtx.fExtrn & CPUMCTX_EXTRN_INHIBIT_INT))
    2061     {
    2062         if (!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
    2063             KvmEvents.interrupt.shadow = 0;
    2064         else if (EMGetInhibitInterruptsPC(pVCpu) == pRun->s.regs.regs.rip)
    2065             KvmEvents.interrupt.shadow = KVM_X86_SHADOW_INT_MOV_SS | KVM_X86_SHADOW_INT_STI;
    2066         else
    2067         {
    2068             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
    2069             KvmEvents.interrupt.shadow = 0;
    2070         }
    2071     }
    2072     else if (KvmEvents.interrupt.shadow)
    2073         EMSetInhibitInterruptsPC(pVCpu, pRun->s.regs.regs.rip);
    2074     else if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
    2075         VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
     2050        KvmEvents.interrupt.shadow = !CPUMIsInInterruptShadowWithUpdate(&pVCpu->cpum.GstCtx) ? 0
     2051                                   : KVM_X86_SHADOW_INT_MOV_SS | KVM_X86_SHADOW_INT_STI;
     2052    else
     2053        CPUMUpdateInterruptShadowEx(&pVCpu->cpum.GstCtx, KvmEvents.interrupt.shadow != 0, pRun->s.regs.regs.rip);
    20762054
    20772055    if (!(pVCpu->cpum.GstCtx.fExtrn & CPUMCTX_EXTRN_INHIBIT_NMI))
    2078         KvmEvents.nmi.masked = VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS) ? 1 : 0;
    2079     else if (KvmEvents.nmi.masked)
    2080         VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
    2081     else if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
    2082         VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
     2056        KvmEvents.nmi.masked = CPUMAreInterruptsInhibitedByNmi(&pVCpu->cpum.GstCtx);
     2057    else
     2058        CPUMUpdateInterruptInhibitingByNmi(&pVCpu->cpum.GstCtx, KvmEvents.nmi.masked != 0);
    20832059
    20842060    /* KVM will own the INT + NMI inhibit state soon: */
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