VirtualBox

Changeset 93825 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 17, 2022 12:27:36 PM (3 years ago)
Author:
vboxsync
Message:

VMM/NEMR3Native-darwin: Reduce code duplication, bugref:9044

File:
1 edited

Legend:

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

    r93787 r93825  
    18021802
    18031803/**
    1804  * Handles an exit from hv_vcpu_run().
     1804 * Common worker for both nemR3DarwinHandleExit() and nemR3DarwinHandleExitDebug().
    18051805 *
    18061806 * @returns VBox strict status code.
     
    18101810 * @param   pVmxTransient   The transient VMX structure.
    18111811 */
    1812 static VBOXSTRICTRC nemR3DarwinHandleExit(PVM pVM, PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     1812DECLINLINE(int) nemR3DarwinHandleExitCommon(PVM pVM, PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
    18131813{
    18141814    uint32_t uExitReason;
     
    18321832    STAM_COUNTER_INC(&pVCpu->nem.s.pVmxStats->aStatExitReason[pVmxTransient->uExitReason & MASK_EXITREASON_STAT]);
    18331833    STAM_REL_COUNTER_INC(&pVCpu->nem.s.pVmxStats->StatExitAll);
     1834    return VINF_SUCCESS;
     1835}
     1836
     1837
     1838/**
     1839 * Handles an exit from hv_vcpu_run().
     1840 *
     1841 * @returns VBox strict status code.
     1842 * @param   pVM             The cross context VM structure.
     1843 * @param   pVCpu           The cross context virtual CPU structure of the
     1844 *                          calling EMT.
     1845 * @param   pVmxTransient   The transient VMX structure.
     1846 */
     1847static VBOXSTRICTRC nemR3DarwinHandleExit(PVM pVM, PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     1848{
     1849    int rc = nemR3DarwinHandleExitCommon(pVM, pVCpu, pVmxTransient);
     1850    AssertRCReturn(rc, rc);
    18341851
    18351852#ifndef HMVMX_USE_FUNCTION_TABLE
     
    18531870static VBOXSTRICTRC nemR3DarwinHandleExitDebug(PVM pVM, PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
    18541871{
    1855     uint32_t uExitReason;
    1856     int rc = nemR3DarwinReadVmcs32(pVCpu, VMX_VMCS32_RO_EXIT_REASON, &uExitReason);
    1857     AssertRC(rc);
    1858     pVmxTransient->fVmcsFieldsRead = 0;
    1859     pVmxTransient->fIsNestedGuest  = false;
    1860     pVmxTransient->uExitReason     = VMX_EXIT_REASON_BASIC(uExitReason);
    1861     pVmxTransient->fVMEntryFailed  = VMX_EXIT_REASON_HAS_ENTRY_FAILED(uExitReason);
    1862 
    1863     if (RT_UNLIKELY(pVmxTransient->fVMEntryFailed))
    1864         AssertLogRelMsgFailedReturn(("Running guest failed for CPU #%u: %#x %u\n",
    1865                                     pVCpu->idCpu, pVmxTransient->uExitReason, vmxHCCheckGuestState(pVCpu, &pVCpu->nem.s.VmcsInfo)),
    1866                                     VERR_NEM_IPE_0);
    1867 
    1868     /** @todo Only copy the state on demand (the R0 VT-x code saves some stuff unconditionally and the VMX template assumes that
    1869      * when handling exits). */
    1870     rc = nemR3DarwinCopyStateFromHv(pVM, pVCpu, CPUMCTX_EXTRN_ALL);
     1872    int rc = nemR3DarwinHandleExitCommon(pVM, pVCpu, pVmxTransient);
    18711873    AssertRCReturn(rc, rc);
    1872 
    1873     STAM_COUNTER_INC(&pVCpu->nem.s.pVmxStats->aStatExitReason[pVmxTransient->uExitReason & MASK_EXITREASON_STAT]);
    1874     STAM_REL_COUNTER_INC(&pVCpu->nem.s.pVmxStats->StatExitAll);
    18751874
    18761875    return vmxHCRunDebugHandleExit(pVCpu, pVmxTransient, pDbgState);
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