VirtualBox

Changeset 40234 in vbox for trunk


Ignore:
Timestamp:
Feb 23, 2012 2:48:24 PM (13 years ago)
Author:
vboxsync
Message:

Optionally present basic hypervisor CPUID leaves.

Location:
trunk/src/VBox/VMM
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r40170 r40234  
    14551455    if (iLeaf < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
    14561456        pCpuId = &pVM->cpum.s.aGuestCpuIdStd[iLeaf];
     1457    else if (iLeaf - UINT32_C(0x40000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdHyper))
     1458        if ((pVCpu->CTX_SUFF(pVM)->cpum.s.aGuestCpuIdStd[1].ecx & X86_CPUID_FEATURE_ECX_HVP) != 0)
     1459            pCpuId = &pVM->cpum.s.aGuestCpuIdHyper[iLeaf - UINT32_C(0x40000000)];   /* Only report if HVP bit set. */
    14571460    else if (iLeaf - UINT32_C(0x80000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdExt))
    14581461        pCpuId = &pVM->cpum.s.aGuestCpuIdExt[iLeaf - UINT32_C(0x80000000)];
     
    18841887
    18851888        case CPUMCPUIDFEATURE_HVP:
    1886             if (pVM->cpum.s.aGuestCpuIdExt[0].eax >= 1)
    1887                 pVM->cpum.s.aGuestCpuIdExt[1].ecx &= ~X86_CPUID_FEATURE_ECX_HVP;
     1889            if (pVM->cpum.s.aGuestCpuIdStd[0].eax >= 1)
     1890                pVM->cpum.s.aGuestCpuIdStd[1].ecx &= ~X86_CPUID_FEATURE_ECX_HVP;
    18881891            break;
    18891892
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r40170 r40234  
    906906            pCPUM->aGuestCpuIdCentaur[i] = pCPUM->GuestCpuIdDef;
    907907
     908    /*
     909     * Hypervisor identification.
     910     *
     911     * We only return minimal information, primarily ensuring that the
     912     * 0x40000000 function returns 0x40000001 and identifying ourselves.
     913     * Currently we do not support any hypervisor-specific interface.
     914     */
     915    pCPUM->aGuestCpuIdHyper[0].eax = UINT32_C(0x40000001);
     916    pCPUM->aGuestCpuIdHyper[0].ebx = pCPUM->aGuestCpuIdHyper[0].ecx
     917                                   = pCPUM->aGuestCpuIdHyper[0].edx = 0x786f4256;   /* 'VBox' */
     918    pCPUM->aGuestCpuIdHyper[1].eax = 0x656e6f6e;                            /* 'none' */
     919    pCPUM->aGuestCpuIdHyper[1].ebx = pCPUM->aGuestCpuIdHyper[1].ecx
     920                                   = pCPUM->aGuestCpuIdHyper[1].edx = 0;    /* Reserved */
    908921
    909922    /*
     
    15531566        CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(29) /*reserved*/);
    15541567        CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(30) /*reserved*/);
    1555         CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(31) /*reserved*/);
     1568        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_HVP);
    15561569
    15571570        /* CPUID(1).edx */
     
    17591772    CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(29) /*reserved*/);
    17601773    CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(30) /*reserved*/);
    1761     CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(31) /*reserved*/);
     1774    CPUID_GST_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_HVP);     // Normally not set by host
    17621775
    17631776    /* CPUID(1).edx */
  • trunk/src/VBox/VMM/include/CPUMInternal.h

    r40170 r40234  
    303303    uint8_t                 abPadding[HC_ARCH_BITS == 64 ? 5 : 1];
    304304
    305     /** The standard set of CpuId leafs. */
     305    /** The standard set of CpuId leaves. */
    306306    CPUMCPUID               aGuestCpuIdStd[6];
    307     /** The extended set of CpuId leafs. */
     307    /** The extended set of CpuId leaves. */
    308308    CPUMCPUID               aGuestCpuIdExt[10];
    309     /** The centaur set of CpuId leafs. */
     309    /** The centaur set of CpuId leaves. */
    310310    CPUMCPUID               aGuestCpuIdCentaur[4];
    311     /** The default set of CpuId leafs. */
     311    /** The hypervisor specific set of CpuId leaves. */
     312    CPUMCPUID               aGuestCpuIdHyper[4];
     313    /** The default set of CpuId leaves. */
    312314    CPUMCPUID               GuestCpuIdDef;
    313315
  • trunk/src/VBox/VMM/include/CPUMInternal.mac

    r40170 r40234  
    8080    .aGuestCpuIdExt       resb    16*10
    8181    .aGuestCpuIdCentaur   resb    16*4
     82    .aGuestCpuIdHyper     resb    16*4
    8283    .GuestCpuIdDef        resb    16
    8384
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