VirtualBox

Changeset 22037 in vbox


Ignore:
Timestamp:
Aug 6, 2009 3:27:25 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50775
Message:

VMM: correct report cores count, also expose more CPUID leaves by default

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vm.h

    r22036 r22037  
    692692    uint32_t                    offVMCPU;
    693693
     694    /** Maximum CPUID leaf, exposed to this VM. */
     695    uint32_t                    cCpuidLeafs;
     696
    694697    /** Reserved; alignment. */
    695     uint32_t                    u32Reserved[6];
     698    uint32_t                    u32Reserved[5];
    696699
    697700    /** @name Public VMM Switcher APIs
     
    10011004
    10021005#endif
    1003 
  • trunk/include/VBox/vm.mac

    r19454 r22037  
    5959    .cbSelf                 resd 1
    6060    .offVMCPU               resd 1
    61     .u32Reserved            resd 6
     61    .cCpuidLeafs            resd 1
     62    .u32Reserved            resd 5
    6263
    6364    .pfnVMMGCGuestToHostAsmGuestCtx RTRCPTR_RES 1
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r21961 r22037  
    212212    hrc = pMachine->COMGETTER(CPUCount)(&cCpus);                                    H();
    213213
     214    ULONG cCpuidLeafs = 5;
     215    Bstr osTypeId;
     216    hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam());                     H();
     217    if (osTypeId == "WindowsNT4")
     218    {
     219        /*
     220         * We must limit CPUID count for Windows NT 4 manually,
     221         * as otherwise it stops with 0x3e error
     222         * (MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED).
     223         */
     224        LogRel(("Limiting CPUID leaf count for NT4 guests\n"));
     225        cCpuidLeafs = 2;
     226    }
     227
    214228    /*
    215229     * Get root node first.
     
    230244    rc = CFGMR3InsertInteger(pRoot, "RamHoleSize",          cbRamHole);             RC_CHECK();
    231245    rc = CFGMR3InsertInteger(pRoot, "NumCPUs",              cCpus);                 RC_CHECK();
     246    rc = CFGMR3InsertInteger(pRoot, "CpuidLeafs",           cCpuidLeafs);           RC_CHECK();
    232247    rc = CFGMR3InsertInteger(pRoot, "TimerMillies",         10);                    RC_CHECK();
    233248    rc = CFGMR3InsertInteger(pRoot, "RawR3Enabled",         1);     /* boolean */   RC_CHECK();
     
    266281         */
    267282
    268         Bstr osTypeId;
    269         hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam());                 H();
    270 
    271283        ComPtr<IGuestOSType> guestOSType;
    272284        hrc = virtualBox->GetGuestOSType(osTypeId, guestOSType.asOutParam());       H();
     
    281293        {
    282294            rc = CFGMR3InsertInteger(pHWVirtExt, "64bitEnabled", 1);                RC_CHECK();
    283 #if ARCH_BITS == 32 /* The recompiler must use load VBoxREM64 (32-bit host only). */
     295#if ARCH_BITS == 32 /* The recompiler must use VBoxREM64 (32-bit host only). */
    284296            PCFGMNODE pREM;
    285297            rc = CFGMR3InsertNode(pRoot, "REM", &pREM);                             RC_CHECK();
  • trunk/src/VBox/VMM/CPUM.cpp

    r21353 r22037  
    534534     * info too in these leaves (like words about having a constant TSC).
    535535     */
    536 #if 0
    537     /** @todo NT4 installation regression - investigate */
    538     /** Note from Intel manuals:
    539      * CPUID leaves > 3 < 80000000 are visible only when
    540      * IA32_MISC_ENABLES.BOOT_NT4[bit 22] = 0 (default).
    541      *
    542      */
    543     if (pCPUM->aGuestCpuIdStd[0].eax > 5)
    544         pCPUM->aGuestCpuIdStd[0].eax = 5;
    545 #else
    546     if (pCPUM->aGuestCpuIdStd[0].eax > 2)
    547         pCPUM->aGuestCpuIdStd[0].eax = 2;
    548 #endif
     536    if (pCPUM->aGuestCpuIdStd[0].eax > pVM->cCpuidLeafs)
     537        pCPUM->aGuestCpuIdStd[0].eax = pVM->cCpuidLeafs;
     538
    549539    for (i = pCPUM->aGuestCpuIdStd[0].eax + 1; i < RT_ELEMENTS(pCPUM->aGuestCpuIdStd); i++)
    550540        pCPUM->aGuestCpuIdStd[i] = pCPUM->GuestCpuIdDef;
  • trunk/src/VBox/VMM/VM.cpp

    r20864 r22037  
    594594                    rc = VERR_INVALID_PARAMETER;
    595595                }
     596            }
     597            /*
     598             * Set correct CPUID leafs limit, some guests types,
     599             * notably Win NT 4.0 may wish to override this value.
     600             */
     601            if (RT_SUCCESS(rc))
     602            {
     603                 uint32_t cCpuidLeafs;
     604                 rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "CpuidLeafs", &cCpuidLeafs, 5);
     605                 pVM->cCpuidLeafs = cCpuidLeafs;
    596606            }
    597607            if (RT_SUCCESS(rc))
     
    35723582    return pUVCpu->vm.s.ThreadEMT;
    35733583}
    3574 
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r21252 r22037  
    10651065        pCpuId = &pVM->cpum.s.GuestCpuIdDef;
    10661066
     1067    bool fHasMoreCaches = (*pEcx == 0);
     1068
    10671069    *pEax = pCpuId->eax;
    10681070    *pEbx = pCpuId->ebx;
     
    10761078        Assert(pVCpu->idCpu <= 255);
    10771079        *pEbx |= (pVCpu->idCpu << 24);
     1080   }
     1081
     1082    if ( iLeaf == 4 && fHasMoreCaches &&
     1083         pVM->cpum.s.enmCPUVendor == CPUMCPUVENDOR_INTEL)
     1084    {
     1085        /* Report unified L0 cache, Linux'es num_cpu_cores() requires
     1086         * that to be non-0 to detect core count correctly. */
     1087        *pEax |= (1 << 5) | 3;
    10781088    }
    10791089
     
    20482058    return enmMode;
    20492059}
    2050 
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r21174 r22037  
    19851985    pRegFrame->rax = 0;
    19861986    pRegFrame->rbx = 0;
    1987     pRegFrame->rcx = 0;
     1987    pRegFrame->rcx &= UINT64_C(0x00000000ffffffff);
    19881988    pRegFrame->rdx = 0;
    19891989
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