VirtualBox

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


Ignore:
Timestamp:
Nov 10, 2021 6:53:45 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148188
Message:

VMM/NEMR3Native-darwin.cpp: Implement NEMHCQueryCpuTick() and NEMHCResumeCpuTickOnAll() and some updates for the APIC related state, bugref:9044

File:
1 edited

Legend:

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

    r92316 r92338  
    411411}
    412412
    413 #if 0 /* unused */
    414413DECLINLINE(int) nemR3DarwinMsrRead(PVMCPUCC pVCpu, uint32_t idMsr, uint64_t *pu64Val)
    415414{
     
    421420}
    422421
    423 
     422#if 0 /*unused*/
    424423DECLINLINE(int) nemR3DarwinMsrWrite(PVMCPUCC pVCpu, uint32_t idMsr, uint64_t u64Val)
    425424{
     
    431430}
    432431#endif
    433 
    434432
    435433static int nemR3DarwinCopyStateFromHv(PVMCC pVM, PVMCPUCC pVCpu, uint64_t fWhat)
     
    12781276    if (fWhat & CPUMCTX_EXTRN_OTHER_MSRS)
    12791277    {
    1280 #if 0
    1281         hv_return_t hrc = hv_vmx_vcpu_set_apic_address(pVCpu->nem.s.hVCpuId, APICGetBaseMsrNoCheck(pVCpu));
     1278        hv_return_t hrc = hv_vmx_vcpu_set_apic_address(pVCpu->nem.s.hVCpuId, APICGetBaseMsrNoCheck(pVCpu) & PAGE_BASE_GC_MASK);
    12821279        if (RT_UNLIKELY(hrc != HV_SUCCESS))
    12831280            return nemR3DarwinHvSts2Rc(hrc);
    1284 #endif
    12851281
    12861282#if 0
     
    16921688static int nemR3DarwinVmxSetupVmcsProcCtls(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    16931689{
    1694     //PVMCC pVM = pVCpu->CTX_SUFF(pVM);
     1690    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    16951691    uint32_t       fVal = g_HmMsrs.u.vmx.ProcCtls.n.allowed0;     /* Bits set here must be set in the VMCS. */
    16961692    uint32_t const fZap = g_HmMsrs.u.vmx.ProcCtls.n.allowed1;     /* Bits cleared here must be cleared in the VMCS. */
     
    17121708    }
    17131709
    1714 #if 0 /** @todo */
    17151710    /* Use TPR shadowing if supported by the CPU. */
    17161711    if (   PDMHasApic(pVM)
     
    17211716        Assert(!(fVal & VMX_PROC_CTLS_CR8_STORE_EXIT));
    17221717        Assert(!(fVal & VMX_PROC_CTLS_CR8_LOAD_EXIT));
    1723         hmR0VmxSetupVmcsVirtApicAddr(pVmcsInfo);
    17241718    }
    17251719    else
    1726 #endif
    17271720    {
    17281721        fVal |= VMX_PROC_CTLS_CR8_STORE_EXIT             /* CR8 reads cause a VM-exit. */
     
    21952188        }
    21962189
    2197         /** @todo Only copy the state selectively. */
    2198         {
    2199             int rc = nemR3DarwinCopyStateToHv(pVM, pVCpu, &VmxTransient);
    2200             AssertRCReturn(rc, rc);
    2201         }
     2190        int rc = nemR3DarwinExportGuestState(pVM, pVCpu, &VmxTransient);
     2191        AssertRCReturn(rc, rc);
    22022192
    22032193        /*
     
    27122702    STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatQueryCpuTick);
    27132703
    2714     RT_NOREF(pVCpu, pcTicks, puAux);
    2715     return VINF_SUCCESS;
     2704    int rc = nemR3DarwinMsrRead(pVCpu, MSR_IA32_TSC, pcTicks);
     2705    if (   RT_SUCCESS(rc)
     2706        && puAux)
     2707    {
     2708        if (pVCpu->cpum.GstCtx.fExtrn & CPUMCTX_EXTRN_TSC_AUX)
     2709        {
     2710            /** @todo Why the heck is puAux a uint32_t?. */
     2711            uint64_t u64Aux;
     2712            rc = nemR3DarwinMsrRead(pVCpu, MSR_K8_TSC_AUX, &u64Aux);
     2713            if (RT_SUCCESS(rc))
     2714                *puAux = (uint32_t)u64Aux;
     2715        }
     2716        else
     2717            *puAux = CPUMGetGuestTscAux(pVCpu);
     2718    }
     2719
     2720    return rc;
    27162721}
    27172722
     
    27332738    AssertReturn(VM_IS_NEM_ENABLED(pVM), VERR_NEM_IPE_9);
    27342739
    2735     RT_NOREF(uPausedTscValue);
    2736     return VINF_SUCCESS;
     2740    hv_return_t hrc = hv_vm_sync_tsc(uPausedTscValue);
     2741    if (RT_LIKELY(hrc == HV_SUCCESS))
     2742        return VINF_SUCCESS;
     2743
     2744    return nemR3DarwinHvSts2Rc(hrc);
    27372745}
    27382746
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette