VirtualBox

Changeset 20666 in vbox


Ignore:
Timestamp:
Jun 17, 2009 1:01:56 PM (16 years ago)
Author:
vboxsync
Message:

Changed PDMApicGet/SetTPR to get/set the full task priority register.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

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

    r20572 r20666  
    681681    APICDeviceInfo *dev = PDMINS_2_DATA(pDevIns, APICDeviceInfo *);
    682682    APICState *s = getLapicById(dev, idCpu);
    683     LogFlow(("apicSetTPR: val=%#x (trp %#x -> %#x)\n", val, s->tpr, (val & 0x0f) << 4));
    684     apic_update_tpr(dev, s, (val & 0x0f) << 4);
     683    LogFlow(("apicSetTPR: val=%#x (trp %#x -> %#x)\n", val, s->tpr, val));
     684    apic_update_tpr(dev, s, val);
    685685}
    686686
     
    689689    APICDeviceInfo *dev = PDMINS_2_DATA(pDevIns, APICDeviceInfo *);
    690690    APICState *s = getLapicById(dev, idCpu);
    691     Log2(("apicGetTPR: returns %#x\n", s->tpr >> 4));
    692     return s->tpr >> 4;
     691    Log2(("apicGetTPR: returns %#x\n", s->tpr));
     692    return s->tpr;
    693693}
    694694
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r20588 r20666  
    19951995        rc = PDMApicGetTPR(pVCpu, (uint8_t *)&val64, NULL);
    19961996        AssertMsgRCReturn(rc, ("PDMApicGetTPR failed\n"), VERR_EM_INTERPRETER);
     1997        val64 >>= 4;     /* bits 7-4 contain the task priority that go in cr8, bits 3-0*/
    19971998    }
    19981999    else
     
    21702171
    21712172    case USE_REG_CR8:
    2172         return PDMApicSetTPR(pVCpu, val);
     2173        return PDMApicSetTPR(pVCpu, val << 4);  /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */
    21732174
    21742175    default:
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r20660 r20666  
    986986        int rc = PDMApicGetTPR(pVCpu, &u8LastTPR, &fPending);
    987987        AssertRC(rc);
    988         pVMCB->ctrl.IntCtrl.n.u8VTPR = u8LastTPR;
     988        pVMCB->ctrl.IntCtrl.n.u8VTPR = (u8LastTPR >> 4); /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */
    989989
    990990        if (fPending)
     
    13801380    /* Sync back the TPR if it was changed. */
    13811381    if (    fSyncTPR
    1382         &&  u8LastTPR != pVMCB->ctrl.IntCtrl.n.u8VTPR)
    1383     {
    1384         rc = PDMApicSetTPR(pVCpu, pVMCB->ctrl.IntCtrl.n.u8VTPR);
     1382        &&  (u8LastTPR >> 4) != pVMCB->ctrl.IntCtrl.n.u8VTPR)
     1383    {
     1384        rc = PDMApicSetTPR(pVCpu, pVMCB->ctrl.IntCtrl.n.u8VTPR << 4);   /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */
    13851385        AssertRC(rc);
    13861386    }
     
    23642364            rc = DISFetchReg32(CPUMCTX2CORE(pCtx), pDis->param2.base.reg_gen, &val);
    23652365            AssertRC(rc);
    2366             u8Tpr = val >> 4;
     2366            u8Tpr = val;
    23672367        }
    23682368        else
    23692369        if (pDis->param2.flags == USE_IMMEDIATE32)
    23702370        {
    2371             u8Tpr = (uint8_t)pDis->param2.parval >> 4;
     2371            u8Tpr = (uint8_t)pDis->param2.parval;
    23722372        }
    23732373        else
     
    23922392        AssertRC(rc);
    23932393
    2394         rc = DISWriteReg32(CPUMCTX2CORE(pCtx), pDis->param1.base.reg_gen, u8Tpr << 4);
     2394        rc = DISWriteReg32(CPUMCTX2CORE(pCtx), pDis->param1.base.reg_gen, u8Tpr);
    23952395        AssertRC(rc);
    23962396
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r20660 r20666  
    22182218    {
    22192219        /* TPR caching in CR8 */
    2220         uint8_t u8TPR;
    22212220        bool    fPending;
    22222221
    2223         int rc = PDMApicGetTPR(pVCpu, &u8TPR, &fPending);
     2222        int rc = PDMApicGetTPR(pVCpu, &u8LastTPR, &fPending);
    22242223        AssertRC(rc);
    22252224        /* The TPR can be found at offset 0x80 in the APIC mmio page. */
    2226         u8LastTPR = pVCpu->hwaccm.s.vmx.pVAPIC[0x80] = u8TPR << 4; /* bits 7-4 contain the task priority */
     2225        pVCpu->hwaccm.s.vmx.pVAPIC[0x80] = u8LastTPR;
    22272226
    22282227        /* Two options here:
     
    22322231         *   -> We don't need to be explicitely notified. There are enough world switches for detecting pending interrupts.
    22332232         */
    2234         rc  = VMXWriteVMCS(VMX_VMCS_CTRL_TPR_THRESHOLD, (fPending) ? u8TPR : 0);
     2233        rc  = VMXWriteVMCS(VMX_VMCS_CTRL_TPR_THRESHOLD, (fPending) ? (u8LastTPR >> 4) : 0);     /* cr8 bits 3-0 correspond to bits 7-4 of the task priority mmio register. */
    22352234        AssertRC(rc);
    22362235    }
     
    24272426        &&  u8LastTPR != pVCpu->hwaccm.s.vmx.pVAPIC[0x80])
    24282427    {
    2429         rc = PDMApicSetTPR(pVCpu, pVCpu->hwaccm.s.vmx.pVAPIC[0x80] >> 4);
     2428        rc = PDMApicSetTPR(pVCpu, pVCpu->hwaccm.s.vmx.pVAPIC[0x80]);
    24302429        AssertRC(rc);
    24312430    }
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