VirtualBox

Changeset 72328 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 24, 2018 7:29:45 PM (7 years ago)
Author:
vboxsync
Message:

Main: Added read-only ExecutionEngine attribute to IMachineDebugger to expose VM::bMainExecutionEngine to API clients. bugref:9044

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r72067 r72328  
    1831418314  -->
    1831518315
     18316  <enum
     18317    name="VMExecutionEngine"
     18318    uuid="56029577-31f7-44d2-3334-7ecbf95294b6"
     18319    >
     18320    <desc>
     18321      The main execution engine of a VM.
     18322    </desc>
     18323    <const name="NotSet"            value="0">
     18324      <desc>Has not yet been set (try again later).</desc>
     18325    </const>
     18326    <const name="RawMode"           value="1">
     18327      <desc>Raw-mode.</desc>
     18328    </const>
     18329    <const name="HwVirt"            value="2">
     18330      <desc>Hardware assisted virtualization thru HM.</desc>
     18331    </const>
     18332    <const name="NativeApi"         value="3">
     18333      <desc>Hardware assisted virtualization thru native API (NEM).</desc>
     18334    </const>
     18335  </enum>
     18336
    1831618337  <interface
    1831718338    name="IMachineDebugger" extends="$unknown"
    18318     uuid="9c0f5269-47ae-ee34-c2fe-53a16e388925"
     18339    uuid="8b1a74a7-086a-46cc-1229-6a85ad31b7ba"
    1831918340    wsmap="managed"
    1832018341    reservedMethods="16" reservedAttributes="15"
     
    1873218753    </attribute>
    1873318754
     18755    <attribute name="executionEngine" type="VMExecutionEngine" readonly="yes">
     18756      <desc>Gets the main execution engine of the VM.</desc>
     18757    </attribute>
     18758
    1873418759    <attribute name="HWVirtExEnabled" type="boolean" readonly="yes">
    1873518760      <desc>
    1873618761        Flag indicating whether the VM is currently making use of CPU hardware
    1873718762        virtualization extensions.
     18763
     18764        Superseeded by mainExecutionMode.
    1873818765      </desc>
    1873918766    </attribute>
  • trunk/src/VBox/Main/include/MachineDebuggerImpl.h

    r69500 r72328  
    6666    HRESULT getLogRelGroups(com::Utf8Str &aLogRelGroups);
    6767    HRESULT getLogRelDestinations(com::Utf8Str &aLogRelDestinations);
     68    HRESULT getExecutionEngine(VMExecutionEngine_T *apenmEngine);
    6869    HRESULT getHWVirtExEnabled(BOOL *aHWVirtExEnabled);
    6970    HRESULT getHWVirtExNestedPagingEnabled(BOOL *aHWVirtExNestedPagingEnabled);
  • trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp

    r69500 r72328  
    532532
    533533/**
     534 * Return the main execution engine of the VM.
     535 *
     536 * @returns COM status code
     537 * @param   apenmEngine     Address of the result variable.
     538 */
     539HRESULT MachineDebugger::getExecutionEngine(VMExecutionEngine_T *apenmEngine)
     540{
     541    *apenmEngine = VMExecutionEngine_NotSet;
     542
     543    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     544    Console::SafeVMPtrQuiet ptrVM(mParent);
     545    if (ptrVM.isOk())
     546    {
     547        uint8_t bEngine = UINT8_MAX;
     548        int rc = EMR3QueryMainExecutionEngine(ptrVM.rawUVM(), &bEngine);
     549        if (RT_SUCCESS(rc))
     550            switch (bEngine)
     551            {
     552                case VM_EXEC_ENGINE_NOT_SET:    *apenmEngine = VMExecutionEngine_NotSet; break;
     553                case VM_EXEC_ENGINE_RAW_MODE:   *apenmEngine = VMExecutionEngine_RawMode; break;
     554                case VM_EXEC_ENGINE_HW_VIRT:    *apenmEngine = VMExecutionEngine_HwVirt; break;
     555                case VM_EXEC_ENGINE_NATIVE_API: *apenmEngine = VMExecutionEngine_NativeApi; break;
     556                default: AssertMsgFailed(("bEngine=%d\n", bEngine));
     557            }
     558    }
     559
     560    return S_OK;
     561}
     562
     563/**
    534564 * Returns the current hardware virtualization flag.
    535565 *
     
    539569HRESULT MachineDebugger::getHWVirtExEnabled(BOOL *aHWVirtExEnabled)
    540570{
     571    *aHWVirtExEnabled = false;
     572
    541573    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    542 
    543574    Console::SafeVMPtrQuiet ptrVM(mParent);
    544 
    545575    if (ptrVM.isOk())
    546         *aHWVirtExEnabled = HMR3IsEnabled(ptrVM.rawUVM());
    547     else
    548         *aHWVirtExEnabled = false;
     576    {
     577        uint8_t bEngine = UINT8_MAX;
     578        int rc = EMR3QueryMainExecutionEngine(ptrVM.rawUVM(), &bEngine);
     579        *aHWVirtExEnabled = RT_SUCCESS(rc) && bEngine == VM_EXEC_ENGINE_HW_VIRT;
     580    }
    549581
    550582    return S_OK;
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