VirtualBox

Changeset 12667 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Sep 23, 2008 11:25:46 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
36960
Message:

CPU id passed to interrupt callback, proper typing

File:
1 edited

Legend:

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

    r12634 r12667  
    309309DECLINLINE(APICState*) getLapic(APICDeviceInfo* dev)
    310310{
    311     uint32_t id = dev->CTX_SUFF(pApicHlp)->pfnGetCpuId(dev->CTX_SUFF(pDevIns));
     311    /* LAPIC's array is indexed by CPU id */
     312    VMCPUID id = dev->CTX_SUFF(pApicHlp)->pfnGetCpuId(dev->CTX_SUFF(pDevIns));
    312313    return LAPIC_BASE(dev) + id;
    313314}
    314315
    315 
    316 DECLINLINE(void) cpuSetInterrupt(APICDeviceInfo* dev, uint32_t cpuid)
    317 {
    318     dev->CTX_SUFF(pApicHlp)->pfnSetInterruptFF(dev->CTX_SUFF(pDevIns));
    319 }
    320 
    321 DECLINLINE(void) cpuClearInterrupt(APICDeviceInfo* dev, uint32_t cpuid)
    322 {
    323     dev->CTX_SUFF(pApicHlp)->pfnClearInterruptFF(dev->CTX_SUFF(pDevIns));
    324 }
     316DECLINLINE(VMCPUID) getCpuFromLapic(APICDeviceInfo* dev, APICState *s)
     317{
     318    /* for now we assume LAPIC id == CPU id */
     319    return VMCPUID(s->id);
     320}
     321
     322DECLINLINE(void) cpuSetInterrupt(APICDeviceInfo* dev, APICState *s)
     323{
     324    dev->CTX_SUFF(pApicHlp)->pfnSetInterruptFF(dev->CTX_SUFF(pDevIns),
     325                                               getCpuFromLapic(dev, s));
     326}
     327
     328DECLINLINE(void) cpuClearInterrupt(APICDeviceInfo* dev, APICState *s)
     329{
     330    dev->CTX_SUFF(pApicHlp)->pfnClearInterruptFF(dev->CTX_SUFF(pDevIns),
     331                                                 getCpuFromLapic(dev, s));
     332}
     333
     334
    325335#endif /* VBOX */
    326336
     
    393403            /** @todo: what do we really do with SMI */
    394404            foreach_apic(dev, deliver_bitmask,
    395                          cpuSetInterrupt(dev, apic->id));
     405                         cpuSetInterrupt(dev, apic));
    396406            return;
    397407
     
    399409            /** @todo: what do we really do with NMI */
    400410            foreach_apic(dev, deliver_bitmask,
    401                          cpuSetInterrupt(dev, apic->id));
     411                         cpuSetInterrupt(dev, apic));
    402412            return;
    403413
     
    470480
    471481        /* Clear any pending APIC interrupt action flag. */
    472         cpuClearInterrupt(dev, s->id);
     482        cpuClearInterrupt(dev, s);
    473483        dev->CTX_SUFF(pApicHlp)->pfnChangeFeature(pDevIns, false);
    474484    }
     
    632642    {
    633643        /* Clear any pending APIC interrupt action flag. */
    634         cpuClearInterrupt(dev, s->id);
     644        cpuClearInterrupt(dev, s);
    635645        return false;
    636646    }
     
    647657    cpu_interrupt(s->cpu_env, CPU_INTERRUPT_HARD);
    648658#else
    649     cpuSetInterrupt(dev, s->id);
     659    cpuSetInterrupt(dev, s);
    650660    return true;
    651661#endif
     
    693703        Log(("apic_update_tpr: deactivate interrupt that was masked by the TPR update (%x)\n", val));
    694704        STAM_COUNTER_INC(&dev->StatClearedActiveIrq);
    695         cpuClearInterrupt(dev, s->id);
     705        cpuClearInterrupt(dev, s);
    696706    }
    697707}
     
    18041814    dev->pApicHlpR3->pfnChangeFeature(dev->pDevInsR3, true);
    18051815    /* Clear any pending APIC interrupt action flag. */
    1806     cpuClearInterrupt(dev, s->id);
     1816    cpuClearInterrupt(dev, s);
    18071817    APIC_UNLOCK(dev);
    18081818}
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