VirtualBox

Changeset 93681 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 10, 2022 1:48:35 PM (3 years ago)
Author:
vboxsync
Message:

VMM/NEMR3Native-darwin: Don't run forever with hv_vcpu_run_until(), TM doesn't like it when the guest runs for more than 4 seconds and asserts, bguref:9044 [scm fix]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-darwin.cpp

    r93680 r93681  
    4949#include <mach/mach_time.h>
    5050#include <mach/kern_return.h>
     51
    5152
    5253/*********************************************************************************************************************************
     
    11131114        READ_MSR(MSR_K8_SF_MASK, pVCpu->cpum.GstCtx.msrSFMASK);
    11141115    }
    1115 #if 0
    11161116    if (fWhat & CPUMCTX_EXTRN_OTHER_MSRS)
    11171117    {
    1118         Assert(aenmNames[iReg] == WHvX64RegisterApicBase);
    1119         const uint64_t uOldBase = APICGetBaseMsrNoCheck(pVCpu);
    1120         if (aValues[iReg].Reg64 != uOldBase)
    1121         {
    1122             Log7(("NEM/%u: MSR APICBase changed %RX64 -> %RX64 (%RX64)\n",
    1123                   pVCpu->idCpu, uOldBase, aValues[iReg].Reg64, aValues[iReg].Reg64 ^ uOldBase));
    1124             int rc2 = APICSetBaseMsr(pVCpu, aValues[iReg].Reg64);
    1125             AssertLogRelMsg(rc2 == VINF_SUCCESS, ("%Rrc %RX64\n", rc2, aValues[iReg].Reg64));
    1126         }
    1127         iReg++;
    1128 
    1129         GET_REG64_LOG7(pVCpu->cpum.GstCtx.msrPAT, WHvX64RegisterPat, "MSR PAT");
    1130 #if 0 /*def LOG_ENABLED*/ /** @todo something's wrong with HvX64RegisterMtrrCap? (AMD) */
    1131         GET_REG64_LOG7(pVCpu->cpum.GstCtx.msrPAT, WHvX64RegisterMsrMtrrCap);
    1132 #endif
    11331118        PCPUMCTXMSRS pCtxMsrs = CPUMQueryGuestCtxMsrsPtr(pVCpu);
    1134         GET_REG64_LOG7(pCtxMsrs->msr.MtrrDefType,      WHvX64RegisterMsrMtrrDefType,     "MSR MTRR_DEF_TYPE");
    1135         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix64K_00000, WHvX64RegisterMsrMtrrFix64k00000, "MSR MTRR_FIX_64K_00000");
    1136         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix16K_80000, WHvX64RegisterMsrMtrrFix16k80000, "MSR MTRR_FIX_16K_80000");
    1137         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix16K_A0000, WHvX64RegisterMsrMtrrFix16kA0000, "MSR MTRR_FIX_16K_A0000");
    1138         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix4K_C0000,  WHvX64RegisterMsrMtrrFix4kC0000,  "MSR MTRR_FIX_4K_C0000");
    1139         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix4K_C8000,  WHvX64RegisterMsrMtrrFix4kC8000,  "MSR MTRR_FIX_4K_C8000");
    1140         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix4K_D0000,  WHvX64RegisterMsrMtrrFix4kD0000,  "MSR MTRR_FIX_4K_D0000");
    1141         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix4K_D8000,  WHvX64RegisterMsrMtrrFix4kD8000,  "MSR MTRR_FIX_4K_D8000");
    1142         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix4K_E0000,  WHvX64RegisterMsrMtrrFix4kE0000,  "MSR MTRR_FIX_4K_E0000");
    1143         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix4K_E8000,  WHvX64RegisterMsrMtrrFix4kE8000,  "MSR MTRR_FIX_4K_E8000");
    1144         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix4K_F0000,  WHvX64RegisterMsrMtrrFix4kF0000,  "MSR MTRR_FIX_4K_F0000");
    1145         GET_REG64_LOG7(pCtxMsrs->msr.MtrrFix4K_F8000,  WHvX64RegisterMsrMtrrFix4kF8000,  "MSR MTRR_FIX_4K_F8000");
    1146         GET_REG64_LOG7(pCtxMsrs->msr.TscAux,           WHvX64RegisterTscAux,             "MSR TSC_AUX");
    1147         /** @todo look for HvX64RegisterIa32MiscEnable and HvX64RegisterIa32FeatureControl? */
    1148     }
    1149 #endif
     1119        READ_MSR(MSR_K8_TSC_AUX, pCtxMsrs->msr.TscAux);
     1120    }
    11501121
    11511122    /* Almost done, just update extrn flags and maybe change PGM mode. */
     
    17271698    if (fWhat & CPUMCTX_EXTRN_OTHER_MSRS)
    17281699    {
    1729 #if 0
    1730         hv_return_t hrc = hv_vmx_vcpu_set_apic_address(pVCpu->nem.s.hVCpuId, APICGetBaseMsrNoCheck(pVCpu) & PAGE_BASE_GC_MASK);
    1731         if (RT_UNLIKELY(hrc != HV_SUCCESS))
    1732             return nemR3DarwinHvSts2Rc(hrc);
    1733 #endif
    1734 
     1700        PCPUMCTXMSRS pCtxMsrs = CPUMQueryGuestCtxMsrsPtr(pVCpu);
     1701
     1702        WRITE_MSR(MSR_K8_TSC_AUX, pCtxMsrs->msr.TscAux);
    17351703        ASMAtomicUoAndU64(&pVCpu->nem.s.fCtxChanged, ~HM_CHANGED_GUEST_OTHER_MSRS);
    1736 
    1737 #if 0
    1738         ADD_REG64(WHvX64RegisterPat, pVCpu->cpum.GstCtx.msrPAT);
    1739 #if 0 /** @todo check if WHvX64RegisterMsrMtrrCap works here... */
    1740         ADD_REG64(WHvX64RegisterMsrMtrrCap, CPUMGetGuestIa32MtrrCap(pVCpu));
    1741 #endif
    1742         PCPUMCTXMSRS pCtxMsrs = CPUMQueryGuestCtxMsrsPtr(pVCpu);
    1743         ADD_REG64(WHvX64RegisterMsrMtrrDefType, pCtxMsrs->msr.MtrrDefType);
    1744         ADD_REG64(WHvX64RegisterMsrMtrrFix64k00000, pCtxMsrs->msr.MtrrFix64K_00000);
    1745         ADD_REG64(WHvX64RegisterMsrMtrrFix16k80000, pCtxMsrs->msr.MtrrFix16K_80000);
    1746         ADD_REG64(WHvX64RegisterMsrMtrrFix16kA0000, pCtxMsrs->msr.MtrrFix16K_A0000);
    1747         ADD_REG64(WHvX64RegisterMsrMtrrFix4kC0000,  pCtxMsrs->msr.MtrrFix4K_C0000);
    1748         ADD_REG64(WHvX64RegisterMsrMtrrFix4kC8000,  pCtxMsrs->msr.MtrrFix4K_C8000);
    1749         ADD_REG64(WHvX64RegisterMsrMtrrFix4kD0000,  pCtxMsrs->msr.MtrrFix4K_D0000);
    1750         ADD_REG64(WHvX64RegisterMsrMtrrFix4kD8000,  pCtxMsrs->msr.MtrrFix4K_D8000);
    1751         ADD_REG64(WHvX64RegisterMsrMtrrFix4kE0000,  pCtxMsrs->msr.MtrrFix4K_E0000);
    1752         ADD_REG64(WHvX64RegisterMsrMtrrFix4kE8000,  pCtxMsrs->msr.MtrrFix4K_E8000);
    1753         ADD_REG64(WHvX64RegisterMsrMtrrFix4kF0000,  pCtxMsrs->msr.MtrrFix4K_F0000);
    1754         ADD_REG64(WHvX64RegisterMsrMtrrFix4kF8000,  pCtxMsrs->msr.MtrrFix4K_F8000);
    1755         ADD_REG64(WHvX64RegisterTscAux, pCtxMsrs->msr.TscAux);
    1756 #if 0 /** @todo these registers aren't available? Might explain something.. .*/
    1757         const CPUMCPUVENDOR enmCpuVendor = CPUMGetHostCpuVendor(pVM);
    1758         if (enmCpuVendor != CPUMCPUVENDOR_AMD)
    1759         {
    1760             ADD_REG64(HvX64RegisterIa32MiscEnable, pCtxMsrs->msr.MiscEnable);
    1761             ADD_REG64(HvX64RegisterIa32FeatureControl, CPUMGetGuestIa32FeatureControl(pVCpu));
    1762         }
    1763 #endif
    1764 #endif
    17651704    }
    17661705
     
    17731712
    17741713    /* Clear any bits that may be set but exported unconditionally or unused/reserved bits. */
    1775     ASMAtomicUoAndU64(&pVCpu->nem.s.fCtxChanged, ~(
    1776                                                      HM_CHANGED_GUEST_TSC_AUX
    1777                                                    | HM_CHANGED_GUEST_HWVIRT
     1714    ASMAtomicUoAndU64(&pVCpu->nem.s.fCtxChanged, ~(  HM_CHANGED_GUEST_HWVIRT
    17781715                                                   | HM_CHANGED_VMX_GUEST_AUTO_MSRS
    17791716                                                   | HM_CHANGED_VMX_GUEST_LAZY_MSRS
     
    34153352        if (pVCpu->cpum.GstCtx.fExtrn & CPUMCTX_EXTRN_TSC_AUX)
    34163353        {
    3417             /** @todo Why the heck is puAux a uint32_t?. */
    34183354            uint64_t u64Aux;
    34193355            rc = nemR3DarwinMsrRead(pVCpu, MSR_K8_TSC_AUX, &u64Aux);
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