VirtualBox

Changeset 97286 in vbox for trunk/src


Ignore:
Timestamp:
Oct 24, 2022 10:15:44 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154277
Message:

VMM/CPUM,IEM: Moved the CPUMCTX_INHIBIT_XXX flags into reserved EFLAGS space.

Location:
trunk/src/VBox/VMM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r97231 r97286  
    197197VMM_INT_DECL(bool) CPUMAssertGuestRFlagsCookie(PVM pVM, PVMCPU pVCpu)
    198198{
    199     AssertLogRelMsgReturn(      (pVCpu->cpum.s.Guest.rflags.uBoth & ~(uint64_t)(X86_EFL_LIVE_MASK | X86_EFL_RA1_MASK))
     199    AssertLogRelMsgReturn(      (  pVCpu->cpum.s.Guest.rflags.uBoth
     200                                 & ~(uint64_t)(CPUMX86EFLAGS_HW_MASK_64 | CPUMX86EFLAGS_INT_MASK_64))
    200201                             == pVM->cpum.s.fReservedRFlagsCookie
    201                           && (pVCpu->cpum.s.Guest.rflags.uBoth & X86_EFL_RA1_MASK) == X86_EFL_RA1_MASK,
     202                          && (pVCpu->cpum.s.Guest.rflags.uBoth & X86_EFL_RA1_MASK) == X86_EFL_RA1_MASK
     203                          && (pVCpu->cpum.s.Guest.rflags.uBoth & X86_EFL_RAZ_MASK & CPUMX86EFLAGS_HW_MASK_64) == 0,
    202204                          ("rflags=%#RX64 vs fReservedRFlagsCookie=%#RX64\n",
    203205                           pVCpu->cpum.s.Guest.rflags.uBoth, pVM->cpum.s.fReservedRFlagsCookie),
     
    19511953         * or raw-mode). Hence we use the function below which handles the details.
    19521954         */
    1953         if (   pVCpu->cpum.s.Guest.fInhibit == 0
    1954             || (   !(pVCpu->cpum.s.Guest.fInhibit & CPUMCTX_INHIBIT_NMI)
     1955        if (   !(pVCpu->cpum.s.Guest.eflags.uBoth & CPUMCTX_INHIBIT_ALL_MASK)
     1956            || (   !(pVCpu->cpum.s.Guest.eflags.uBoth & CPUMCTX_INHIBIT_NMI)
    19551957                && pVCpu->cpum.s.Guest.uRipInhibitInt != pVCpu->cpum.s.Guest.rip))
    19561958        {
     
    19831985         *        NONMASKABLE INTERRUPT (NMI)" in SDM 3A seems pretty clear to me.
    19841986         */
    1985         if (!(pVCpu->cpum.s.Guest.fInhibit & CPUMCTX_INHIBIT_NMI))
     1987        if (!(pVCpu->cpum.s.Guest.eflags.uBoth & CPUMCTX_INHIBIT_NMI))
    19861988            return CPUMINTERRUPTIBILITY_INT_INHIBITED;
    19871989        return CPUMINTERRUPTIBILITY_NMI_INHIBIT;
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp

    r97222 r97286  
    324324         * Restore the subset of the inhibit flags that were preserved.
    325325         */
    326         pVCpu->cpum.GstCtx.fInhibit |= pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit;
     326        pVCpu->cpum.GstCtx.eflags.uBoth |= pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit;
    327327
    328328        if (rcStrict == VINF_SUCCESS)
     
    729729         * preserve VMCPU_FF_INHIBIT_INTERRUPTS.
    730730         */
    731         pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit = pVCpu->cpum.GstCtx.fInhibit & CPUMCTX_INHIBIT_NMI;
    732         pVCpu->cpum.GstCtx.fInhibit            &=                              ~CPUMCTX_INHIBIT_NMI;
     731        pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit = pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_INHIBIT_NMI;
     732        pVCpu->cpum.GstCtx.eflags.uBoth        &=                                  ~CPUMCTX_INHIBIT_NMI;
    733733
    734734        /*
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp

    r97263 r97286  
    12431243     * the nested-guest.
    12441244     */
    1245     pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit = pVCpu->cpum.GstCtx.fInhibit & CPUMCTX_INHIBIT_NMI;
     1245    pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit = pVCpu->cpum.GstCtx.eflags.uBoth & CPUMCTX_INHIBIT_NMI;
    12461246}
    12471247
     
    12571257     *        If there is some other code doing that already, it would be great
    12581258     *        to point to it here... */
    1259     pVCpu->cpum.GstCtx.fInhibit |= pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit;
     1259    pVCpu->cpum.GstCtx.eflags.uBoth        |= pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit;
    12601260    pVCpu->cpum.GstCtx.hwvirt.fSavedInhibit = 0;
    12611261}
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r97265 r97286  
    162162
    163163/** For saved state only: Block injection of non-maskable interrupts to the guest.
    164  * @note This flag was moved to CPUMCTX::fInhibit in v7.0.2. */
     164 * @note This flag was moved to CPUMCTX::eflags.uBoth in v7.0.4. */
    165165#define CPUM_OLD_VMCPU_FF_BLOCK_NMIS            RT_BIT_64(25)
    166166
     
    31503150 *
    31513151 * @param   pszEFlags   Where to write the mnemonics. (Assumes sufficient buffer space.)
    3152  * @param   efl         The EFLAGS value with fInhibit in bits 31:24.
     3152 * @param   efl         The EFLAGS value with both guest hardware and VBox
     3153 *                      internal bits included.
    31533154 */
    31543155static void cpumR3InfoFormatFlags(char *pszEFlags, uint32_t efl)
     
    31773178        { "po", "pe", X86_EFL_PF },
    31783179        { "cy", "nc", X86_EFL_CF },
    3179         { "inh-ss",  NULL, (uint32_t)CPUMCTX_INHIBIT_SHADOW_SS  << 24 },
    3180         { "inh-sti", NULL, (uint32_t)CPUMCTX_INHIBIT_SHADOW_STI << 24 },
    3181         { "inh-nmi", NULL, (uint32_t)CPUMCTX_INHIBIT_NMI        << 24 },
     3180        { "inh-ss",  NULL, CPUMCTX_INHIBIT_SHADOW_SS },
     3181        { "inh-sti", NULL, CPUMCTX_INHIBIT_SHADOW_STI },
     3182        { "inh-nmi", NULL, CPUMCTX_INHIBIT_NMI },
    31823183    };
    31833184    char *psz = pszEFlags;
     
    32123213     * Format the EFLAGS.
    32133214     */
    3214     uint32_t efl = pCtx->eflags.u;
    32153215    char szEFlags[80];
    3216     cpumR3InfoFormatFlags(&szEFlags[0], efl | ((uint32_t)pCtx->fInhibit << 24));
     3216    cpumR3InfoFormatFlags(&szEFlags[0], pCtx->eflags.uBoth);
    32173217
    32183218    /*
    32193219     * Format the registers.
    32203220     */
     3221    uint32_t const efl = pCtx->eflags.u;
    32213222    switch (enmType)
    32223223    {
  • trunk/src/VBox/VMM/include/CPUMInternal.mac

    r97213 r97286  
    190190    .Guest.eip                  resq    1
    191191    .Guest.eflags               resq    1
    192     .Guest.fInhibit             resb    1
     192    .Guest.abPadding            resb    8
    193193    alignb 8
    194194    .Guest.uRipInhibitInt       resq    1
Note: See TracChangeset for help on using the changeset viewer.

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