VirtualBox

Changeset 81237 in vbox


Ignore:
Timestamp:
Oct 14, 2019 6:43:34 AM (5 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Get rid of hmR0VmxSelectVMRunHandler and merge it into hmR0VmxExportGuestEntryExitCtls only when the VM-entry/exit controls change.

File:
1 edited

Legend:

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

    r81232 r81237  
    46724672    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_VMX_ENTRY_EXIT_CTLS)
    46734673    {
    4674         PVMCC          pVM = pVCpu->CTX_SUFF(pVM);
    4675         PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
     4674        PVMCC        pVM            = pVCpu->CTX_SUFF(pVM);
     4675        PVMXVMCSINFO pVmcsInfo      = pVmxTransient->pVmcsInfo;
     4676        bool const   fGstInLongMode = CPUMIsGuestInLongModeEx(&pVCpu->cpum.GstCtx);
     4677
     4678        /*
     4679         * VMRUN function.
     4680         */
     4681        {
     4682            /* If the guest is in long mode, use the 64-bit guest handler, else the 32-bit guest handler.
     4683             * The host is always 64-bit since we no longer support 32-bit hosts.
     4684             */
     4685            if (fGstInLongMode)
     4686            {
     4687#ifndef VBOX_WITH_64_BITS_GUESTS
     4688                return VERR_PGM_UNSUPPORTED_SHADOW_PAGING_MODE;
     4689#else
     4690                Assert(pVM->hm.s.fAllow64BitGuests);                          /* Guaranteed by hmR3InitFinalizeR0(). */
     4691                pVmcsInfo->pfnStartVM = VMXR0StartVM64;
     4692#endif
     4693            }
     4694            else
     4695                pVmcsInfo->pfnStartVM = VMXR0StartVM32;
     4696        }
    46764697
    46774698        /*
     
    47004721             * here rather than while merging the guest VMCS controls.
    47014722             */
    4702             if (CPUMIsGuestInLongModeEx(&pVCpu->cpum.GstCtx))
     4723            if (fGstInLongMode)
    47034724            {
    47044725                Assert(pVCpu->cpum.GstCtx.msrEFER & MSR_K6_EFER_LME);
     
    65176538    }
    65186539
    6519     return VINF_SUCCESS;
    6520 }
    6521 
    6522 
    6523 /**
    6524  * Selects up the appropriate function to run guest code.
    6525  *
    6526  * @returns VBox status code.
    6527  * @param   pVCpu           The cross context virtual CPU structure.
    6528  * @param   pVmxTransient   The VMX-transient structure.
    6529  *
    6530  * @remarks No-long-jump zone!!!
    6531  */
    6532 static int hmR0VmxSelectVMRunHandler(PVMCPUCC pVCpu, PCVMXTRANSIENT pVmxTransient)
    6533 {
    6534     PCCPUMCTX    pCtx      = &pVCpu->cpum.GstCtx;
    6535     PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
    6536 
    6537     if (CPUMIsGuestInLongModeEx(pCtx))
    6538     {
    6539 #ifndef VBOX_WITH_64_BITS_GUESTS
    6540         return VERR_PGM_UNSUPPORTED_SHADOW_PAGING_MODE;
    6541 #else
    6542         Assert(pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests);    /* Guaranteed by hmR3InitFinalizeR0(). */
    6543         /* Guest is in long mode, use the 64-bit handler (host is 64-bit). */
    6544         pVmcsInfo->pfnStartVM = VMXR0StartVM64;
    6545 #endif
    6546     }
    6547     else
    6548     {
    6549         /* Guest is not in long mode, use the 32-bit handler. */
    6550         pVmcsInfo->pfnStartVM = VMXR0StartVM32;
    6551     }
    6552     Assert(pVmcsInfo->pfnStartVM);
    65536540    return VINF_SUCCESS;
    65546541}
     
    90499036     * Ideally, assert that the cross-dependent bits are up-to-date at the point of using it.
    90509037     */
    9051     /** @todo r=ramshankar: Move hmR0VmxSelectVMRunHandler inside
    9052      *        hmR0VmxExportGuestEntryExitCtls and do it conditionally. There shouldn't
    9053      *        be a need to evaluate this everytime since I'm pretty sure we intercept
    9054      *        all guest paging mode changes. */
    9055     int rc = hmR0VmxSelectVMRunHandler(pVCpu, pVmxTransient);
    9056     AssertLogRelMsgRCReturn(rc, ("rc=%Rrc\n", rc), rc);
    9057 
    9058     rc = hmR0VmxExportGuestEntryExitCtls(pVCpu, pVmxTransient);
     9038    int rc = hmR0VmxExportGuestEntryExitCtls(pVCpu, pVmxTransient);
    90599039    AssertLogRelMsgRCReturn(rc, ("rc=%Rrc\n", rc), rc);
    90609040
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