VirtualBox

Changeset 24403 in vbox


Ignore:
Timestamp:
Nov 5, 2009 5:12:55 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54449
Message:

Main: Added Host::GetProcessorCpuIdLeaf.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/HostImpl.cpp

    r23702 r24403  
    10041004    return S_OK;
    10051005}
     1006
    10061007/**
    10071008 * Returns a description string for the host CPU
     
    10601061            ReturnComNotImplemented();
    10611062    }
     1063    return S_OK;
     1064}
     1065
     1066/**
     1067 * Returns the specific CPUID leaf.
     1068 *
     1069 * @returns COM status code
     1070 * @param   aCpuId              The CPU number. Mostly ignored.
     1071 * @param   aLeaf               The leaf number.
     1072 * @param   aSubLeaf            The sub-leaf number.
     1073 * @param   aValEAX             Where to return EAX.
     1074 * @param   aValEBX             Where to return EBX.
     1075 * @param   aValECX             Where to return ECX.
     1076 * @param   aValEDX             Where to return EDX.
     1077 */
     1078STDMETHODIMP Host::GetProcessorCpuIdLeaf(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf,
     1079                                         ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX)
     1080{
     1081    CheckComArgOutPointerValid(aValEAX);
     1082    CheckComArgOutPointerValid(aValEBX);
     1083    CheckComArgOutPointerValid(aValECX);
     1084    CheckComArgOutPointerValid(aValEDX);
     1085    // no locking required
     1086
     1087    /* Check that the CPU is online. */
     1088    /** @todo later use RTMpOnSpecific. */
     1089    if (!RTMpIsCpuOnline(aCpuId))
     1090        return RTMpIsCpuPresent(aCpuId)
     1091             ? setError(E_FAIL, tr("CPU no.%u is not present"), aCpuId)
     1092             : setError(E_FAIL, tr("CPU no.%u is not online"), aCpuId);
     1093
     1094    uint32_t uEAX, uEBX, uECX, uEDX;
     1095    ASMCpuId_Idx_ECX(aLeaf, aSubLeaf, &uEAX, &uEBX, &uECX, &uEDX);
     1096    *aValEAX = uEAX;
     1097    *aValEBX = uEBX;
     1098    *aValECX = uECX;
     1099    *aValEDX = uEDX;
     1100
    10621101    return S_OK;
    10631102}
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r24346 r24403  
    51835183
    51845184        See the Intel and AMD programmer's manuals for detailed information
    5185         about the cpuid instruction and its leafs.       
     5185        about the cpuid instruction and its leafs.
    51865186        <result name="E_INVALIDARG">
    51875187          Invalid id.
     
    71977197  <interface
    71987198     name="IHost" extends="$unknown"
    7199      uuid="95522f11-1ecc-443b-9242-3af6b24d430c"
     7199     uuid="e380cbfc-ae65-4fa6-899e-45ded6b3132a"
    72007200     wsmap="managed"
    72017201     >
     
    73047304        <desc>
    73057305          Identifier of the CPU.
     7306          <note>
     7307            The current implementation might not necessarily return the
     7308            description for this exact CPU.
     7309          </note>
    73067310        </desc>
    73077311      </param>
     
    73107314          Model string. An empty string is returned if value is not known or
    73117315          @a cpuId is invalid.
     7316        </desc>
     7317      </param>
     7318    </method>
     7319
     7320    <method name="getProcessorCpuIdLeaf">
     7321      <desc>
     7322        Returns the CPU cpuid information for the specified leaf.
     7323      </desc>
     7324      <param name="cpuId" type="unsigned long" dir="in">
     7325        <desc>
     7326          Identifier of the CPU.  The CPU most be online.
     7327          <note>
     7328            The current implementation might not necessarily return the
     7329            description for this exact CPU.
     7330          </note>
     7331        </desc>
     7332      </param>
     7333      <param name="leaf" type="unsigned long" dir="in">
     7334        <desc>
     7335          Cpuid leaf index (eax).
     7336        </desc>
     7337      </param>
     7338      <param name="subLeaf" type="unsigned long" dir="in">
     7339        <desc>
     7340          Cpuid leaf sub index (ecx).  This currently only applies to cache
     7341          information on Intel CPUs.  Use 0 if retriving values for
     7342          <link to="IMachine::setCpuIdLeaf"/>.
     7343        </desc>
     7344      </param>
     7345      <param name="valEax" type="unsigned long" dir="out">
     7346        <desc>
     7347          Cpuid leaf value for register eax.
     7348        </desc>
     7349      </param>
     7350      <param name="valEbx" type="unsigned long" dir="out">
     7351        <desc>
     7352          Cpuid leaf value for register ebx.
     7353        </desc>
     7354      </param>
     7355      <param name="valEcx" type="unsigned long" dir="out">
     7356        <desc>
     7357          Cpuid leaf value for register ecx.
     7358        </desc>
     7359      </param>
     7360      <param name="valEdx" type="unsigned long" dir="out">
     7361        <desc>
     7362          Cpuid leaf value for register edx.
    73127363        </desc>
    73137364      </param>
  • trunk/src/VBox/Main/include/HostImpl.h

    r23537 r24403  
    7676    STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
    7777    STDMETHOD(GetProcessorFeature) (ProcessorFeature_T feature, BOOL *supported);
     78    STDMETHOD(GetProcessorCpuIdLeaf)(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX);
    7879    STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
    7980    STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
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