VirtualBox

Changeset 10492 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 11, 2008 8:14:13 AM (16 years ago)
Author:
vboxsync
Message:

Added PDMApicHasPendingIrq.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevAPIC.cpp

    r10477 r10492  
    267267PDMBOTHCBDECL(int)  apicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb);
    268268PDMBOTHCBDECL(int)  apicGetInterrupt(PPDMDEVINS pDevIns);
     269PDMBOTHCBDECL(bool) apicHasPendingIrq(PPDMDEVINS pDevIns);
    269270PDMBOTHCBDECL(void) apicSetBase(PPDMDEVINS pDevIns, uint64_t val);
    270271PDMBOTHCBDECL(uint64_t) apicGetBase(PPDMDEVINS pDevIns);
     
    761762    return intno;
    762763}
     764
     765/* Check if the APIC has a pending interrupt/if a TPR change would active one. */
     766PDMBOTHCBDECL(bool) apicHasPendingIrq(PPDMDEVINS pDevIns)
     767{
     768    APICState *s = PDMINS2DATA(pDevIns, APICState *);
     769    return false;
     770}
     771
    763772
    764773static uint32_t apic_get_current_count(APICState *s)
     
    16801689     * Register the APIC.
    16811690     */
    1682     ApicReg.u32Version          = PDM_APICREG_VERSION;
    1683     ApicReg.pfnGetInterruptHC   = apicGetInterrupt;
    1684     ApicReg.pfnSetBaseHC        = apicSetBase;
    1685     ApicReg.pfnGetBaseHC        = apicGetBase;
    1686     ApicReg.pfnSetTPRHC         = apicSetTPR;
    1687     ApicReg.pfnGetTPRHC         = apicGetTPR;
    1688     ApicReg.pfnBusDeliverHC     = apicBusDeliverCallback;
     1691    ApicReg.u32Version              = PDM_APICREG_VERSION;
     1692    ApicReg.pfnGetInterruptHC       = apicGetInterrupt;
     1693    ApicReg.pfnHasPendingIrqHC      = apicHasPendingIrq;
     1694    ApicReg.pfnSetBaseHC            = apicSetBase;
     1695    ApicReg.pfnGetBaseHC            = apicGetBase;
     1696    ApicReg.pfnSetTPRHC             = apicSetTPR;
     1697    ApicReg.pfnGetTPRHC             = apicGetTPR;
     1698    ApicReg.pfnBusDeliverHC         = apicBusDeliverCallback;
    16891699    if (fGCEnabled) {
    16901700        ApicReg.pszGetInterruptGC   = "apicGetInterrupt";
     1701        ApicReg.pszHasPendingIrqGC  = "apicHasPendingIrq";
    16911702        ApicReg.pszSetBaseGC        = "apicSetBase";
    16921703        ApicReg.pszGetBaseGC        = "apicGetBase";
     
    16961707    } else {
    16971708        ApicReg.pszGetInterruptGC   = NULL;
     1709        ApicReg.pszHasPendingIrqGC  = NULL;
    16981710        ApicReg.pszSetBaseGC        = NULL;
    16991711        ApicReg.pszGetBaseGC        = NULL;
     
    17041716    if (fR0Enabled) {
    17051717        ApicReg.pszGetInterruptR0   = "apicGetInterrupt";
     1718        ApicReg.pszHasPendingIrqR0  = "apicHasPendingIrq";
    17061719        ApicReg.pszSetBaseR0        = "apicSetBase";
    17071720        ApicReg.pszGetBaseR0        = "apicGetBase";
     
    17111724    } else {
    17121725        ApicReg.pszGetInterruptR0   = NULL;
     1726        ApicReg.pszHasPendingIrqR0  = NULL;
    17131727        ApicReg.pszSetBaseR0        = NULL;
    17141728        ApicReg.pszGetBaseR0        = NULL;
  • trunk/src/VBox/VMM/PDMDevice.cpp

    r10202 r10492  
    26452645    }
    26462646    if (    !pApicReg->pfnGetInterruptHC
     2647        ||  !pApicReg->pfnHasPendingIrqHC
    26472648        ||  !pApicReg->pfnSetBaseHC
    26482649        ||  !pApicReg->pfnGetBaseHC
     
    26522653    {
    26532654        Assert(pApicReg->pfnGetInterruptHC);
     2655        Assert(pApicReg->pfnHasPendingIrqHC);
    26542656        Assert(pApicReg->pfnSetBaseHC);
    26552657        Assert(pApicReg->pfnGetBaseHC);
     
    26612663    }
    26622664    if (   (    pApicReg->pszGetInterruptGC
     2665            ||  pApicReg->pszHasPendingIrqGC
    26632666            ||  pApicReg->pszSetBaseGC
    26642667            ||  pApicReg->pszGetBaseGC
     
    26672670            ||  pApicReg->pszBusDeliverGC)
    26682671        &&  (   !VALID_PTR(pApicReg->pszGetInterruptGC)
     2672            ||  !VALID_PTR(pApicReg->pszHasPendingIrqGC)
    26692673            ||  !VALID_PTR(pApicReg->pszSetBaseGC)
    26702674            ||  !VALID_PTR(pApicReg->pszGetBaseGC)
     
    26752679    {
    26762680        Assert(VALID_PTR(pApicReg->pszGetInterruptGC));
     2681        Assert(VALID_PTR(pApicReg->pszHasPendingIrqGC));
    26772682        Assert(VALID_PTR(pApicReg->pszSetBaseGC));
    26782683        Assert(VALID_PTR(pApicReg->pszGetBaseGC));
     
    26842689    }
    26852690    if (   (    pApicReg->pszGetInterruptR0
     2691            ||  pApicReg->pszHasPendingIrqR0
    26862692            ||  pApicReg->pszSetBaseR0
    26872693            ||  pApicReg->pszGetBaseR0
     
    26902696            ||  pApicReg->pszBusDeliverR0)
    26912697        &&  (   !VALID_PTR(pApicReg->pszGetInterruptR0)
     2698            ||  !VALID_PTR(pApicReg->pszHasPendingIrqR0)
    26922699            ||  !VALID_PTR(pApicReg->pszSetBaseR0)
    26932700            ||  !VALID_PTR(pApicReg->pszGetBaseR0)
     
    26982705    {
    26992706        Assert(VALID_PTR(pApicReg->pszGetInterruptR0));
     2707        Assert(VALID_PTR(pApicReg->pszHasPendingIrqR0));
    27002708        Assert(VALID_PTR(pApicReg->pszSetBaseR0));
    27012709        Assert(VALID_PTR(pApicReg->pszGetBaseR0));
     
    27332741        if (RT_SUCCESS(rc))
    27342742        {
     2743            rc = PDMR3GetSymbolGCLazy(pVM, pDevIns->pDevReg->szGCMod, pApicReg->pszHasPendingIrqGC, &pVM->pdm.s.Apic.pfnHasPendingIrqGC);
     2744            AssertMsgRC(rc, ("%s::%s rc=%Vrc\n", pDevIns->pDevReg->szGCMod, pApicReg->pszHasPendingIrqGC, rc));
     2745        }
     2746        if (RT_SUCCESS(rc))
     2747        {
    27352748            rc = PDMR3GetSymbolGCLazy(pVM, pDevIns->pDevReg->szGCMod, pApicReg->pszSetBaseGC, &pVM->pdm.s.Apic.pfnSetBaseGC);
    27362749            AssertMsgRC(rc, ("%s::%s rc=%Vrc\n", pDevIns->pDevReg->szGCMod, pApicReg->pszSetBaseGC, rc));
     
    27672780        pVM->pdm.s.Apic.pDevInsGC           = 0;
    27682781        pVM->pdm.s.Apic.pfnGetInterruptGC   = 0;
     2782        pVM->pdm.s.Apic.pfnHasPendingIrqGC  = 0;
    27692783        pVM->pdm.s.Apic.pfnSetBaseGC        = 0;
    27702784        pVM->pdm.s.Apic.pfnGetBaseGC        = 0;
     
    27832797        if (RT_SUCCESS(rc))
    27842798        {
     2799            rc = PDMR3GetSymbolR0Lazy(pVM, pDevIns->pDevReg->szR0Mod, pApicReg->pszHasPendingIrqR0, &pVM->pdm.s.Apic.pfnHasPendingIrqR0);
     2800            AssertMsgRC(rc, ("%s::%s rc=%Vrc\n", pDevIns->pDevReg->szR0Mod, pApicReg->pszHasPendingIrqR0, rc));
     2801        }
     2802        if (RT_SUCCESS(rc))
     2803        {
    27852804            rc = PDMR3GetSymbolR0Lazy(pVM, pDevIns->pDevReg->szR0Mod, pApicReg->pszSetBaseR0, &pVM->pdm.s.Apic.pfnSetBaseR0);
    27862805            AssertMsgRC(rc, ("%s::%s rc=%Vrc\n", pDevIns->pDevReg->szR0Mod, pApicReg->pszSetBaseR0, rc));
     
    28172836    {
    28182837        pVM->pdm.s.Apic.pfnGetInterruptR0   = 0;
     2838        pVM->pdm.s.Apic.pfnHasPendingIrqR0  = 0;
    28192839        pVM->pdm.s.Apic.pfnSetBaseR0        = 0;
    28202840        pVM->pdm.s.Apic.pfnGetBaseR0        = 0;
     
    28302850    pVM->pdm.s.Apic.pDevInsR3           = pDevIns;
    28312851    pVM->pdm.s.Apic.pfnGetInterruptR3   = pApicReg->pfnGetInterruptHC;
     2852    pVM->pdm.s.Apic.pfnHasPendingIrqR3  = pApicReg->pfnHasPendingIrqHC;
    28322853    pVM->pdm.s.Apic.pfnSetBaseR3        = pApicReg->pfnSetBaseHC;
    28332854    pVM->pdm.s.Apic.pfnGetBaseR3        = pApicReg->pfnGetBaseHC;
  • trunk/src/VBox/VMM/PDMInternal.h

    r10202 r10492  
    388388    /** @copydoc PDMAPICREG::pfnGetInterruptHC */
    389389    DECLR3CALLBACKMEMBER(int,       pfnGetInterruptR3,(PPDMDEVINS pDevIns));
     390    /** @copydoc PDMAPICREG::pfnHasPendingIrqHC */
     391    DECLR3CALLBACKMEMBER(bool, pfnHasPendingIrqR3,(PPDMDEVINS pDevIns));
    390392    /** @copydoc PDMAPICREG::pfnSetBaseHC */
    391393    DECLR3CALLBACKMEMBER(void,      pfnSetBaseR3,(PPDMDEVINS pDevIns, uint64_t u64Base));
     
    404406    /** @copydoc PDMAPICREG::pfnGetInterruptHC */
    405407    DECLR0CALLBACKMEMBER(int,       pfnGetInterruptR0,(PPDMDEVINS pDevIns));
     408    /** @copydoc PDMAPICREG::pfnHasPendingIrqHC */
     409    DECLR0CALLBACKMEMBER(bool, pfnHasPendingIrqR0,(PPDMDEVINS pDevIns));
    406410    /** @copydoc PDMAPICREG::pfnSetBaseHC */
    407411    DECLR0CALLBACKMEMBER(void,      pfnSetBaseR0,(PPDMDEVINS pDevIns, uint64_t u64Base));
     
    420424    /** @copydoc PDMAPICREG::pfnGetInterruptHC */
    421425    DECLGCCALLBACKMEMBER(int,       pfnGetInterruptGC,(PPDMDEVINS pDevIns));
     426    /** @copydoc PDMAPICREG::pfnHasPendingIrqHC */
     427    DECLGCCALLBACKMEMBER(bool, pfnHasPendingIrqGC,(PPDMDEVINS pDevIns));
    422428    /** @copydoc PDMAPICREG::pfnSetBaseHC */
    423429    DECLGCCALLBACKMEMBER(void,      pfnSetBaseGC,(PPDMDEVINS pDevIns, uint64_t u64Base));
  • trunk/src/VBox/VMM/VMMAll/PDMAll.cpp

    r10202 r10492  
    188188
    189189/**
     190 * Check if the APIC has a pending interrupt/if a TPR change would active one
     191 *
     192 * @returns Pending interrupt yes/no
     193 * @param   pDevIns         Device instance of the APIC.
     194 * @param   pfPending       Pending state (out)
     195 */
     196PDMDECL(int) PDMApicHasPendingIrq(PVM pVM, bool *pfPending)
     197{
     198    if (pVM->pdm.s.Apic.CTXALLSUFF(pDevIns))
     199    {
     200        Assert(pVM->pdm.s.Apic.CTXALLSUFF(pfnSetTPR));
     201        pdmLock(pVM);
     202        *pfPending = pVM->pdm.s.Apic.CTXALLSUFF(pfnHasPendingIrq)(pVM->pdm.s.Apic.CTXALLSUFF(pDevIns));
     203        pdmUnlock(pVM);
     204        return VINF_SUCCESS;
     205    }
     206    return VERR_PDM_NO_APIC_INSTANCE;
     207}
     208
     209/**
    190210 * Set the TPR (task priority register?).
    191211 *
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