VirtualBox

Changeset 72770 in vbox


Ignore:
Timestamp:
Jun 29, 2018 11:19:30 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123311
Message:

VMM/HM: Cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r72769 r72770  
    29362936                &&  !pVM->hm.s.vmx.fUnrestrictedGuest)
    29372937            {
    2938                 if (    !pVM->hm.s.fNestedPaging        /* Requires a fake PD for real *and* protected mode without paging - stored in the VMM device heap */
    2939                     ||  CPUMIsGuestInRealModeEx(pCtx))  /* Requires a fake TSS for real mode - stored in the VMM device heap */
     2938                if (   !pVM->hm.s.fNestedPaging        /* Requires a fake PD for real *and* protected mode without paging - stored in the VMM device heap */
     2939                    ||  CPUMIsGuestInRealModeEx(pCtx)) /* Requires a fake TSS for real mode - stored in the VMM device heap */
    29402940                    return false;
    29412941
     
    29472947                /* Windows XP; switch to protected mode; all selectors are marked not present in the
    29482948                 * hidden registers (possible recompiler bug; see load_seg_vm) */
     2949                /** @todo Is this supposed recompiler bug still relevant with IEM? */
    29492950                if (pCtx->cs.Attr.n.u1Present == 0)
    29502951                    return false;
     
    29642965    if (pVM->hm.s.vmx.fEnabled)
    29652966    {
    2966         uint32_t mask;
    2967 
    2968         /* if bit N is set in cr0_fixed0, then it must be set in the guest's cr0. */
    2969         mask = (uint32_t)pVM->hm.s.vmx.Msrs.u64Cr0Fixed0;
    2970         /* Note: We ignore the NE bit here on purpose; see vmmr0\hmr0.cpp for details. */
    2971         mask &= ~X86_CR0_NE;
     2967        uint32_t uCR0Mask;
     2968
     2969        /* If bit N is set in cr0_fixed0, then it must be set in the guest's cr0. */
     2970        uCR0Mask = (uint32_t)pVM->hm.s.vmx.Msrs.u64Cr0Fixed0;
     2971
     2972        /* We ignore the NE bit here on purpose; see HMR0.cpp for details. */
     2973        uCR0Mask &= ~X86_CR0_NE;
    29722974
    29732975        if (fSupportsRealMode)
    29742976        {
    2975             /* Note: We ignore the PE & PG bits here on purpose; we emulate real and protected mode without paging. */
    2976             mask &= ~(X86_CR0_PG|X86_CR0_PE);
     2977            /* We ignore the PE & PG bits here on purpose; we emulate real and protected mode without paging. */
     2978            uCR0Mask &= ~(X86_CR0_PG|X86_CR0_PE);
    29772979        }
    29782980        else
    29792981        {
    29802982            /* We support protected mode without paging using identity mapping. */
    2981             mask &= ~X86_CR0_PG;
     2983            uCR0Mask &= ~X86_CR0_PG;
    29822984        }
    2983         if ((pCtx->cr0 & mask) != mask)
     2985        if ((pCtx->cr0 & uCR0Mask) != uCR0Mask)
    29842986            return false;
    29852987
    2986         /* if bit N is cleared in cr0_fixed1, then it must be zero in the guest's cr0. */
    2987         mask = (uint32_t)~pVM->hm.s.vmx.Msrs.u64Cr0Fixed1;
    2988         if ((pCtx->cr0 & mask) != 0)
     2988        /* If bit N is cleared in cr0_fixed1, then it must be zero in the guest's cr0. */
     2989        uCR0Mask = (uint32_t)~pVM->hm.s.vmx.Msrs.u64Cr0Fixed1;
     2990        if ((pCtx->cr0 & uCR0Mask) != 0)
    29892991            return false;
    29902992
    2991         /* if bit N is set in cr4_fixed0, then it must be set in the guest's cr4. */
    2992         mask  = (uint32_t)pVM->hm.s.vmx.Msrs.u64Cr4Fixed0;
    2993         mask &= ~X86_CR4_VMXE;
    2994         if ((pCtx->cr4 & mask) != mask)
     2993        /* If bit N is set in cr4_fixed0, then it must be set in the guest's cr4. */
     2994        uCR0Mask  = (uint32_t)pVM->hm.s.vmx.Msrs.u64Cr4Fixed0;
     2995        uCR0Mask &= ~X86_CR4_VMXE;
     2996        if ((pCtx->cr4 & uCR0Mask) != uCR0Mask)
    29952997            return false;
    29962998
    2997         /* if bit N is cleared in cr4_fixed1, then it must be zero in the guest's cr4. */
    2998         mask = (uint32_t)~pVM->hm.s.vmx.Msrs.u64Cr4Fixed1;
    2999         if ((pCtx->cr4 & mask) != 0)
     2999        /* If bit N is cleared in cr4_fixed1, then it must be zero in the guest's cr4. */
     3000        uCR0Mask = (uint32_t)~pVM->hm.s.vmx.Msrs.u64Cr4Fixed1;
     3001        if ((pCtx->cr4 & uCR0Mask) != 0)
    30003002            return false;
    30013003
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