VirtualBox

Ignore:
Timestamp:
Jul 28, 2016 9:11:13 PM (8 years ago)
Author:
vboxsync
Message:

GIM: Please refrain from using 'c' as 'const', 'c' always means 'count of' and make variables like 'pcRegion' very very confusing. The compiler will tell you if you try access a const variable, don't worry. Fixed unused variable warnings/

File:
1 edited

Legend:

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

    r62478 r62641  
    180180static void   gimR3HvTermHypercallSupport(PVM pVM);
    181181static int    gimR3HvInitDebugSupport(PVM pVM);
     182#if 0 /** @todo currently unused, which is probably very wrong */
    182183static void   gimR3HvTermDebugSupport(PVM pVM);
     184#endif
    183185
    184186
     
    319321    Assert((pHv->uBaseFeat & (GIM_HV_BASE_FEAT_HYPERCALL_MSRS | GIM_HV_BASE_FEAT_VP_ID_MSR))
    320322                          == (GIM_HV_BASE_FEAT_HYPERCALL_MSRS | GIM_HV_BASE_FEAT_VP_ID_MSR));
     323#ifdef VBOX_STRICT
    321324    for (unsigned i = 0; i < RT_ELEMENTS(pHv->aMmio2Regions); i++)
    322325    {
    323         PCGIMMMIO2REGION pcCur = &pHv->aMmio2Regions[i];
    324         Assert(!pcCur->fRCMapping);
    325         Assert(!pcCur->fMapped);
    326         Assert(pcCur->GCPhysPage == NIL_RTGCPHYS);
    327     }
     326        PCGIMMMIO2REGION pCur = &pHv->aMmio2Regions[i];
     327        Assert(!pCur->fRCMapping);
     328        Assert(!pCur->fMapped);
     329        Assert(pCur->GCPhysPage == NIL_RTGCPHYS);
     330    }
     331#endif
    328332
    329333    /*
     
    660664 * @returns VBox status code.
    661665 * @param   pVM     The cross context VM structure.
    662  * @param   pSSM    Pointer to the SSM handle.
     666 * @param   pSSM    The saved state handle.
    663667 */
    664668VMMR3_INT_DECL(int) gimR3HvSave(PVM pVM, PSSMHANDLE pSSM)
    665669{
    666     PCGIMHV pcHv = &pVM->gim.s.u.Hv;
     670    PCGIMHV pHv = &pVM->gim.s.u.Hv;
    667671
    668672    /*
     
    674678     * Save per-VM MSRs.
    675679     */
    676     SSMR3PutU64(pSSM, pcHv->u64GuestOsIdMsr);
    677     SSMR3PutU64(pSSM, pcHv->u64HypercallMsr);
    678     SSMR3PutU64(pSSM, pcHv->u64TscPageMsr);
     680    SSMR3PutU64(pSSM, pHv->u64GuestOsIdMsr);
     681    SSMR3PutU64(pSSM, pHv->u64HypercallMsr);
     682    SSMR3PutU64(pSSM, pHv->u64TscPageMsr);
    679683
    680684    /*
    681685     * Save Hyper-V features / capabilities.
    682686     */
    683     SSMR3PutU32(pSSM, pcHv->uBaseFeat);
    684     SSMR3PutU32(pSSM, pcHv->uPartFlags);
    685     SSMR3PutU32(pSSM, pcHv->uPowMgmtFeat);
    686     SSMR3PutU32(pSSM, pcHv->uMiscFeat);
    687     SSMR3PutU32(pSSM, pcHv->uHyperHints);
    688     SSMR3PutU32(pSSM, pcHv->uHyperCaps);
     687    SSMR3PutU32(pSSM, pHv->uBaseFeat);
     688    SSMR3PutU32(pSSM, pHv->uPartFlags);
     689    SSMR3PutU32(pSSM, pHv->uPowMgmtFeat);
     690    SSMR3PutU32(pSSM, pHv->uMiscFeat);
     691    SSMR3PutU32(pSSM, pHv->uHyperHints);
     692    SSMR3PutU32(pSSM, pHv->uHyperCaps);
    689693
    690694    /*
    691695     * Save the Hypercall region.
    692696     */
    693     PCGIMMMIO2REGION pcRegion = &pcHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX];
    694     SSMR3PutU8(pSSM,     pcRegion->iRegion);
    695     SSMR3PutBool(pSSM,   pcRegion->fRCMapping);
    696     SSMR3PutU32(pSSM,    pcRegion->cbRegion);
    697     SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage);
    698     SSMR3PutStrZ(pSSM,   pcRegion->szDescription);
     697    PCGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX];
     698    SSMR3PutU8(pSSM,     pRegion->iRegion);
     699    SSMR3PutBool(pSSM,   pRegion->fRCMapping);
     700    SSMR3PutU32(pSSM,    pRegion->cbRegion);
     701    SSMR3PutGCPhys(pSSM, pRegion->GCPhysPage);
     702    SSMR3PutStrZ(pSSM,   pRegion->szDescription);
    699703
    700704    /*
    701705     * Save the reference TSC region.
    702706     */
    703     pcRegion = &pcHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];
    704     SSMR3PutU8(pSSM,     pcRegion->iRegion);
    705     SSMR3PutBool(pSSM,   pcRegion->fRCMapping);
    706     SSMR3PutU32(pSSM,    pcRegion->cbRegion);
    707     SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage);
    708     SSMR3PutStrZ(pSSM,   pcRegion->szDescription);
     707    pRegion = &pHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];
     708    SSMR3PutU8(pSSM,     pRegion->iRegion);
     709    SSMR3PutBool(pSSM,   pRegion->fRCMapping);
     710    SSMR3PutU32(pSSM,    pRegion->cbRegion);
     711    SSMR3PutGCPhys(pSSM, pRegion->GCPhysPage);
     712    SSMR3PutStrZ(pSSM,   pRegion->szDescription);
    709713    /* Save the TSC sequence so we can bump it on restore (as the CPU frequency/offset may change). */
    710714    uint32_t uTscSequence = 0;
    711     if (   pcRegion->fMapped
    712         && MSR_GIM_HV_REF_TSC_IS_ENABLED(pcHv->u64TscPageMsr))
    713     {
    714         PCGIMHVREFTSC pcRefTsc = (PCGIMHVREFTSC)pcRegion->pvPageR3;
    715         uTscSequence = pcRefTsc->u32TscSequence;
     715    if (   pRegion->fMapped
     716        && MSR_GIM_HV_REF_TSC_IS_ENABLED(pHv->u64TscPageMsr))
     717    {
     718        PCGIMHVREFTSC pRefTsc = (PCGIMHVREFTSC)pRegion->pvPageR3;
     719        uTscSequence = pRefTsc->u32TscSequence;
    716720    }
    717721    SSMR3PutU32(pSSM, uTscSequence);
     
    720724     * Save debug support data.
    721725     */
    722     SSMR3PutU64(pSSM, pcHv->uDbgPendingBufferMsr);
    723     SSMR3PutU64(pSSM, pcHv->uDbgSendBufferMsr);
    724     SSMR3PutU64(pSSM, pcHv->uDbgRecvBufferMsr);
    725     SSMR3PutU64(pSSM, pcHv->uDbgStatusMsr);
    726     SSMR3PutU32(pSSM, pcHv->enmDbgReply);
    727     SSMR3PutU32(pSSM, pcHv->uDbgBootpXId);
    728     SSMR3PutU32(pSSM, pcHv->DbgGuestIp4Addr.u);
     726    SSMR3PutU64(pSSM, pHv->uDbgPendingBufferMsr);
     727    SSMR3PutU64(pSSM, pHv->uDbgSendBufferMsr);
     728    SSMR3PutU64(pSSM, pHv->uDbgRecvBufferMsr);
     729    SSMR3PutU64(pSSM, pHv->uDbgStatusMsr);
     730    SSMR3PutU32(pSSM, pHv->enmDbgReply);
     731    SSMR3PutU32(pSSM, pHv->uDbgBootpXId);
     732    SSMR3PutU32(pSSM, pHv->DbgGuestIp4Addr.u);
    729733
    730734    for (VMCPUID i = 0; i < pVM->cCpus; i++)
     
    735739    }
    736740
    737     return SSMR3PutU8(pSSM, UINT8_MAX);;
     741    return SSMR3PutU8(pSSM, UINT8_MAX);
    738742}
    739743
     
    744748 * @returns VBox status code.
    745749 * @param   pVM             The cross context VM structure.
    746  * @param   pSSM            Pointer to the SSM handle.
    747  * @param   uSSMVersion     The GIM saved-state version.
    748  */
    749 VMMR3_INT_DECL(int) gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion)
     750 * @param   pSSM            The saved state handle.
     751 */
     752VMMR3_INT_DECL(int) gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM)
    750753{
    751754    /*
     
    758761        && uHvSavedStatVersion != GIM_HV_SAVED_STATE_VERSION_PRE_DEBUG)
    759762        return SSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS,
    760                                  N_("Unsupported Hyper-V saved-state version %u (current %u)!"), uHvSavedStatVersion,
    761                                  GIM_HV_SAVED_STATE_VERSION);
     763                                 N_("Unsupported Hyper-V saved-state version %u (current %u)!"),
     764                                 uHvSavedStatVersion, GIM_HV_SAVED_STATE_VERSION);
    762765
    763766    /*
     
    13421345static int gimR3HvInitHypercallSupport(PVM pVM)
    13431346{
    1344     int rc = VINF_SUCCESS;
    13451347    PGIMHV pHv = &pVM->gim.s.u.Hv;
    13461348    pHv->pbHypercallIn = (uint8_t *)RTMemAllocZ(GIM_HV_PAGE_SIZE);
     
    13931395
    13941396
     1397#if 0 /** @todo currently unused, which is probably very wrong */
    13951398/**
    13961399 * Terminates Hyper-V guest debug support.
     
    14071410    }
    14081411}
     1412#endif
    14091413
    14101414
     
    18641868    if (fFlags & ~GIM_HV_DEBUG_POST_OPTIONS_MASK))
    18651869        rcHv = GIM_HV_STATUS_INVALID_PARAMETER;
     1870#else
     1871    RT_NOREF1(fFlags);
    18661872#endif
    18671873    if (cbWrite > GIM_HV_DEBUG_MAX_DATA_SIZE)
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