VirtualBox

Changeset 58283 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Oct 16, 2015 3:20:38 PM (9 years ago)
Author:
vboxsync
Message:

VMM/GIM: Implemented Hyper-V SINT2 and SIMP faking for making Windows 10 32-bit guests happy.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
2 edited

Legend:

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

    r58248 r58283  
    8989     */
    9090    AssertCompile(sizeof(pVM->gim.s) <= sizeof(pVM->gim.padding));
     91    AssertCompile(sizeof(pVM->aCpus[0].gim.s) <= sizeof(pVM->aCpus[0].gim.padding));
     92
    9193
    9294    /*
  • trunk/src/VBox/VMM/VMMR3/GIMHv.cpp

    r58251 r58283  
    113113         */
    114114        rc = CFGMR3ValidateConfig(pCfgHv, "/HyperV/",
    115                                   "VendorID",
     115                                  "VendorID"
     116                                  "|VSInterface",
    116117                                  "" /* pszValidNodes */, "GIM/HyperV" /* pszWho */, 0 /* uInstance */);
    117118        if (RT_FAILURE(rc))
     
    132133    }
    133134
    134     pHv->fIsInterfaceVs = true;
     135    if (pHv->fIsVendorMsHv)
     136    {
     137        /** @cfgm{/GIM/HyperV/VSInterface, bool, true}
     138         * The Microsoft virtualization service interface (debugging). */
     139        rc = CFGMR3QueryBoolDef(pCfgHv, "VSInterface", &pHv->fIsInterfaceVs, true);
     140        AssertLogRelRCReturn(rc, rc);
     141    }
     142    else
     143        Assert(pHv->fIsInterfaceVs == false);
    135144
    136145    /*
     
    169178                         | GIM_HV_HINT_RELAX_TIME_CHECKS;
    170179
    171         /* Expose more if we're posing as Microsoft. */
    172         if (   pHv->fIsVendorMsHv
    173             /*&& !pHv->fIsInterfaceVs*/)
     180        /* Expose more if we're posing as Microsoft. We can, if needed, force MSR-based Hv
     181           debugging by not exposing these bits while exposing the VS interface.*/
     182        if (pHv->fIsVendorMsHv)
    174183        {
    175184            pHv->uMiscFeat  |= GIM_HV_MISC_FEAT_GUEST_DEBUGGING
     
    331340    if (pHv->uMiscFeat & GIM_HV_MISC_FEAT_GUEST_CRASH_MSRS)
    332341        pHv->uCrashCtl = MSR_GIM_HV_CRASH_CTL_NOTIFY_BIT;
    333 
    334     /*
    335      * Setup guest-host hypercall based debugging support.
    336      */
    337     if (pHv->uMiscFeat & GIM_HV_MISC_FEAT_GUEST_DEBUGGING)
    338     {
    339         rc = gimR3HvInitHypercallSupport(pVM);
    340         AssertLogRelRCReturn(rc, rc);
    341     }
     342    for (VMCPUID i = 0; i < pVM->cCpus; i++)
     343        pVM->aCpus[i].gim.s.u.HvCpu.uSint2Msr = MSR_GIM_HV_SINT_MASKED_BIT;
     344
     345    /*
     346     * Setup hypercall support.
     347     */
     348    rc = gimR3HvInitHypercallSupport(pVM);
     349    AssertLogRelRCReturn(rc, rc);
    342350
    343351    return VINF_SUCCESS;
     
    406414{
    407415    gimR3HvReset(pVM);
    408 
    409     PGIMHV pHv = &pVM->gim.s.u.Hv;
    410     if (pHv->uMiscFeat & GIM_HV_MISC_FEAT_GUEST_DEBUGGING)
    411         gimR3HvTermHypercallSupport(pVM);
     416    gimR3HvTermHypercallSupport(pVM);
    412417    return VINF_SUCCESS;
    413418}
     
    463468
    464469    /*
    465      * Reset MSRs (Careful! Don't reset non-zero MSRs).
     470     * Reset MSRs.
    466471     */
    467472    pHv->u64GuestOsIdMsr        = 0;
     
    477482    pHv->uDebugSendBufferMsr    = 0;
    478483    pHv->uDebugRecvBufferMsr    = 0;
     484    for (VMCPUID i = 0; i < pVM->cCpus; i++)
     485    {
     486        PVMCPU pVCpu = &pVM->aCpus[i];
     487        pVCpu->gim.s.u.HvCpu.uSint2Msr = MSR_GIM_HV_SINT_MASKED_BIT;
     488        pVCpu->gim.s.u.HvCpu.uSimpMsr  = 0;
     489    }
    479490}
    480491
     
    12091220 * @returns VBox status code.
    12101221 * @param   pVM         The cross context VM structure.
    1211  * @param   GCPhysOut   Where to write the hypercall output parameters after
    1212  *                      performing the hypercall.
    12131222 * @param   prcHv       Where to store the result of the hypercall operation.
    12141223 *
    12151224 * @thread  EMT.
    12161225 */
    1217 VMMR3_INT_DECL(int) gimR3HvHypercallPostDebugData(PVM pVM, RTGCPHYS GCPhysOut, int *prcHv)
     1226VMMR3_INT_DECL(int) gimR3HvHypercallPostDebugData(PVM pVM, int *prcHv)
    12181227{
    12191228    AssertPtr(pVM);
     
    12651274     * Update the guest memory with result.
    12661275     */
    1267     int rc = PGMPhysSimpleWriteGCPhys(pVM, GCPhysOut, pHv->pbHypercallOut, sizeof(GIMHVDEBUGPOSTOUT));
     1276    int rc = PGMPhysSimpleWriteGCPhys(pVM, pHv->GCPhysHypercallOut, pHv->pbHypercallOut, sizeof(GIMHVDEBUGPOSTOUT));
    12681277    if (RT_FAILURE(rc))
    12691278    {
     
    12821291 * @returns VBox status code.
    12831292 * @param   pVM         The cross context VM structure.
    1284  * @param   GCPhysOut   Where to write the hypercall output parameters after
    1285  *                      performing the hypercall.
    12861293 * @param   prcHv       Where to store the result of the hypercall operation.
    12871294 *
    12881295 * @thread  EMT.
    12891296 */
    1290 VMMR3_INT_DECL(int) gimR3HvHypercallRetrieveDebugData(PVM pVM, RTGCPHYS GCPhysOut, int *prcHv)
     1297VMMR3_INT_DECL(int) gimR3HvHypercallRetrieveDebugData(PVM pVM, int *prcHv)
    12911298{
    12921299    AssertPtr(pVM);
     
    13451352     * Update the guest memory with result.
    13461353     */
    1347     int rc = PGMPhysSimpleWriteGCPhys(pVM, GCPhysOut, pHv->pbHypercallOut, sizeof(GIMHVDEBUGRETRIEVEOUT) + *pcbReallyRead);
     1354    int rc = PGMPhysSimpleWriteGCPhys(pVM, pHv->GCPhysHypercallOut, pHv->pbHypercallOut,
     1355                                      sizeof(GIMHVDEBUGRETRIEVEOUT) + *pcbReallyRead);
    13481356    if (RT_FAILURE(rc))
    13491357    {
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