VirtualBox

Changeset 2633 in vbox


Ignore:
Timestamp:
May 14, 2007 7:09:51 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
21158
Message:

added PDMDevHlpQueryCPUId()

Location:
trunk
Files:
3 edited

Legend:

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

    r2623 r2633  
    53355335    DECLR3CALLBACKMEMBER(int, pfnCMOSRead,(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value));
    53365336
     5337    /**
     5338     * Query CPUID.
     5339     *
     5340     * @param   pDevIns     Device instance.
     5341     * @param   iLeaf       The CPUID leaf to get.
     5342     * @param   pEax        Where to store the EAX value.
     5343     * @param   pEbx        Where to store the EBX value.
     5344     * @param   pEcx        Where to store the ECX value.
     5345     * @param   pEdx        Where to store the EDX value.
     5346     */
     5347    DECLR3CALLBACKMEMBER(void, pfnQueryCPUId,(PPDMDEVINS pDevIns, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx));
     5348
    53375349    /** @} */
    53385350
     
    60516063    return pDevIns->pDevHlp->pfnCMOSRead(pDevIns, iReg, pu8Value);
    60526064}
     6065
     6066/**
     6067 * @copydoc PDMDEVHLP::pfnQueryCPUId
     6068 */
     6069DECLINLINE(void) PDMDevHlpQueryCPUId(PPDMDEVINS pDevIns, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
     6070{
     6071    pDevIns->pDevHlp->pfnQueryCPUId(pDevIns, iLeaf, pEax, pEbx, pEcx, pEdx);
     6072}
    60536073#endif /* IN_RING3 */
    60546074
  • trunk/src/VBox/VMM/PDMDevice.cpp

    r2623 r2633  
    161161static DECLCALLBACK(int) pdmR3DevHlp_CMOSWrite(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value);
    162162static DECLCALLBACK(int) pdmR3DevHlp_CMOSRead(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value);
     163static DECLCALLBACK(void) pdmR3DevHlp_QueryCPUId(PPDMDEVINS pDevIns, uint32_t iLeaf,
     164                                                 uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx);
    163165
    164166static DECLCALLBACK(PVM) pdmR3DevHlp_Untrusted_GetVM(PPDMDEVINS pDevIns);
     
    191193static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_CMOSWrite(PPDMDEVINS pDevIns, unsigned iReg, uint8_t u8Value);
    192194static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_CMOSRead(PPDMDEVINS pDevIns, unsigned iReg, uint8_t *pu8Value);
     195static DECLCALLBACK(void) pdmR3DevHlp_Untrusted_QueryCPUId(PPDMDEVINS pDevIns, uint32_t iLeaf,
     196                                                           uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx);
    193197
    194198/** @} */
     
    351355    pdmR3DevHlp_CMOSWrite,
    352356    pdmR3DevHlp_CMOSRead,
     357    pdmR3DevHlp_QueryCPUId,
    353358    PDM_DEVHLP_VERSION /* the end */
    354359};
     
    436441    pdmR3DevHlp_Untrusted_CMOSWrite,
    437442    pdmR3DevHlp_Untrusted_CMOSRead,
     443    pdmR3DevHlp_Untrusted_QueryCPUId,
    438444    PDM_DEVHLP_VERSION /* the end */
    439445};
     
    35023508
    35033509
     3510/** @copydoc PDMDEVHLP::pfnQueryCPUId */
     3511static DECLCALLBACK(void) pdmR3DevHlp_QueryCPUId(PPDMDEVINS pDevIns, uint32_t iLeaf,
     3512                                                 uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
     3513{
     3514    PDMDEV_ASSERT_DEVINS(pDevIns);
     3515    LogFlow(("pdmR3GetCPUApicHlp_ClearInterruptFF: caller='%s'/%d: fEnabled=%RTbool\n",
     3516             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, fEnabled));
     3517    CPUMGetGuestCpuId(pDevIns->Internal.s.pVMHC, iLeaf, pEax, pEbx, pEcx, pEdx);
     3518}
    35043519
    35053520
     
    37953810
    37963811
     3812/** @copydoc PDMDEVHLP::pfnQueryCPUId */
     3813static DECLCALLBACK(void) pdmR3DevHlp_Untrusted_QueryCPUId(PPDMDEVINS pDevIns, uint32_t iLeaf,
     3814                                                           uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
     3815{
     3816    PDMDEV_ASSERT_DEVINS(pDevIns);
     3817    AssertReleaseMsgFailed(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
     3818}
    37973819
    37983820
     
    39083930        CPUMClearGuestCpuIdFeature(pDevIns->Internal.s.pVMHC, CPUMCPUIDFEATURE_APIC);
    39093931}
    3910 
    39113932
    39123933#ifdef VBOX_WITH_PDM_LOCK
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r2545 r2633  
    900900         */
    901901        case CPUMCPUIDFEATURE_APIC:
    902             /* Don't enable the Local APIC for non-{Intel,AMD} CPUs. Linux (checked with 2.4.26
    903              * and 2.6.21, see apic.c, detect_init_APIC()) gets confused otherwiese. Of course
    904              * this is a bug in the Linux code (it should trust the CPUID instruction) but Windows
    905              * is also known for such assumptions.
    906              * On the other hand we could depend on the APIC set in the host's CPUID but this APIC
    907              * might be (soft) disabled and we want to provide an APIC to the guest if possible. */
    908             if (  (   (   pVM->cpum.s.aGuestCpuIdStd[0].ebx == 0x756e6547 /* Genu */
    909                        && pVM->cpum.s.aGuestCpuIdStd[0].ecx == 0x6c65746e /* ineI */
    910                        && pVM->cpum.s.aGuestCpuIdStd[0].edx == 0x49656e69 /* ntel */)
    911                    || (   pVM->cpum.s.aGuestCpuIdStd[0].ebx == 0x68747541 /* Auth */
    912                        && pVM->cpum.s.aGuestCpuIdStd[0].ecx == 0x69746e65 /* enti */
    913                        && pVM->cpum.s.aGuestCpuIdStd[0].edx == 0x444d4163 /* cAMD */))
    914                 && pVM->cpum.s.aGuestCpuIdStd[0].eax >= 1)
     902            if (pVM->cpum.s.aGuestCpuIdStd[0].eax >= 1)
    915903                pVM->cpum.s.aGuestCpuIdStd[1].edx |= X86_CPUID_FEATURE_EDX_APIC;
    916904            if (    pVM->cpum.s.aGuestCpuIdExt[0].eax >= 0x80000001
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