VirtualBox

Changeset 12667 in vbox for trunk/src


Ignore:
Timestamp:
Sep 23, 2008 11:25:46 AM (16 years ago)
Author:
vboxsync
Message:

CPU id passed to interrupt callback, proper typing

Location:
trunk/src/VBox
Files:
5 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}
  • trunk/src/VBox/VMM/PDMDevice.cpp

    r12653 r12667  
    230230 * @{
    231231 */
    232 static DECLCALLBACK(void) pdmR3ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns);
    233 static DECLCALLBACK(void) pdmR3ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns);
     232static DECLCALLBACK(void) pdmR3ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid);
     233static DECLCALLBACK(void) pdmR3ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid);
    234234static DECLCALLBACK(void) pdmR3ApicHlp_ChangeFeature(PPDMDEVINS pDevIns, bool fEnabled);
    235235static DECLCALLBACK(int) pdmR3ApicHlp_Lock(PPDMDEVINS pDevIns, int rc);
    236236static DECLCALLBACK(void) pdmR3ApicHlp_Unlock(PPDMDEVINS pDevIns);
    237 static DECLCALLBACK(uint32_t) pdmR3ApicHlp_GetCpuId(PPDMDEVINS pDevIns);
     237static DECLCALLBACK(VMCPUID) pdmR3ApicHlp_GetCpuId(PPDMDEVINS pDevIns);
    238238static DECLCALLBACK(PCPDMAPICHLPRC) pdmR3ApicHlp_GetRCHelpers(PPDMDEVINS pDevIns);
    239239static DECLCALLBACK(PCPDMAPICHLPR0) pdmR3ApicHlp_GetR0Helpers(PPDMDEVINS pDevIns);
     
    40734073
    40744074/** @copydoc PDMAPICHLPR3::pfnSetInterruptFF */
    4075 static DECLCALLBACK(void) pdmR3ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns)
     4075static DECLCALLBACK(void) pdmR3ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid)
    40764076{
    40774077    PDMDEV_ASSERT_DEVINS(pDevIns);
     
    40864086
    40874087/** @copydoc PDMAPICHLPR3::pfnClearInterruptFF */
    4088 static DECLCALLBACK(void) pdmR3ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns)
     4088static DECLCALLBACK(void) pdmR3ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid)
    40894089{
    40904090    PDMDEV_ASSERT_DEVINS(pDevIns);
     
    41004100{
    41014101    PDMDEV_ASSERT_DEVINS(pDevIns);
    4102     LogFlow(("pdmR3ApicHlp_ClearInterruptFF: caller='%s'/%d: fEnabled=%RTbool\n",
     4102    LogFlow(("pdmR3ApicHlp_ChangeFeature: caller='%s'/%d: fEnabled=%RTbool\n",
    41034103             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, fEnabled));
    41044104    if (fEnabled)
     
    41254125
    41264126/** @copydoc PDMAPICHLPR3::pfnGetCpuId */
    4127 static DECLCALLBACK(uint32_t) pdmR3ApicHlp_GetCpuId(PPDMDEVINS pDevIns)
     4127static DECLCALLBACK(VMCPUID) pdmR3ApicHlp_GetCpuId(PPDMDEVINS pDevIns)
    41284128{
    41294129    PDMDEV_ASSERT_DEVINS(pDevIns);
  • trunk/src/VBox/VMM/VMMAll/VMMAll.cpp

    r12573 r12667  
    6767 * @thread  EMT
    6868 */
    69 uint32_t VMMGetCpuId(PVM pVM)
     69VMCPUID VMMGetCpuId(PVM pVM)
    7070{
    71 #ifdef VBOX_WITH_GUEST_SMPT
     71#ifdef VBOX_WITH_SMP_GUESTS
     72    /* Only emulation thread(s) allowed to ask for CPU id */
     73    VM_ASSERT_EMT(pVM);
     74
    7275# if defined(IN_GC)
    7376    /* There is only one CPU if we're in GC. */
  • trunk/src/VBox/VMM/VMMGC/PDMGCDevice.cpp

    r12653 r12667  
    9999 * @{
    100100 */
    101 static DECLCALLBACK(void) pdmRCApicHlp_SetInterruptFF(PPDMDEVINS pDevIns);
    102 static DECLCALLBACK(void) pdmRCApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns);
     101static DECLCALLBACK(void) pdmRCApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid);
     102static DECLCALLBACK(void) pdmRCApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid);
    103103static DECLCALLBACK(void) pdmRCApicHlp_ChangeFeature(PPDMDEVINS pDevIns, bool fEnabled);
    104104static DECLCALLBACK(int) pdmRCApicHlp_Lock(PPDMDEVINS pDevIns, int rc);
    105105static DECLCALLBACK(void) pdmRCApicHlp_Unlock(PPDMDEVINS pDevIns);
    106 static DECLCALLBACK(uint32_t) pdmRCApicHlp_GetCpuId(PPDMDEVINS pDevIns);
     106static DECLCALLBACK(VMCPUID) pdmRCApicHlp_GetCpuId(PPDMDEVINS pDevIns);
    107107/** @} */
    108108
     
    393393
    394394/** @copydoc PDMAPICHLPRC::pfnSetInterruptFF */
    395 static DECLCALLBACK(void) pdmRCApicHlp_SetInterruptFF(PPDMDEVINS pDevIns)
     395static DECLCALLBACK(void) pdmRCApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid)
    396396{
    397397    PDMDEV_ASSERT_DEVINS(pDevIns);
     
    403403
    404404/** @copydoc PDMAPICHLPRC::pfnClearInterruptFF */
    405 static DECLCALLBACK(void) pdmRCApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns)
     405static DECLCALLBACK(void) pdmRCApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid)
    406406{
    407407    PDMDEV_ASSERT_DEVINS(pDevIns);
     
    441441
    442442/** @copydoc PDMAPICHLPRC::pfnGetCpuId */
    443 static DECLCALLBACK(uint32_t) pdmRCApicHlp_GetCpuId(PPDMDEVINS pDevIns)
     443static DECLCALLBACK(VMCPUID) pdmRCApicHlp_GetCpuId(PPDMDEVINS pDevIns)
    444444{
    445445    PDMDEV_ASSERT_DEVINS(pDevIns);
    446446    return VMMGetCpuId(pDevIns->Internal.s.pVMGC);
    447447}
    448 
    449 
    450 
    451448
    452449/** @copydoc PDMIOAPICHLPRC::pfnApicBusDeliver */
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r12653 r12667  
    9999 * @{
    100100 */
    101 static DECLCALLBACK(void) pdmR0ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns);
    102 static DECLCALLBACK(void) pdmR0ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns);
     101static DECLCALLBACK(void) pdmR0ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid);
     102static DECLCALLBACK(void) pdmR0ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid);
    103103static DECLCALLBACK(void) pdmR0ApicHlp_ChangeFeature(PPDMDEVINS pDevIns, bool fEnabled);
    104104static DECLCALLBACK(int) pdmR0ApicHlp_Lock(PPDMDEVINS pDevIns, int rc);
    105105static DECLCALLBACK(void) pdmR0ApicHlp_Unlock(PPDMDEVINS pDevIns);
    106 static DECLCALLBACK(uint32_t) pdmR0ApicHlp_GetCpuId(PPDMDEVINS pDevIns);
     106static DECLCALLBACK(VMCPUID) pdmR0ApicHlp_GetCpuId(PPDMDEVINS pDevIns);
    107107/** @} */
    108108
     
    397397
    398398/** @copydoc PDMAPICHLPR0::pfnSetInterruptFF */
    399 static DECLCALLBACK(void) pdmR0ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns)
     399static DECLCALLBACK(void) pdmR0ApicHlp_SetInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid)
    400400{
    401401    PDMDEV_ASSERT_DEVINS(pDevIns);
     
    407407
    408408/** @copydoc PDMAPICHLPR0::pfnClearInterruptFF */
    409 static DECLCALLBACK(void) pdmR0ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns)
     409static DECLCALLBACK(void) pdmR0ApicHlp_ClearInterruptFF(PPDMDEVINS pDevIns, VMCPUID cpuid)
    410410{
    411411    PDMDEV_ASSERT_DEVINS(pDevIns);
     
    445445
    446446/** @copydoc PDMAPICHLPR0::pfnGetCpuId */
    447 static DECLCALLBACK(uint32_t) pdmR0ApicHlp_GetCpuId(PPDMDEVINS pDevIns)
     447static DECLCALLBACK(VMCPUID) pdmR0ApicHlp_GetCpuId(PPDMDEVINS pDevIns)
    448448{
    449449    PDMDEV_ASSERT_DEVINS(pDevIns);
    450450    return VMMGetCpuId(pDevIns->Internal.s.pVMHC);
    451451}
    452 
    453 
    454452
    455453
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