VirtualBox

Changeset 78240 in vbox for trunk/src


Ignore:
Timestamp:
Apr 22, 2019 7:36:26 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Const bits.

File:
1 edited

Legend:

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

    r78238 r78240  
    616616 * @param   pVCpu   The cross context virtual CPU structure.
    617617 */
    618 DECL_FORCE_INLINE(uint64_t) hmR0VmxGetFixedCr0Mask(PVMCPU pVCpu)
     618DECL_FORCE_INLINE(uint64_t) hmR0VmxGetFixedCr0Mask(PCVMCPU pVCpu)
    619619{
    620620    /*
     
    645645 * @param   pVCpu   The cross context virtual CPU structure.
    646646 */
    647 DECL_FORCE_INLINE(uint64_t) hmR0VmxGetFixedCr4Mask(PVMCPU pVCpu)
     647DECL_FORCE_INLINE(uint64_t) hmR0VmxGetFixedCr4Mask(PCVMCPU pVCpu)
    648648{
    649649    /*
     
    11471147
    11481148    /* Paranoid: Disable interrupts as, in theory, interrupt handlers might mess with CR4. */
    1149     RTCCUINTREG fEFlags = ASMIntDisableFlags();
     1149    RTCCUINTREG const fEFlags = ASMIntDisableFlags();
    11501150
    11511151    /* Enable the VMX bit in CR4 if necessary. */
    1152     RTCCUINTREG uOldCr4 = SUPR0ChangeCR4(X86_CR4_VMXE, RTCCUINTREG_MAX);
     1152    RTCCUINTREG const uOldCr4 = SUPR0ChangeCR4(X86_CR4_VMXE, RTCCUINTREG_MAX);
    11531153
    11541154    /* Enter VMX root mode. */
     
    11571157    {
    11581158        if (!(uOldCr4 & X86_CR4_VMXE))
    1159             SUPR0ChangeCR4(0, ~X86_CR4_VMXE);
     1159            SUPR0ChangeCR4(0 /* fOrMask */, ~X86_CR4_VMXE);
    11601160
    11611161        if (pVM)
     
    11791179
    11801180    /* Paranoid: Disable interrupts as, in theory, interrupts handlers might mess with CR4. */
    1181     RTCCUINTREG fEFlags = ASMIntDisableFlags();
     1181    RTCCUINTREG const fEFlags = ASMIntDisableFlags();
    11821182
    11831183    /* If we're for some reason not in VMX root mode, then don't leave it. */
    1184     RTCCUINTREG uHostCR4 = ASMGetCR4();
     1184    RTCCUINTREG const uHostCR4 = ASMGetCR4();
    11851185
    11861186    int rc;
     
    11891189        /* Exit VMX root mode and clear the VMX bit in CR4. */
    11901190        VMXDisable();
    1191         SUPR0ChangeCR4(0, ~X86_CR4_VMXE);
     1191        SUPR0ChangeCR4(0 /* fOrMask */, ~X86_CR4_VMXE);
    11921192        rc = VINF_SUCCESS;
    11931193    }
     
    18651865 * @remarks No-long-jump zone!!!
    18661866 */
    1867 static void hmR0VmxUpdateAutoLoadHostMsrs(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     1867static void hmR0VmxUpdateAutoLoadHostMsrs(PCVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
    18681868{
    18691869    PVMXAUTOMSR pHostMsrLoad = (PVMXAUTOMSR)pVmcsInfo->pvHostMsrLoad;
     
    19271927 * @param   idMsr       The MSR to check.
    19281928 */
    1929 static bool hmR0VmxIsLazyGuestMsr(PVMCPU pVCpu, uint32_t idMsr)
     1929static bool hmR0VmxIsLazyGuestMsr(PCVMCPU pVCpu, uint32_t idMsr)
    19301930{
    19311931    NOREF(pVCpu);
     
    21182118 * @param   pVmcsInfo   The VMCS info. object.
    21192119 */
    2120 static void hmR0VmxCheckHostEferMsr(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     2120static void hmR0VmxCheckHostEferMsr(PCVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
    21212121{
    21222122    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    41644164 * @remarks No-long-jump zone!!!
    41654165 */
    4166 static bool hmR0VmxShouldSwapEferMsr(PVMCPU pVCpu)
     4166static bool hmR0VmxShouldSwapEferMsr(PCVMCPU pVCpu)
    41674167{
    41684168#ifdef HMVMX_ALWAYS_SWAP_EFER
     
    41704170    return true;
    41714171#else
    4172     PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     4172    PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    41734173#if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS)
    41744174    /* For 32-bit hosts running 64-bit guests, we always swap EFER MSR in the world-switcher. Nothing to do here. */
     
    65016501    uint64_t     uTscOffset;
    65026502    PVM          pVM = pVCpu->CTX_SUFF(pVM);
    6503     PVMXVMCSINFO pVmcsInfo = hmGetVmxActiveVmcsInfo(pVCpu);;
     6503    PVMXVMCSINFO pVmcsInfo = hmGetVmxActiveVmcsInfo(pVCpu);
    65046504
    65056505    if (pVM->hm.s.vmx.fUsePreemptTimer)
     
    98619861 * @param   pVmcsInfoGst        The guest VMCS info. object.
    98629862 */
    9863 static void hmR0VmxMergeMsrBitmapNested(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfoNstGst, PCVMXVMCSINFO pVmcsInfoGst)
     9863static void hmR0VmxMergeMsrBitmapNested(PCVMCPU pVCpu, PVMXVMCSINFO pVmcsInfoNstGst, PCVMXVMCSINFO pVmcsInfoGst)
    98649864{
    98659865    uint64_t const *pu64MsrBitmapNstGst = (uint64_t const *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap);
     
    1280112801    AssertRCReturn(rc, rc);
    1280212802
    12803     uint32_t uIntType = VMX_EXIT_INT_INFO_TYPE(pVmxTransient->uExitIntInfo);
     12803    uint32_t const uIntType = VMX_EXIT_INT_INFO_TYPE(pVmxTransient->uExitIntInfo);
    1280412804    Assert(   !(pVmcsInfo->u32ExitCtls & VMX_EXIT_CTLS_ACK_EXT_INT)
    1280512805           && uIntType != VMX_EXIT_INT_INFO_TYPE_EXT_INT);
     
    1283412834    }
    1283512835
    12836     uint32_t uExitIntInfo = pVmxTransient->uExitIntInfo;
    12837     uint32_t uVector      = VMX_EXIT_INT_INFO_VECTOR(uExitIntInfo);
     12836    uint32_t const uExitIntInfo = pVmxTransient->uExitIntInfo;
     12837    uint32_t const uVector      = VMX_EXIT_INT_INFO_VECTOR(uExitIntInfo);
    1283812838    switch (uIntType)
    1283912839    {
     
    1477014770
    1477114771    /* Refer Intel spec. Table 27-1. "Exit Qualifications for debug exceptions" for the format. */
    14772     uint64_t uDR6 = X86_DR6_INIT_VAL;
    14773     uDR6         |= (pVmxTransient->uExitQual & (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3 | X86_DR6_BD | X86_DR6_BS));
     14772    uint64_t const uDR6 = X86_DR6_INIT_VAL
     14773                        | (pVmxTransient->uExitQual & (  X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3
     14774                                                       | X86_DR6_BD | X86_DR6_BS));
    1477414775
    1477514776    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     
    1478114782         * The exception was for the guest.  Update DR6, DR7.GD and
    1478214783         * IA32_DEBUGCTL.LBR before forwarding it.
    14783          * (See Intel spec. 27.1 "Architectural State before a VM-Exit".)
     14784         * See Intel spec. 27.1 "Architectural State before a VM-Exit".
    1478414785         */
    1478514786        VMMRZCallRing3Disable(pVCpu);
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