Changeset 20056 in vbox
- Timestamp:
- May 27, 2009 7:33:15 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pdmapi.h
r20037 r20056 50 50 VMMDECL(int) PDMApicSetBase(PVM pVM, uint64_t u64Base); 51 51 VMMDECL(int) PDMApicGetBase(PVM pVM, uint64_t *pu64Base); 52 VMMDECL(int) PDMApicSetTPREx(PVMCPU pVCpu, uint8_t u8TPR, bool fMMIOFormat);53 VMMDECL(int) PDMApicGetTPREx(PVMCPU pVCpu, uint8_t *pu8TPR, bool fMMIOFormat, bool *pfPending);54 52 VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR); 55 53 VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending); -
trunk/include/VBox/pdmdev.h
r20037 r20056 985 985 * @param idCpu VCPU id 986 986 * @param u8TPR The new TPR. 987 * @param fMMIOFormat Update as if MMIO write to ApicBase + 0x80 988 */ 989 DECLR3CALLBACKMEMBER(void, pfnSetTPRR3,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t u8TPR, bool fMMIOFormat)); 987 */ 988 DECLR3CALLBACKMEMBER(void, pfnSetTPRR3,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t u8TPR)); 990 989 991 990 /** … … 995 994 * @param pDevIns Device instance of the APIC. 996 995 * @param idCpu VCPU id 997 * @param fMMIOFormat Return as if MMIO read from ApicBase + 0x80 998 */ 999 DECLR3CALLBACKMEMBER(uint8_t, pfnGetTPRR3,(PPDMDEVINS pDevIns, VMCPUID idCpu, bool fMMIOFormat)); 996 */ 997 DECLR3CALLBACKMEMBER(uint8_t, pfnGetTPRR3,(PPDMDEVINS pDevIns, VMCPUID idCpu)); 1000 998 1001 999 /** -
trunk/src/VBox/Devices/PC/DevAPIC.cpp
r20039 r20056 438 438 PDMBOTHCBDECL(void) apicSetBase(PPDMDEVINS pDevIns, uint64_t val); 439 439 PDMBOTHCBDECL(uint64_t) apicGetBase(PPDMDEVINS pDevIns); 440 PDMBOTHCBDECL(void) apicSetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t val , bool fMMIOFormat);441 PDMBOTHCBDECL(uint8_t) apicGetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu , bool fMMIOFormat);440 PDMBOTHCBDECL(void) apicSetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t val); 441 PDMBOTHCBDECL(uint8_t) apicGetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu); 442 442 PDMBOTHCBDECL(int) apicBusDeliverCallback(PPDMDEVINS pDevIns, uint8_t u8Dest, uint8_t u8DestMode, 443 443 uint8_t u8DeliveryMode, uint8_t iVector, uint8_t u8Polarity, … … 670 670 } 671 671 672 PDMBOTHCBDECL(void) apicSetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t val , bool fMMIOFormat)672 PDMBOTHCBDECL(void) apicSetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t val) 673 673 { 674 674 APICDeviceInfo *dev = PDMINS_2_DATA(pDevIns, APICDeviceInfo *); 675 675 APICState *s = getLapicById(dev, idCpu); 676 677 if (!fMMIOFormat) 678 val = (val & 0x0f) << 4; 679 680 LogFlow(("apicSetTPR: val=%#x (trp %#x -> %#x)\n", val, s->tpr, val)); 681 apic_update_tpr(dev, s, val); 682 } 683 684 PDMBOTHCBDECL(uint8_t) apicGetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu, bool fMMIOFormat) 676 LogFlow(("apicSetTPR: val=%#x (trp %#x -> %#x)\n", val, s->tpr, (val & 0x0f) << 4)); 677 apic_update_tpr(dev, s, (val & 0x0f) << 4); 678 } 679 680 PDMBOTHCBDECL(uint8_t) apicGetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu) 685 681 { 686 682 APICDeviceInfo *dev = PDMINS_2_DATA(pDevIns, APICDeviceInfo *); 687 683 APICState *s = getLapicById(dev, idCpu); 688 689 if (fMMIOFormat) 690 { 691 Log2(("apicGetTPR: returns %#x\n", s->tpr)); 692 return s->tpr; 693 } 694 else 695 { 696 Log2(("apicGetTPR: returns %#x\n", s->tpr >> 4)); 697 return s->tpr >> 4; 698 } 684 Log2(("apicGetTPR: returns %#x\n", s->tpr >> 4)); 685 return s->tpr >> 4; 699 686 } 700 687 -
trunk/src/VBox/VMM/PDMInternal.h
r20037 r20056 420 420 DECLR3CALLBACKMEMBER(uint64_t, pfnGetBaseR3,(PPDMDEVINS pDevIns)); 421 421 /** @copydoc PDMAPICREG::pfnSetTPRR3 */ 422 DECLR3CALLBACKMEMBER(void, pfnSetTPRR3,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t u8TPR , bool fMMIOFormat));422 DECLR3CALLBACKMEMBER(void, pfnSetTPRR3,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t u8TPR)); 423 423 /** @copydoc PDMAPICREG::pfnGetTPRR3 */ 424 DECLR3CALLBACKMEMBER(uint8_t, pfnGetTPRR3,(PPDMDEVINS pDevIns, VMCPUID idCpu , bool fMMIOFormat));424 DECLR3CALLBACKMEMBER(uint8_t, pfnGetTPRR3,(PPDMDEVINS pDevIns, VMCPUID idCpu)); 425 425 /** @copydoc PDMAPICREG::pfnWriteMSRR3 */ 426 426 DECLR3CALLBACKMEMBER(int, pfnWriteMSRR3, (PPDMDEVINS pDevIns, VMCPUID idCpu, uint32_t u32Reg, uint64_t u64Value)); … … 442 442 DECLR0CALLBACKMEMBER(uint64_t, pfnGetBaseR0,(PPDMDEVINS pDevIns)); 443 443 /** @copydoc PDMAPICREG::pfnSetTPRR3 */ 444 DECLR0CALLBACKMEMBER(void, pfnSetTPRR0,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t u8TPR , bool fMMIOFormat));444 DECLR0CALLBACKMEMBER(void, pfnSetTPRR0,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t u8TPR)); 445 445 /** @copydoc PDMAPICREG::pfnGetTPRR3 */ 446 DECLR0CALLBACKMEMBER(uint8_t, pfnGetTPRR0,(PPDMDEVINS pDevIns, VMCPUID idCpu , bool fMMIOFormat));446 DECLR0CALLBACKMEMBER(uint8_t, pfnGetTPRR0,(PPDMDEVINS pDevIns, VMCPUID idCpu)); 447 447 /** @copydoc PDMAPICREG::pfnWriteMSRR3 */ 448 448 DECLR0CALLBACKMEMBER(uint32_t, pfnWriteMSRR0, (PPDMDEVINS pDevIns, VMCPUID idCpu, uint32_t u32Reg, uint64_t u64Value)); … … 464 464 DECLRCCALLBACKMEMBER(uint64_t, pfnGetBaseRC,(PPDMDEVINS pDevIns)); 465 465 /** @copydoc PDMAPICREG::pfnSetTPRR3 */ 466 DECLRCCALLBACKMEMBER(void, pfnSetTPRRC,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t u8TPR , bool fMMIOFormat));466 DECLRCCALLBACKMEMBER(void, pfnSetTPRRC,(PPDMDEVINS pDevIns, VMCPUID idCpu, uint8_t u8TPR)); 467 467 /** @copydoc PDMAPICREG::pfnGetTPRR3 */ 468 DECLRCCALLBACKMEMBER(uint8_t, pfnGetTPRRC,(PPDMDEVINS pDevIns, VMCPUID idCpu , bool fMMIOFormat));468 DECLRCCALLBACKMEMBER(uint8_t, pfnGetTPRRC,(PPDMDEVINS pDevIns, VMCPUID idCpu)); 469 469 /** @copydoc PDMAPICREG::pfnWriteMSRR3 */ 470 470 DECLRCCALLBACKMEMBER(uint32_t, pfnWriteMSRRC, (PPDMDEVINS pDevIns, VMCPUID idCpu, uint32_t u32Reg, uint64_t u64Value)); -
trunk/src/VBox/VMM/VMMAll/PDMAll.cpp
r20037 r20056 223 223 224 224 /** 225 * Set the TPR (task priority register ).225 * Set the TPR (task priority register?). 226 226 * 227 227 * @returns VBox status code. 228 228 * @param pVCpu VMCPU handle. 229 229 * @param u8TPR The new TPR. 230 * @param fMMIOFormat Update as if MMIO write to ApicBase + 0x80 231 */ 232 VMMDECL(int) PDMApicSetTPREx(PVMCPU pVCpu, uint8_t u8TPR, bool fMMIOFormat) 230 */ 231 VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR) 233 232 { 234 233 PVM pVM = pVCpu->CTX_SUFF(pVM); … … 237 236 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnSetTPR)); 238 237 pdmLock(pVM); 239 pVM->pdm.s.Apic.CTX_SUFF(pfnSetTPR)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu->idCpu, u8TPR, fMMIOFormat); 240 pdmUnlock(pVM); 241 return VINF_SUCCESS; 242 } 243 return VERR_PDM_NO_APIC_INSTANCE; 244 } 245 246 /** 247 * Set the TPR (task priority register). 248 * 249 * @returns VBox status code. 250 * @param pVCpu VMCPU handle. 251 * @param u8TPR The new TPR. 252 */ 253 VMMDECL(int) PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR) 254 { 255 return PDMApicSetTPREx(pVCpu, u8TPR, false /* TPR only */); 256 } 257 258 /** 259 * Get the TPR (task priority register). 260 * 261 * @returns The current TPR. 262 * @param pVCpu VMCPU handle. 263 * @param pu8TPR Where to store the TRP. 264 * @param fMMIOFormat Return as if MMIO read from ApicBase + 0x80 265 * @param pfPending Pending interrupt state (out). 266 */ 267 VMMDECL(int) PDMApicGetTPREx(PVMCPU pVCpu, uint8_t *pu8TPR, bool fMMIOFormat, bool *pfPending) 268 { 269 PVM pVM = pVCpu->CTX_SUFF(pVM); 270 if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns)) 271 { 272 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnGetTPR)); 273 pdmLock(pVM); 274 *pu8TPR = pVM->pdm.s.Apic.CTX_SUFF(pfnGetTPR)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu->idCpu, fMMIOFormat); 275 if (pfPending) 276 *pfPending = pVM->pdm.s.Apic.CTX_SUFF(pfnHasPendingIrq)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns)); 277 pdmUnlock(pVM); 278 return VINF_SUCCESS; 279 } 280 *pu8TPR = 0; 238 pVM->pdm.s.Apic.CTX_SUFF(pfnSetTPR)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu->idCpu, u8TPR); 239 pdmUnlock(pVM); 240 return VINF_SUCCESS; 241 } 281 242 return VERR_PDM_NO_APIC_INSTANCE; 282 243 } … … 293 254 VMMDECL(int) PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending) 294 255 { 295 return PDMApicGetTPREx(pVCpu, pu8TPR, false /* TPR only */, pfPending); 256 PVM pVM = pVCpu->CTX_SUFF(pVM); 257 if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns)) 258 { 259 Assert(pVM->pdm.s.Apic.CTX_SUFF(pfnGetTPR)); 260 pdmLock(pVM); 261 *pu8TPR = pVM->pdm.s.Apic.CTX_SUFF(pfnGetTPR)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns), pVCpu->idCpu); 262 if (pfPending) 263 *pfPending = pVM->pdm.s.Apic.CTX_SUFF(pfnHasPendingIrq)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns)); 264 pdmUnlock(pVM); 265 return VINF_SUCCESS; 266 } 267 *pu8TPR = 0; 268 return VERR_PDM_NO_APIC_INSTANCE; 296 269 } 297 270 -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r20046 r20056 946 946 947 947 /* TPR caching in CR8 */ 948 int rc = PDMApicGetTPR Ex(pVCpu, &u8LastVTPR, pVM->hwaccm.s.svm.fTPRPatching, &fPending);948 int rc = PDMApicGetTPR(pVCpu, &u8LastVTPR, &fPending); 949 949 AssertRC(rc); 950 950 pVMCB->ctrl.IntCtrl.n.u8VTPR = u8LastVTPR; … … 1337 1337 if (fSyncTPR) 1338 1338 { 1339 rc = PDMApicSetTPR Ex(pVCpu, pVMCB->ctrl.IntCtrl.n.u8VTPR, pVM->hwaccm.s.svm.fTPRPatching);1339 rc = PDMApicSetTPR(pVCpu, pVMCB->ctrl.IntCtrl.n.u8VTPR); 1340 1340 AssertRC(rc); 1341 1341 }
Note:
See TracChangeset
for help on using the changeset viewer.