VirtualBox

Changeset 62641 in vbox for trunk/src


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/

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

Legend:

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

    r62478 r62641  
    7575static FNSSMINTSAVEEXEC  gimR3Save;
    7676static FNSSMINTLOADEXEC  gimR3Load;
    77 static FNPGMPHYSHANDLER  gimR3Mmio2WriteHandler;
    7877
    7978
     
    308307    {
    309308        case GIMPROVIDERID_HYPERV:
    310             rc = gimR3HvLoad(pVM, pSSM, uVersion);
     309            rc = gimR3HvLoad(pVM, pSSM);
    311310            AssertRCReturn(rc, rc);
    312311            break;
    313312
    314313        case GIMPROVIDERID_KVM:
    315             rc = gimR3KvmLoad(pVM, pSSM, uVersion);
     314            rc = gimR3KvmLoad(pVM, pSSM);
    316315            AssertRCReturn(rc, rc);
    317316            break;
     
    518517}
    519518
     519#if 0 /* ??? */
    520520
    521521/**
     
    530530                                                         void *pvUser)
    531531{
     532    RT_NOREF6(pVM, pVCpu, GCPhys, pvPhys, pvBuf, cbBuf);
     533    RT_NOREF3(enmAccessType, enmOrigin, pvUser);
     534
    532535    /*
    533536     * Ignore writes to the mapped MMIO2 page.
     
    538541
    539542
    540 #if 0
    541543/**
    542544 * Unmaps a registered MMIO2 region in the guest address space and removes any
     
    679681    return PGMHandlerPhysicalDeregister(pVM, pRegion->GCPhysPage);
    680682}
     683
    681684#endif
    682685
  • 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)
  • trunk/src/VBox/VMM/VMMR3/GIMKvm.cpp

    r62478 r62641  
    267267 * @returns VBox status code.
    268268 * @param   pVM     The cross context VM structure.
    269  * @param   pSSM    Pointer to the SSM handle.
     269 * @param   pSSM    The saved state handle.
    270270 */
    271271VMMR3_INT_DECL(int) gimR3KvmSave(PVM pVM, PSSMHANDLE pSSM)
    272272{
    273     PCGIMKVM pcKvm = &pVM->gim.s.u.Kvm;
     273    PCGIMKVM pKvm = &pVM->gim.s.u.Kvm;
    274274
    275275    /*
     
    283283    for (uint32_t i = 0; i < pVM->cCpus; i++)
    284284    {
    285         PCGIMKVMCPU pcKvmCpu = &pVM->aCpus[i].gim.s.u.KvmCpu;
     285        PCGIMKVMCPU pKvmCpu = &pVM->aCpus[i].gim.s.u.KvmCpu;
    286286
    287287        /* Guest may alter flags (namely GIM_KVM_SYSTEM_TIME_FLAGS_GUEST_PAUSED bit). So re-read them from guest-memory. */
    288288        GIMKVMSYSTEMTIME SystemTime;
    289289        RT_ZERO(SystemTime);
    290         if (MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(pcKvmCpu->u64SystemTimeMsr))
     290        if (MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(pKvmCpu->u64SystemTimeMsr))
    291291        {
    292             int rc = PGMPhysSimpleReadGCPhys(pVM, &SystemTime, pcKvmCpu->GCPhysSystemTime, sizeof(GIMKVMSYSTEMTIME));
     292            int rc = PGMPhysSimpleReadGCPhys(pVM, &SystemTime, pKvmCpu->GCPhysSystemTime, sizeof(GIMKVMSYSTEMTIME));
    293293            AssertRCReturn(rc, rc);
    294294        }
    295295
    296         SSMR3PutU64(pSSM, pcKvmCpu->u64SystemTimeMsr);
    297         SSMR3PutU64(pSSM, pcKvmCpu->uTsc);
    298         SSMR3PutU64(pSSM, pcKvmCpu->uVirtNanoTS);
    299         SSMR3PutGCPhys(pSSM, pcKvmCpu->GCPhysSystemTime);
    300         SSMR3PutU32(pSSM, pcKvmCpu->u32SystemTimeVersion);
     296        SSMR3PutU64(pSSM, pKvmCpu->u64SystemTimeMsr);
     297        SSMR3PutU64(pSSM, pKvmCpu->uTsc);
     298        SSMR3PutU64(pSSM, pKvmCpu->uVirtNanoTS);
     299        SSMR3PutGCPhys(pSSM, pKvmCpu->GCPhysSystemTime);
     300        SSMR3PutU32(pSSM, pKvmCpu->u32SystemTimeVersion);
    301301        SSMR3PutU8(pSSM, SystemTime.fFlags);
    302302    }
     
    305305     * Save per-VM data.
    306306     */
    307     SSMR3PutU64(pSSM, pcKvm->u64WallClockMsr);
    308     return SSMR3PutU32(pSSM, pcKvm->uBaseFeat);
     307    SSMR3PutU64(pSSM, pKvm->u64WallClockMsr);
     308    return SSMR3PutU32(pSSM, pKvm->uBaseFeat);
    309309}
    310310
     
    315315 * @returns VBox status code.
    316316 * @param   pVM             The cross context VM structure.
    317  * @param   pSSM            Pointer to the SSM handle.
    318  * @param   uSSMVersion     The GIM saved-state version.
    319  */
    320 VMMR3_INT_DECL(int) gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion)
     317 * @param   pSSM            The saved state handle.
     318 */
     319VMMR3_INT_DECL(int) gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM)
    321320{
    322321    /*
     
    328327    if (uKvmSavedStatVersion != GIM_KVM_SAVED_STATE_VERSION)
    329328        return SSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS,
    330                                  N_("Unsupported KVM saved-state version %u (expected %u)."), uKvmSavedStatVersion,
    331                                  GIM_KVM_SAVED_STATE_VERSION);
     329                                 N_("Unsupported KVM saved-state version %u (expected %u)."),
     330                                 uKvmSavedStatVersion, GIM_KVM_SAVED_STATE_VERSION);
    332331
    333332    /*
     
    345344        PGIMKVMCPU pKvmCpu = &pVCpu->gim.s.u.KvmCpu;
    346345
    347         uint8_t fSystemTimeFlags = 0;
    348346        SSMR3GetU64(pSSM, &pKvmCpu->u64SystemTimeMsr);
    349347        SSMR3GetU64(pSSM, &pKvmCpu->uTsc);
     
    474472 *      Worker for gimR3KvmEnableWallClock}
    475473 */
    476 static DECLCALLBACK(VBOXSTRICTRC) gimR3KvmEnableWallClockCallback(PVM pVM, PVMCPU pVCpu, void *pvData)
    477 {
    478     Assert(pvData);
    479     PKVMWALLCLOCKINFO pWallClockInfo  = (PKVMWALLCLOCKINFO)pvData;
     474static DECLCALLBACK(VBOXSTRICTRC) gimR3KvmEnableWallClockCallback(PVM pVM, PVMCPU pVCpu, void *pvUser)
     475{
     476    PKVMWALLCLOCKINFO pWallClockInfo  = (PKVMWALLCLOCKINFO)pvUser; AssertPtr(pWallClockInfo);
    480477    RTGCPHYS          GCPhysWallClock = pWallClockInfo->GCPhysWallClock;
     478    RT_NOREF1(pVCpu);
    481479
    482480    /*
     
    495493     * Ensure the version is incrementally even.
    496494     */
     495    /* faster: uVersion = (uVersion | 1) + 1; */
    497496    if (!(uVersion & 1))
    498497        ++uVersion;
     
    521520    rc = PGMPhysSimpleWriteGCPhys(pVM, GCPhysWallClock, &WallClock, sizeof(GIMKVMWALLCLOCK));
    522521    if (RT_SUCCESS(rc))
    523     {
    524522        LogRel(("GIM: KVM: Enabled wall-clock struct. at %#RGp - u32Sec=%u u32Nano=%u uVersion=%#RU32\n", GCPhysWallClock,
    525523                WallClock.u32Sec, WallClock.u32Nano, WallClock.u32Version));
    526     }
    527524    else
    528525        LogRel(("GIM: KVM: Failed to write wall-clock struct. at %#RGp. rc=%Rrc\n", GCPhysWallClock, rc));
  • trunk/src/VBox/VMM/include/GIMHvInternal.h

    r62478 r62641  
    11751175VMMR3_INT_DECL(PGIMMMIO2REGION) gimR3HvGetMmio2Regions(PVM pVM, uint32_t *pcRegions);
    11761176VMMR3_INT_DECL(int)             gimR3HvSave(PVM pVM, PSSMHANDLE pSSM);
    1177 VMMR3_INT_DECL(int)             gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion);
     1177VMMR3_INT_DECL(int)             gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM);
    11781178VMMR3_INT_DECL(int)             gimR3HvGetDebugSetup(PVM pVM, PGIMDEBUGSETUP pDbgSetup);
    11791179
  • trunk/src/VBox/VMM/include/GIMKvmInternal.h

    r62478 r62641  
    252252VMMR3_INT_DECL(void)            gimR3KvmReset(PVM pVM);
    253253VMMR3_INT_DECL(int)             gimR3KvmSave(PVM pVM, PSSMHANDLE pSSM);
    254 VMMR3_INT_DECL(int)             gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion);
     254VMMR3_INT_DECL(int)             gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM);
    255255
    256256VMMR3_INT_DECL(int)             gimR3KvmDisableSystemTime(PVM pVM);
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