VirtualBox

Ignore:
Timestamp:
Nov 5, 2009 9:17:56 PM (15 years ago)
Author:
vboxsync
Message:

Fixed bugs in VBoxManage list hostcpuids and the cpuid part of the showvminfo output. Use the s_auCpuIdRanges thing more places.

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r24404 r24416  
    257257        RTPrintf("CPUID overrides: ");
    258258    ULONG cFound = 0;
    259     static uint32_t const s_auCpuIdRanges[4] =
     259    static uint32_t const s_auCpuIdRanges[] =
    260260    {
    261261        UINT32_C(0x00000000), UINT32_C(0x0000000a),
    262         UINT32_C(0x80000000), UINT32_C(0x0000000a)
     262        UINT32_C(0x80000000), UINT32_C(0x8000000a)
    263263    };
    264264    for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r24404 r24416  
    444444            RTPrintf("Host CPUIDs:\n\nLeaf no.  EAX      EBX      ECX      EDX\n");
    445445            ULONG uCpuNo = 0; /* ASSUMES that CPU#0 is online. */
    446             ULONG uEAX, uEBX, uECX, uEDX;
    447             ULONG cLeafs;
    448 
    449             /* Standard */
    450             CHECK_ERROR(Host, GetProcessorCpuIdLeaf(uCpuNo, 0, 0, &cLeafs, &uEBX, &uECX, &uEDX));
    451             if (cLeafs > UINT32_C(0x00000000) && cLeafs <= UINT32_C(0x0000007f))
    452                 for (ULONG iLeaf = 0; iLeaf < cLeafs; iLeaf++)
     446            static uint32_t const s_auCpuIdRanges[] =
     447            {
     448                UINT32_C(0x00000000), UINT32_C(0x0000007f),
     449                UINT32_C(0x80000000), UINT32_C(0x8000007f),
     450                UINT32_C(0xc0000000), UINT32_C(0xc000007f)
     451            };
     452            for (unsigned i = 0; i < RT_ELEMENTS(s_auCpuIdRanges); i += 2)
     453            {
     454                ULONG uEAX, uEBX, uECX, uEDX, cLeafs;
     455                CHECK_ERROR(Host, GetProcessorCpuIdLeaf(uCpuNo, s_auCpuIdRanges[i], 0, &cLeafs, &uEBX, &uECX, &uEDX));
     456                if (cLeafs < s_auCpuIdRanges[i] || cLeafs > s_auCpuIdRanges[i+1])
     457                    continue;
     458                cLeafs++;
     459                for (ULONG iLeaf = s_auCpuIdRanges[i]; iLeaf <= cLeafs; iLeaf++)
    453460                {
    454461                    CHECK_ERROR(Host, GetProcessorCpuIdLeaf(uCpuNo, iLeaf, 0, &uEAX, &uEBX, &uECX, &uEDX));
    455462                    RTPrintf("%08x  %08x %08x %08x %08x\n", iLeaf, uEAX, uEBX, uECX, uEDX);
    456463                }
    457 
    458             /* Extended */
    459             CHECK_ERROR(Host, GetProcessorCpuIdLeaf(uCpuNo, UINT32_C(0x80000000), 0, &cLeafs, &uEBX, &uECX, &uEDX));
    460             if (cLeafs > UINT32_C(0x80000000) && cLeafs <= UINT32_C(0x8000007f))
    461                 for (ULONG iLeaf = UINT32_C(0x80000000); iLeaf < cLeafs; iLeaf++)
    462                 {
    463                     CHECK_ERROR(Host, GetProcessorCpuIdLeaf(uCpuNo, iLeaf, 0, &uEAX, &uEBX, &uECX, &uEDX));
    464                     RTPrintf("%08x  %08x %08x %08x %08x\n", iLeaf, uEAX, uEBX, uECX, uEDX);
    465                 }
     464            }
    466465        }
    467466        break;
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