VirtualBox

Changeset 24403 in vbox for trunk/src/VBox/Main/HostImpl.cpp


Ignore:
Timestamp:
Nov 5, 2009 5:12:55 PM (15 years ago)
Author:
vboxsync
Message:

Main: Added Host::GetProcessorCpuIdLeaf.

File:
1 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}
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