VirtualBox

vbox的更動 11264 路徑 trunk/src/VBox/Devices/PC


忽略:
時間撮記:
2008-8-8 下午03:52:17 (16 年 以前)
作者:
vboxsync
訊息:

DevPIC: pData -> pThis.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/PC/DevPIC.cpp

    r11263 r11264  
    153153static inline void DumpPICState(PicState *s, const char *szFn)
    154154{
    155     PDEVPIC pData = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC);
     155    PDEVPIC pThis = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC);
    156156
    157157    Log2(("%s: pic%d: elcr=%x last_irr=%x irr=%x imr=%x isr=%x irq_base=%x\n",
    158         szFn, (&pData->aPics[0] == s) ? 0 : 1,
     158        szFn, (&pThis->aPics[0] == s) ? 0 : 1,
    159159          s->elcr, s->last_irr, s->irr, s->imr, s->isr, s->irq_base));
    160160}
    161161#else
    162 # define DumpPICState(pData, szFn) do { } while (0)
     162# define DumpPICState(pThis, szFn) do { } while (0)
    163163#endif
    164164
     
    240240/* raise irq to CPU if necessary. must be called every time the active
    241241   irq may change */
    242 static int pic_update_irq(PDEVPIC pData)
    243 {
    244     PicState *pics = &pData->aPics[0];
     242static int pic_update_irq(PDEVPIC pThis)
     243{
     244    PicState *pics = &pThis->aPics[0];
    245245    int irq2, irq;
    246246
     
    271271            Log(("pic: cpu_interrupt\n"));
    272272#endif
    273             pData->CTX_SUFF(pPicHlp)->pfnSetInterruptFF(pData->CTX_SUFF(pDevIns));
     273            pThis->CTX_SUFF(pPicHlp)->pfnSetInterruptFF(pThis->CTX_SUFF(pDevIns));
    274274        }
    275275        else
    276276        {
    277             STAM_COUNTER_INC(&pData->StatClearedActiveIRQ2);
     277            STAM_COUNTER_INC(&pThis->StatClearedActiveIRQ2);
    278278            Log(("pic_update_irq: irq 2 is active, but no interrupt is pending on the slave pic!!\n"));
    279279            /* Clear it here, so lower priority interrupts can still be dispatched. */
    280280
    281281            /* if this was the only pending irq, then we must clear the interrupt ff flag */
    282             pData->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pData->CTX_SUFF(pDevIns));
     282            pThis->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pThis->CTX_SUFF(pDevIns));
    283283
    284284            /** @note Is this correct? */
     
    286286
    287287            /* Call ourselves again just in case other interrupts are pending */
    288             return pic_update_irq(pData);
     288            return pic_update_irq(pThis);
    289289        }
    290290    }
     
    294294
    295295        /* we must clear the interrupt ff flag */
    296         pData->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pData->CTX_SUFF(pDevIns));
     296        pThis->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pThis->CTX_SUFF(pDevIns));
    297297    }
    298298    return VINF_SUCCESS;
     
    300300
    301301/** @note if an interrupt line state changes from unmasked to masked, then it must be deactivated when currently pending! */
    302 static void pic_update_imr(PDEVPIC pData, PicState *s, uint8_t val)
     302static void pic_update_imr(PDEVPIC pThis, PicState *s, uint8_t val)
    303303{
    304304    int       irq, intno;
     
    306306
    307307    /* Query the current pending irq, if any. */
    308     pActivePIC = &pData->aPics[0];
     308    pActivePIC = &pThis->aPics[0];
    309309    intno = irq = pic_get_irq(pActivePIC);
    310310    if (irq == 2)
    311311    {
    312         pActivePIC = &pData->aPics[1];
     312        pActivePIC = &pThis->aPics[1];
    313313        irq = pic_get_irq(pActivePIC);
    314314        intno = irq + 8;
     
    323323    {
    324324        Log(("pic_update_imr: pic0: elcr=%x last_irr=%x irr=%x imr=%x isr=%x irq_base=%x\n",
    325             pData->aPics[0].elcr, pData->aPics[0].last_irr, pData->aPics[0].irr, pData->aPics[0].imr, pData->aPics[0].isr, pData->aPics[0].irq_base));
     325            pThis->aPics[0].elcr, pThis->aPics[0].last_irr, pThis->aPics[0].irr, pThis->aPics[0].imr, pThis->aPics[0].isr, pThis->aPics[0].irq_base));
    326326        Log(("pic_update_imr: pic1: elcr=%x last_irr=%x irr=%x imr=%x isr=%x irq_base=%x\n",
    327             pData->aPics[1].elcr, pData->aPics[1].last_irr, pData->aPics[1].irr, pData->aPics[1].imr, pData->aPics[1].isr, pData->aPics[1].irq_base));
     327            pThis->aPics[1].elcr, pThis->aPics[1].last_irr, pThis->aPics[1].irr, pThis->aPics[1].imr, pThis->aPics[1].isr, pThis->aPics[1].irq_base));
    328328
    329329        /* Clear pending IRQ 2 on master controller in case of slave interrupt. */
     
    331331        if (intno > 7)
    332332        {
    333             pData->aPics[0].irr &= ~(1 << 2);
    334             STAM_COUNTER_INC(&pData->StatClearedActiveSlaveIRQ);
     333            pThis->aPics[0].irr &= ~(1 << 2);
     334            STAM_COUNTER_INC(&pThis->StatClearedActiveSlaveIRQ);
    335335        }
    336336        else
    337             STAM_COUNTER_INC(&pData->StatClearedActiveMasterIRQ);
     337            STAM_COUNTER_INC(&pThis->StatClearedActiveMasterIRQ);
    338338
    339339        Log(("pic_update_imr: clear pending interrupt %d\n", intno));
    340         pData->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pData->CTX_SUFF(pDevIns));
     340        pThis->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pThis->CTX_SUFF(pDevIns));
    341341    }
    342342}
     
    352352PDMBOTHCBDECL(void) picSetIrq(PPDMDEVINS pDevIns, int iIrq, int iLevel)
    353353{
    354     PDEVPIC     pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
    355     Assert(pData->CTX_SUFF(pDevIns) == pDevIns);
    356     Assert(pData->aPics[0].CTX_SUFF(pDevIns) == pDevIns);
    357     Assert(pData->aPics[1].CTX_SUFF(pDevIns) == pDevIns);
     354    PDEVPIC     pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
     355    Assert(pThis->CTX_SUFF(pDevIns) == pDevIns);
     356    Assert(pThis->aPics[0].CTX_SUFF(pDevIns) == pDevIns);
     357    Assert(pThis->aPics[1].CTX_SUFF(pDevIns) == pDevIns);
    358358    AssertMsg(iIrq < 16, ("iIrq=%d\n", iIrq));
    359359
    360360    Log(("picSetIrq %d %d\n", iIrq, iLevel));
    361     DumpPICState(&pData->aPics[0], "picSetIrq");
    362     DumpPICState(&pData->aPics[1], "picSetIrq");
    363     STAM_COUNTER_INC(&pData->CTXSUFF(StatSetIrq));
    364     pic_set_irq1(&pData->aPics[iIrq >> 3], iIrq & 7, iLevel & PDM_IRQ_LEVEL_HIGH);
    365     pic_update_irq(pData);
     361    DumpPICState(&pThis->aPics[0], "picSetIrq");
     362    DumpPICState(&pThis->aPics[1], "picSetIrq");
     363    STAM_COUNTER_INC(&pThis->CTXSUFF(StatSetIrq));
     364    pic_set_irq1(&pThis->aPics[iIrq >> 3], iIrq & 7, iLevel & PDM_IRQ_LEVEL_HIGH);
     365    pic_update_irq(pThis);
    366366    if ((iLevel & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP)
    367367    {
    368         pic_set_irq1(&pData->aPics[iIrq >> 3], iIrq & 7, 0);
    369         pic_update_irq(pData);
     368        pic_set_irq1(&pThis->aPics[iIrq >> 3], iIrq & 7, 0);
     369        pic_update_irq(pThis);
    370370    }
    371371}
     
    398398PDMBOTHCBDECL(int) picGetInterrupt(PPDMDEVINS pDevIns)
    399399{
    400     PDEVPIC     pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
     400    PDEVPIC     pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
    401401    int         irq;
    402402    int         irq2;
     
    404404
    405405    /* read the irq from the PIC */
    406     DumpPICState(&pData->aPics[0], "picGetInterrupt");
    407     DumpPICState(&pData->aPics[1], "picGetInterrupt");
    408 
    409     irq = pic_get_irq(&pData->aPics[0]);
     406    DumpPICState(&pThis->aPics[0], "picGetInterrupt");
     407    DumpPICState(&pThis->aPics[1], "picGetInterrupt");
     408
     409    irq = pic_get_irq(&pThis->aPics[0]);
    410410    if (irq >= 0)
    411411    {
    412         pic_intack(&pData->aPics[0], irq);
     412        pic_intack(&pThis->aPics[0], irq);
    413413        if (irq == 2)
    414414        {
    415             irq2 = pic_get_irq(&pData->aPics[1]);
     415            irq2 = pic_get_irq(&pThis->aPics[1]);
    416416            if (irq2 >= 0) {
    417                 pic_intack(&pData->aPics[1], irq2);
     417                pic_intack(&pThis->aPics[1], irq2);
    418418            }
    419419            else
     
    423423                irq2 = 7;
    424424            }
    425             intno = pData->aPics[1].irq_base + irq2;
    426             Log2(("picGetInterrupt1: %x base=%x irq=%x\n", intno, pData->aPics[1].irq_base, irq2));
     425            intno = pThis->aPics[1].irq_base + irq2;
     426            Log2(("picGetInterrupt1: %x base=%x irq=%x\n", intno, pThis->aPics[1].irq_base, irq2));
    427427            irq = irq2 + 8;
    428428        }
    429429        else {
    430             intno = pData->aPics[0].irq_base + irq;
    431             Log2(("picGetInterrupt0: %x base=%x irq=%x\n", intno, pData->aPics[0].irq_base, irq));
     430            intno = pThis->aPics[0].irq_base + irq;
     431            Log2(("picGetInterrupt0: %x base=%x irq=%x\n", intno, pThis->aPics[0].irq_base, irq));
    432432        }
    433433    }
     
    437437        AssertMsgFailed(("picGetInterrupt: spurious IRQ on master controller\n"));
    438438        irq = 7;
    439         intno = pData->aPics[0].irq_base + irq;
    440     }
    441     pic_update_irq(pData);
    442 
    443     Log(("picGetInterrupt: 0x%02x pending 0:%d 1:%d\n", intno, pic_get_irq(&pData->aPics[0]), pic_get_irq(&pData->aPics[1])));
     439        intno = pThis->aPics[0].irq_base + irq;
     440    }
     441    pic_update_irq(pThis);
     442
     443    Log(("picGetInterrupt: 0x%02x pending 0:%d 1:%d\n", intno, pic_get_irq(&pThis->aPics[0]), pic_get_irq(&pThis->aPics[1])));
    444444
    445445    return intno;
     
    467467{
    468468    PicState *s = (PicState*)opaque;
    469     PDEVPIC     pData = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC);
     469    PDEVPIC     pThis = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC);
    470470    int         rc = VINF_SUCCESS;
    471471    int priority, cmd, irq;
     
    478478            pic_reset(s);
    479479            /* deassert a pending interrupt */
    480             pData->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pData->CTX_SUFF(pDevIns));
     480            pThis->CTX_SUFF(pPicHlp)->pfnClearInterruptFF(pThis->CTX_SUFF(pDevIns));
    481481
    482482            s->init_state = 1;
     
    510510                    if (cmd == 5)
    511511                        s->priority_add = (irq + 1) & 7;
    512                     rc = pic_update_irq(pData);
     512                    rc = pic_update_irq(pThis);
    513513                    Assert(rc == VINF_SUCCESS);
    514514                    DumpPICState(s, "eoi");
     
    521521                Log(("pic_write: EOI2 for irq %d\n", irq));
    522522                s->isr &= ~(1 << irq);
    523                 rc = pic_update_irq(pData);
     523                rc = pic_update_irq(pThis);
    524524                Assert(rc == VINF_SUCCESS);
    525525                DumpPICState(s, "eoi2");
     
    530530                s->priority_add = (val + 1) & 7;
    531531                Log(("pic_write: lowest priority %d (highest %d)\n", val & 7, s->priority_add));
    532                 rc = pic_update_irq(pData);
     532                rc = pic_update_irq(pThis);
    533533                Assert(rc == VINF_SUCCESS);
    534534                break;
     
    540540                s->isr &= ~(1 << irq);
    541541                s->priority_add = (irq + 1) & 7;
    542                 rc = pic_update_irq(pData);
     542                rc = pic_update_irq(pThis);
    543543                Assert(rc == VINF_SUCCESS);
    544544                DumpPICState(s, "eoi3");
     
    555555        {
    556556            /* normal mode */
    557             pic_update_imr(pData, s, val);
    558 
    559             rc = pic_update_irq(pData);
     557            pic_update_imr(pThis, s, val);
     558
     559            rc = pic_update_irq(pThis);
    560560            Assert(rc == VINF_SUCCESS);
    561561            break;
     
    587587static uint32_t pic_poll_read (PicState *s, uint32_t addr1)
    588588{
    589     PDEVPIC     pData = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC);
    590     PicState   *pics = &pData->aPics[0];
     589    PDEVPIC     pThis = PDMINS_2_DATA(s->CTX_SUFF(pDevIns), PDEVPIC);
     590    PicState   *pics = &pThis->aPics[0];
    591591    int ret;
    592592
     
    602602        s->isr &= ~(1 << ret);
    603603        if (addr1 >> 7 || ret != 2)
    604             pic_update_irq(pData);
     604            pic_update_irq(pThis);
    605605    } else {
    606606        ret = 0x07;
    607         pic_update_irq(pData);
     607        pic_update_irq(pThis);
    608608    }
    609609
     
    706706PDMBOTHCBDECL(int) picIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
    707707{
    708     PDEVPIC     pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
     708    PDEVPIC     pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
    709709    uint32_t    iPic  = (uint32_t)(uintptr_t)pvUser;
    710710
     
    713713    {
    714714        int rc;
    715         PIC_LOCK(pData, VINF_IOM_HC_IOPORT_READ);
    716         *pu32 = pic_ioport_read(&pData->aPics[iPic], Port, &rc);
    717         PIC_UNLOCK(pData);
     715        PIC_LOCK(pThis, VINF_IOM_HC_IOPORT_READ);
     716        *pu32 = pic_ioport_read(&pThis->aPics[iPic], Port, &rc);
     717        PIC_UNLOCK(pThis);
    718718        return rc;
    719719    }
     
    734734PDMBOTHCBDECL(int) picIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
    735735{
    736     PDEVPIC     pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
     736    PDEVPIC     pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
    737737    uint32_t    iPic  = (uint32_t)(uintptr_t)pvUser;
    738738
     
    742742    {
    743743        int rc;
    744         PIC_LOCK(pData, VINF_IOM_HC_IOPORT_WRITE);
    745         rc = pic_ioport_write(&pData->aPics[iPic], Port, u32);
    746         PIC_UNLOCK(pData);
     744        PIC_LOCK(pThis, VINF_IOM_HC_IOPORT_WRITE);
     745        rc = pic_ioport_write(&pThis->aPics[iPic], Port, u32);
     746        PIC_UNLOCK(pThis);
    747747        return rc;
    748748    }
     
    811811static DECLCALLBACK(void) picInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
    812812{
    813     PDEVPIC pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
     813    PDEVPIC pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
    814814
    815815    /*
     
    819819    {
    820820        pHlp->pfnPrintf(pHlp, "PIC%d:\n", i);
    821         pHlp->pfnPrintf(pHlp, "  last_irr                  = %02x\n", pData->aPics[i].last_irr);
    822         pHlp->pfnPrintf(pHlp, "  irr                       = %02x\n", pData->aPics[i].irr);
    823         pHlp->pfnPrintf(pHlp, "  imr                       = %02x\n", pData->aPics[i].imr);
    824         pHlp->pfnPrintf(pHlp, "  isr                       = %02x\n", pData->aPics[i].isr);
    825         pHlp->pfnPrintf(pHlp, "  priority_add              = %02x\n", pData->aPics[i].priority_add);
    826         pHlp->pfnPrintf(pHlp, "  irq_base                  = %02x\n", pData->aPics[i].irq_base);
    827         pHlp->pfnPrintf(pHlp, "  read_reg_select           = %02x\n", pData->aPics[i].read_reg_select);
    828         pHlp->pfnPrintf(pHlp, "  poll                      = %02x\n", pData->aPics[i].poll);
    829         pHlp->pfnPrintf(pHlp, "  special_mask              = %02x\n", pData->aPics[i].special_mask);
    830         pHlp->pfnPrintf(pHlp, "  init_state                = %02x\n", pData->aPics[i].init_state);
    831         pHlp->pfnPrintf(pHlp, "  auto_eoi                  = %02x\n", pData->aPics[i].auto_eoi);
    832         pHlp->pfnPrintf(pHlp, "  rotate_on_auto_eoi        = %02x\n", pData->aPics[i].rotate_on_auto_eoi);
    833         pHlp->pfnPrintf(pHlp, "  special_fully_nested_mode = %02x\n", pData->aPics[i].special_fully_nested_mode);
    834         pHlp->pfnPrintf(pHlp, "  init4                     = %02x\n", pData->aPics[i].init4);
    835         pHlp->pfnPrintf(pHlp, "  elcr                      = %02x\n", pData->aPics[i].elcr);
    836         pHlp->pfnPrintf(pHlp, "  elcr_mask                 = %02x\n", pData->aPics[i].elcr_mask);
     821        pHlp->pfnPrintf(pHlp, "  last_irr                  = %02x\n", pThis->aPics[i].last_irr);
     822        pHlp->pfnPrintf(pHlp, "  irr                       = %02x\n", pThis->aPics[i].irr);
     823        pHlp->pfnPrintf(pHlp, "  imr                       = %02x\n", pThis->aPics[i].imr);
     824        pHlp->pfnPrintf(pHlp, "  isr                       = %02x\n", pThis->aPics[i].isr);
     825        pHlp->pfnPrintf(pHlp, "  priority_add              = %02x\n", pThis->aPics[i].priority_add);
     826        pHlp->pfnPrintf(pHlp, "  irq_base                  = %02x\n", pThis->aPics[i].irq_base);
     827        pHlp->pfnPrintf(pHlp, "  read_reg_select           = %02x\n", pThis->aPics[i].read_reg_select);
     828        pHlp->pfnPrintf(pHlp, "  poll                      = %02x\n", pThis->aPics[i].poll);
     829        pHlp->pfnPrintf(pHlp, "  special_mask              = %02x\n", pThis->aPics[i].special_mask);
     830        pHlp->pfnPrintf(pHlp, "  init_state                = %02x\n", pThis->aPics[i].init_state);
     831        pHlp->pfnPrintf(pHlp, "  auto_eoi                  = %02x\n", pThis->aPics[i].auto_eoi);
     832        pHlp->pfnPrintf(pHlp, "  rotate_on_auto_eoi        = %02x\n", pThis->aPics[i].rotate_on_auto_eoi);
     833        pHlp->pfnPrintf(pHlp, "  special_fully_nested_mode = %02x\n", pThis->aPics[i].special_fully_nested_mode);
     834        pHlp->pfnPrintf(pHlp, "  init4                     = %02x\n", pThis->aPics[i].init4);
     835        pHlp->pfnPrintf(pHlp, "  elcr                      = %02x\n", pThis->aPics[i].elcr);
     836        pHlp->pfnPrintf(pHlp, "  elcr_mask                 = %02x\n", pThis->aPics[i].elcr_mask);
    837837    }
    838838}
     
    848848static DECLCALLBACK(int) picSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)
    849849{
    850     PDEVPIC     pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
    851     pic_save(pSSMHandle, &pData->aPics[0]);
    852     pic_save(pSSMHandle, &pData->aPics[1]);
     850    PDEVPIC     pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
     851    pic_save(pSSMHandle, &pThis->aPics[0]);
     852    pic_save(pSSMHandle, &pThis->aPics[1]);
    853853    return VINF_SUCCESS;
    854854}
     
    865865static DECLCALLBACK(int) picLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle, uint32_t u32Version)
    866866{
    867     PDEVPIC     pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
    868     int rc = pic_load(pSSMHandle, &pData->aPics[0], u32Version);
     867    PDEVPIC     pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
     868    int rc = pic_load(pSSMHandle, &pThis->aPics[0], u32Version);
    869869    if (RT_SUCCESS(rc))
    870         rc = pic_load(pSSMHandle, &pData->aPics[1], u32Version);
     870        rc = pic_load(pSSMHandle, &pThis->aPics[1], u32Version);
    871871    return rc;
    872872}
     
    883883static DECLCALLBACK(void)  picReset(PPDMDEVINS pDevIns)
    884884{
    885     PDEVPIC     pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
     885    PDEVPIC     pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
    886886    unsigned    i;
    887887    LogFlow(("picReset:\n"));
    888     pData->pPicHlpR3->pfnLock(pDevIns, VERR_INTERNAL_ERROR);
    889 
    890     for (i = 0; i < RT_ELEMENTS(pData->aPics); i++)
    891         pic_reset(&pData->aPics[i]);
    892 
    893     PIC_UNLOCK(pData);
     888    pThis->pPicHlpR3->pfnLock(pDevIns, VERR_INTERNAL_ERROR);
     889
     890    for (i = 0; i < RT_ELEMENTS(pThis->aPics); i++)
     891        pic_reset(&pThis->aPics[i]);
     892
     893    PIC_UNLOCK(pThis);
    894894}
    895895
     
    900900static DECLCALLBACK(void) picRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    901901{
    902     PDEVPIC         pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
     902    PDEVPIC         pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
    903903    unsigned        i;
    904904
    905     pData->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    906     pData->pPicHlpRC = pData->pPicHlpR3->pfnGetRCHelpers(pDevIns);
    907     for (i = 0; i < RT_ELEMENTS(pData->aPics); i++)
    908         pData->aPics[i].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     905    pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     906    pThis->pPicHlpRC = pThis->pPicHlpR3->pfnGetRCHelpers(pDevIns);
     907    for (i = 0; i < RT_ELEMENTS(pThis->aPics); i++)
     908        pThis->aPics[i].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    909909}
    910910
     
    915915static DECLCALLBACK(int)  picConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle)
    916916{
    917     PDEVPIC         pData = PDMINS_2_DATA(pDevIns, PDEVPIC);
     917    PDEVPIC         pThis = PDMINS_2_DATA(pDevIns, PDEVPIC);
    918918    PDMPICREG       PicReg;
    919919    int             rc;
     
    943943     * Init the data.
    944944     */
    945     Assert(RT_ELEMENTS(pData->aPics) == 2);
    946     pData->pDevInsR3 = pDevIns;
    947     pData->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    948     pData->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    949     pData->aPics[0].elcr_mask = 0xf8;
    950     pData->aPics[1].elcr_mask = 0xde;
    951     pData->aPics[0].pDevInsR3 = pDevIns;
    952     pData->aPics[1].pDevInsR3 = pDevIns;
    953     pData->aPics[0].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    954     pData->aPics[1].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
    955     pData->aPics[0].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    956     pData->aPics[1].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     945    Assert(RT_ELEMENTS(pThis->aPics) == 2);
     946    pThis->pDevInsR3 = pDevIns;
     947    pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
     948    pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     949    pThis->aPics[0].elcr_mask = 0xf8;
     950    pThis->aPics[1].elcr_mask = 0xde;
     951    pThis->aPics[0].pDevInsR3 = pDevIns;
     952    pThis->aPics[1].pDevInsR3 = pDevIns;
     953    pThis->aPics[0].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
     954    pThis->aPics[1].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
     955    pThis->aPics[0].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     956    pThis->aPics[1].pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
    957957
    958958    /*
     
    986986
    987987    Assert(pDevIns->pDevHlp->pfnPICRegister);
    988     rc = pDevIns->pDevHlp->pfnPICRegister(pDevIns, &PicReg, &pData->pPicHlpR3);
     988    rc = pDevIns->pDevHlp->pfnPICRegister(pDevIns, &PicReg, &pThis->pPicHlpR3);
    989989    AssertLogRelMsgRCReturn(rc, ("PICRegister -> %Vrc\n", rc), rc);
    990990    if (fGCEnabled)
    991         pData->pPicHlpRC = pData->pPicHlpR3->pfnGetRCHelpers(pDevIns);
     991        pThis->pPicHlpRC = pThis->pPicHlpR3->pfnGetRCHelpers(pDevIns);
    992992    if (fR0Enabled)
    993         pData->pPicHlpR0 = pData->pPicHlpR3->pfnGetR0Helpers(pDevIns);
     993        pThis->pPicHlpR0 = pThis->pPicHlpR3->pfnGetR0Helpers(pDevIns);
    994994
    995995
     
    10221022    }
    10231023
    1024     rc = PDMDevHlpIOPortRegister(pDevIns, 0x4d0, 1, &pData->aPics[0],
     1024    rc = PDMDevHlpIOPortRegister(pDevIns, 0x4d0, 1, &pThis->aPics[0],
    10251025                                 picIOPortElcrWrite, picIOPortElcrRead, NULL, NULL, "i8259 PIC #0 - elcr");
    10261026    if (RT_FAILURE(rc))
    10271027        return rc;
    1028     rc = PDMDevHlpIOPortRegister(pDevIns, 0x4d1, 1, &pData->aPics[1],
     1028    rc = PDMDevHlpIOPortRegister(pDevIns, 0x4d1, 1, &pThis->aPics[1],
    10291029                                 picIOPortElcrWrite, picIOPortElcrRead, NULL, NULL, "i8259 PIC #1 - elcr");
    10301030    if (RT_FAILURE(rc))
     
    10551055    }
    10561056
    1057     rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1 /* version */, sizeof(*pData),
     1057    rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1 /* version */, sizeof(*pThis),
    10581058                              NULL, picSaveExec, NULL,
    10591059                              NULL, picLoadExec, NULL);
     
    10781078     * Statistics.
    10791079     */
    1080     PDMDevHlpSTAMRegister(pDevIns, &pData->StatSetIrqGC, STAMTYPE_COUNTER, "/PDM/PIC/SetIrqGC", STAMUNIT_OCCURENCES, "Number of PIC SetIrq calls in GC.");
    1081     PDMDevHlpSTAMRegister(pDevIns, &pData->StatSetIrqHC, STAMTYPE_COUNTER, "/PDM/PIC/SetIrqHC", STAMUNIT_OCCURENCES, "Number of PIC SetIrq calls in HC.");
    1082 
    1083     PDMDevHlpSTAMRegister(pDevIns, &pData->StatClearedActiveIRQ2,       STAMTYPE_COUNTER, "/PDM/PIC/Masked/ActiveIRQ2",   STAMUNIT_OCCURENCES, "Number of cleared irq 2.");
    1084     PDMDevHlpSTAMRegister(pDevIns, &pData->StatClearedActiveMasterIRQ,  STAMTYPE_COUNTER, "/PDM/PIC/Masked/ActiveMaster", STAMUNIT_OCCURENCES, "Number of cleared master irqs.");
    1085     PDMDevHlpSTAMRegister(pDevIns, &pData->StatClearedActiveSlaveIRQ,   STAMTYPE_COUNTER, "/PDM/PIC/Masked/ActiveSlave",  STAMUNIT_OCCURENCES, "Number of cleared slave irqs.");
     1080    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatSetIrqGC, STAMTYPE_COUNTER, "/PDM/PIC/SetIrqGC", STAMUNIT_OCCURENCES, "Number of PIC SetIrq calls in GC.");
     1081    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatSetIrqHC, STAMTYPE_COUNTER, "/PDM/PIC/SetIrqHC", STAMUNIT_OCCURENCES, "Number of PIC SetIrq calls in HC.");
     1082
     1083    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatClearedActiveIRQ2,       STAMTYPE_COUNTER, "/PDM/PIC/Masked/ActiveIRQ2",   STAMUNIT_OCCURENCES, "Number of cleared irq 2.");
     1084    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatClearedActiveMasterIRQ,  STAMTYPE_COUNTER, "/PDM/PIC/Masked/ActiveMaster", STAMUNIT_OCCURENCES, "Number of cleared master irqs.");
     1085    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatClearedActiveSlaveIRQ,   STAMTYPE_COUNTER, "/PDM/PIC/Masked/ActiveSlave",  STAMUNIT_OCCURENCES, "Number of cleared slave irqs.");
    10861086#endif
    10871087
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette