VirtualBox

Changeset 48528 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Sep 18, 2013 8:39:01 PM (11 years ago)
Author:
vboxsync
Message:

Change implementation for turning a reset into a power off to prevent the VM from executing while the power down thread is not running

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

Legend:

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

    r46788 r48528  
    197197        AssertPtrNullReturn(pVmm2UserMethods->pfnNotifyPdmtInit, VERR_INVALID_POINTER);
    198198        AssertPtrNullReturn(pVmm2UserMethods->pfnNotifyPdmtTerm, VERR_INVALID_POINTER);
     199        AssertPtrNullReturn(pVmm2UserMethods->pfnNotifyResetTurnedIntoPowerOff, VERR_INVALID_POINTER);
    199200        AssertReturn(pVmm2UserMethods->u32EndMagic == VMM2USERMETHODS_MAGIC,   VERR_INVALID_PARAMETER);
    200201    }
     
    842843    AssertLogRelMsgRCReturn(rc, ("Configuration error: Querying \"UUID\" failed, rc=%Rrc\n", rc), rc);
    843844
     845    rc = CFGMR3QueryBoolDef(pRoot, "PowerOffInsteadOfReset", &pVM->vm.s.fPowerOffInsteadOfReset, false);
     846    AssertLogRelMsgRCReturn(rc, ("Configuration error: Querying \"PowerOffInsteadOfReset\" failed, rc=%Rrc\n", rc), rc);
     847
    844848    return VINF_SUCCESS;
    845849}
     
    28532857    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
    28542858
     2859    if (pVM->vm.s.fPowerOffInsteadOfReset)
     2860    {
     2861        if (   pUVM->pVmm2UserMethods
     2862            && pUVM->pVmm2UserMethods->pfnNotifyResetTurnedIntoPowerOff)
     2863            pUVM->pVmm2UserMethods->pfnNotifyResetTurnedIntoPowerOff(pUVM->pVmm2UserMethods, pUVM);
     2864        return VMR3PowerOff(pUVM);
     2865    }
     2866
    28552867    /*
    28562868     * Gather all the EMTs to make sure there are no races before
     
    44374449}
    44384450
     4451
     4452/**
     4453 * Control whether the VM should power off when resetting.
     4454 *
     4455 * @returns VBox status code.
     4456 * @param   pUVM                The user mode VM handle.
     4457 * @param   fPowerOffInsteadOfReset Flag whether the VM should power off when
     4458 *                                  resetting.
     4459 */
     4460VMMR3DECL(int) VMR3SetPowerOffInsteadOfReset(PUVM pUVM, bool fPowerOffInsteadOfReset)
     4461{
     4462    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     4463    PVM pVM = pUVM->pVM;
     4464    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
     4465
     4466    /* Note: not called from EMT. */
     4467    pVM->vm.s.fPowerOffInsteadOfReset = fPowerOffInsteadOfReset;
     4468    return VINF_SUCCESS;
     4469}
     4470
  • trunk/src/VBox/VMM/include/VMInternal.h

    r46788 r48528  
    164164    /** The VM was/is-being teleported and has not yet been fully resumed. */
    165165    bool                            fTeleportedAndNotFullyResumedYet;
     166    /** The VM should power off instead of reset. */
     167    bool                            fPowerOffInsteadOfReset;
    166168} VMINT;
    167169/** Pointer to the VM Internal Data (part of the VM structure). */
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