VirtualBox

Changeset 52697 in vbox


Ignore:
Timestamp:
Sep 11, 2014 12:54:06 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
96032
Message:

VMM/CPUM: Dump hypervisor CPUID leaves to the release log.

File:
1 edited

Legend:

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

    r52551 r52697  
    16611661     * We only return minimal information, primarily ensuring that the
    16621662     * 0x40000000 function returns 0x40000001 and identifying ourselves.
    1663      * Currently we do not support any hypervisor-specific interface.
     1663     * Hypervisor-specific interface is supported through GIM which will
     1664     * modify these leaves if required depending on the GIM provider.
    16641665     */
    16651666    NewLeaf.uLeaf        = UINT32_C(0x40000000);
     
    42594260
    42604261    /*
     4262     * Hypervisor leaves.
     4263     *
     4264     * Unlike most of the other leaves reported, the guest hypervisor leaves
     4265     * aren't a subset of the host CPUID bits.
     4266     */
     4267    RT_ZERO(Host);
     4268    if (cStdHstMax >= 1)
     4269        ASMCpuIdExSlow(1, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     4270    bool fHostHvp  = RT_BOOL(Host.ecx & X86_CPUID_FEATURE_ECX_HVP);
     4271    bool fGuestHvp = false;
     4272    if (cStdMax >= 1)
     4273    {
     4274        Guest     = pVM->cpum.s.aGuestCpuIdStd[1];
     4275        fGuestHvp = RT_BOOL(Guest.ecx & X86_CPUID_FEATURE_ECX_HVP);
     4276    }
     4277
     4278    if (   fHostHvp
     4279        || fGuestHvp)
     4280    {
     4281        uint32_t const uHyperLeaf  = 0x40000000;
     4282        pHlp->pfnPrintf(pHlp,
     4283                        "\n"
     4284                        "         Hypervisor CPUIDs\n"
     4285                        "     Function  eax      ebx      ecx      edx\n");
     4286
     4287        PCCPUMCPUIDLEAF pHyperLeafGst = NULL;
     4288        if (fGuestHvp)
     4289        {
     4290            pHyperLeafGst = cpumR3CpuIdGetLeaf(pVM->cpum.s.GuestInfo.paCpuIdLeavesR3, pVM->cpum.s.GuestInfo.cCpuIdLeaves,
     4291                                                       uHyperLeaf, 0 /* uSubLeaf */);
     4292        }
     4293
     4294        RT_ZERO(Host);
     4295        if (fHostHvp)
     4296            ASMCpuIdExSlow(uHyperLeaf, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     4297
     4298        CPUMCPUIDLEAF  GuestLeaf;
     4299        uint32_t const cHyperGstMax = pHyperLeafGst->uEax;
     4300        uint32_t const cHyperHstMax = Host.eax;
     4301        uint32_t const cHyperMax    = RT_MAX(cHyperHstMax, cHyperGstMax);
     4302        for (unsigned i = uHyperLeaf; i <= cHyperMax; i++)
     4303        {
     4304            RT_ZERO(Host);
     4305            RT_ZERO(GuestLeaf);
     4306            if (i <= cHyperHstMax)
     4307                ASMCpuIdExSlow(i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
     4308            CPUMR3CpuIdGetLeaf(pVM, &GuestLeaf, i, 0 /* uSubLeaf */);
     4309            if (!fHostHvp)
     4310            {
     4311                pHlp->pfnPrintf(pHlp,
     4312                                "Gst: %08x  %08x %08x %08x %08x\n",
     4313                                i, GuestLeaf.uEax, GuestLeaf.uEbx, GuestLeaf.uEcx, GuestLeaf.uEdx);
     4314            }
     4315            else
     4316            {
     4317                pHlp->pfnPrintf(pHlp,
     4318                                "Gst: %08x  %08x %08x %08x %08x%s\n"
     4319                                "Hst:           %08x %08x %08x %08x%s\n",
     4320                                i, GuestLeaf.uEax, GuestLeaf.uEbx, GuestLeaf.uEcx, GuestLeaf.uEdx,
     4321                                i <= cHyperGstMax ? "" : "*",
     4322                                Host.eax, Host.ebx, Host.ecx, Host.edx, i <= cHyperHstMax ? "" : "*");
     4323            }
     4324        }
     4325    }
     4326
     4327    /*
    42614328     * Centaur.
    42624329     */
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