VirtualBox

Changeset 10569 in vbox


Ignore:
Timestamp:
Jul 12, 2008 3:59:27 PM (17 years ago)
Author:
vboxsync
Message:

Expose cpuid 2-5 minus dangerous bits.

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

Legend:

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

    r10567 r10569  
    343343    pCPUM->aGuestCpuIdStd[1].ebx &= 0x0000ffff;
    344344
     345    /* Cpuid 2:
     346     * Intel: Cache and TLB information
     347     * AMD:   Reserved
     348     * Safe to expose
     349     */
     350
     351    /* Cpuid 3:
     352     * Intel: EAX, EBX - reserved
     353     *        ECX, EDX - Processor Serial Number if available, otherwise reserved
     354     * AMD:   Reserved
     355     * Safe to expose
     356     */
     357    if (!(pCPUM->aGuestCpuIdStd[1].edx & X86_CPUID_FEATURE_EDX_PSN))
     358        pCPUM->aGuestCpuIdStd[3].ecx = pCPUM->aGuestCpuIdStd[3].edx = 0;
     359
     360    /* Cpuid 4:
     361     * Intel: Deterministic Cache Parameters Leaf
     362     *        Note: Depends on the ECX input! -> Feeling rather lazy now, so we just return 0
     363     * AMD:   Reserved
     364     * Safe to expose, except for EAX:
     365     *      Bits 25-14: Maximum number of threads sharing this cache in a physical package (see note)**
     366     *      Bits 31-26: Maximum number of processor cores in this physical package**
     367     */
     368    pCPUM->aGuestCpuIdStd[4].ecx = pCPUM->aGuestCpuIdStd[4].edx = 0;
     369    pCPUM->aGuestCpuIdStd[4].eax = pCPUM->aGuestCpuIdStd[4].ebx = 0;
     370
     371    /* Cpuid 5:     Monitor/mwait Leaf
     372     * Intel: ECX, EDX - reserved
     373     *        EAX, EBX - Smallest and largest monitor line size
     374     * AMD:   EDX - reserved
     375     *        EAX, EBX - Smallest and largest monitor line size
     376     *        ECX - extensions (ignored for now)
     377     * Safe to expose
     378     */
     379    pCPUM->aGuestCpuIdStd[5].ecx = pCPUM->aGuestCpuIdStd[5].edx = 0;
     380
    345381    /*
    346382     * Determine the default.
     
    739775    uint32_t cElements;
    740776    int rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
    741     if (cElements != ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
     777    /* Support old saved states with a smaller standard cpuid array. */
     778    if (cElements > ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
    742779        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
    743     SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdStd[0], sizeof(pVM->cpum.s.aGuestCpuIdStd));
     780    SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdStd[0], cElements*sizeof(pVM->cpum.s.aGuestCpuIdStd[0]));
    744781
    745782    rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
  • trunk/src/VBox/VMM/CPUMInternal.h

    r9354 r10569  
    336336
    337337    /** The standard set of CpuId leafs. */
    338     CPUMCPUID               aGuestCpuIdStd[5];
     338    CPUMCPUID               aGuestCpuIdStd[6];
    339339    /** The extended set of CpuId leafs. */
    340340    CPUMCPUID               aGuestCpuIdExt[10];
  • trunk/src/VBox/VMM/CPUMInternal.mac

    r10353 r10569  
    420420
    421421    ; CPUID leafs
    422     .aGuestCpuIdStd       resb    16*5
     422    .aGuestCpuIdStd       resb    16*6
    423423    .aGuestCpuIdExt       resb    16*10
    424424    .aGuestCpuIdCentaur   resb    16*4
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