Changeset 22493 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Aug 26, 2009 10:22:16 PM (15 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r22121 r22493 361 361 * @remark This may raise exceptions. 362 362 */ 363 VMMDECL( int) EMInterpretPortIO(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, PDISCPUSTATE pDis, uint32_t cbOp)363 VMMDECL(VBOXSTRICTRC) EMInterpretPortIO(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, PDISCPUSTATE pDis, uint32_t cbOp) 364 364 { 365 365 /* … … 367 367 */ 368 368 #ifdef IN_RC 369 int rc= IOMGCIOPortHandler(pVM, pCtxCore, pDis);370 if (IOM_SUCCESS(rc ))369 VBOXSTRICTRC rcStrict = IOMGCIOPortHandler(pVM, pCtxCore, pDis); 370 if (IOM_SUCCESS(rcStrict)) 371 371 pCtxCore->rip += cbOp; 372 return rc ;372 return rcStrict; 373 373 #else 374 374 AssertReleaseMsgFailed(("not implemented\n")); -
trunk/src/VBox/VMM/VMMAll/IOMAll.cpp
r19807 r22493 259 259 * @param cbValue The size of the register to read in bytes. 1, 2 or 4 bytes. 260 260 */ 261 VMMDECL( int) IOMIOPortRead(PVM pVM, RTIOPORT Port, uint32_t *pu32Value, size_t cbValue)261 VMMDECL(VBOXSTRICTRC) IOMIOPortRead(PVM pVM, RTIOPORT Port, uint32_t *pu32Value, size_t cbValue) 262 262 { 263 263 /* Take the IOM lock before performing any device I/O. */ 264 int rc = iomLock(pVM);265 #ifndef IN_RING3 266 if (rc == VERR_SEM_BUSY)264 int rc2 = iomLock(pVM); 265 #ifndef IN_RING3 266 if (rc2 == VERR_SEM_BUSY) 267 267 return VINF_IOM_HC_IOPORT_READ; 268 #else 269 AssertRC(rc); 270 #endif 268 #endif 269 AssertRC(rc2); 271 270 272 271 #ifdef VBOX_WITH_STATISTICS … … 316 315 STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfIn), a); 317 316 #endif 318 rc= pRange->pfnInCallback(pRange->pDevIns, pRange->pvUser, Port, pu32Value, (unsigned)cbValue);317 VBOXSTRICTRC rcStrict = pRange->pfnInCallback(pRange->pDevIns, pRange->pvUser, Port, pu32Value, (unsigned)cbValue); 319 318 #ifdef VBOX_WITH_STATISTICS 320 319 if (pStats) 321 320 STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfIn), a); 322 if (rc == VINF_SUCCESS && pStats)321 if (rcStrict == VINF_SUCCESS && pStats) 323 322 STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In)); 324 323 # ifndef IN_RING3 325 else if (rc == VINF_IOM_HC_IOPORT_READ && pStats)324 else if (rcStrict == VINF_IOM_HC_IOPORT_READ && pStats) 326 325 STAM_COUNTER_INC(&pStats->CTX_MID_Z(In,ToR3)); 327 326 # endif 328 327 #endif 329 if (rc == VERR_IOM_IOPORT_UNUSED)328 if (rcStrict == VERR_IOM_IOPORT_UNUSED) 330 329 { 331 330 /* make return value */ 332 rc = VINF_SUCCESS;331 rcStrict = VINF_SUCCESS; 333 332 switch (cbValue) 334 333 { … … 342 341 } 343 342 } 344 Log3(("IOMIOPortRead: Port=%RTiop *pu32=%08RX32 cb=%d rc=%Rrc\n", Port, *pu32Value, cbValue, rc));345 iomUnlock(pVM); 346 return rc ;343 Log3(("IOMIOPortRead: Port=%RTiop *pu32=%08RX32 cb=%d rc=%Rrc\n", Port, *pu32Value, cbValue, VBOXSTRICTRC_VAL(rcStrict))); 344 iomUnlock(pVM); 345 return rcStrict; 347 346 } 348 347 … … 415 414 * @param pcTransfers Pointer to the number of transfer units to read, on return remaining transfer units. 416 415 * @param cb Size of the transfer unit (1, 2 or 4 bytes). 417 * */418 VMMDECL( int) IOMIOPortReadString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrDst, PRTGCUINTREG pcTransfers, unsigned cb)416 */ 417 VMMDECL(VBOXSTRICTRC) IOMIOPortReadString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrDst, PRTGCUINTREG pcTransfers, unsigned cb) 419 418 { 420 419 /* Take the IOM lock before performing any device I/O. */ 421 int rc = iomLock(pVM);422 #ifndef IN_RING3 423 if (rc == VERR_SEM_BUSY)420 int rc2 = iomLock(pVM); 421 #ifndef IN_RING3 422 if (rc2 == VERR_SEM_BUSY) 424 423 return VINF_IOM_HC_IOPORT_READ; 425 424 #endif 426 AssertRC(rc );425 AssertRC(rc2); 427 426 428 427 #ifdef LOG_ENABLED … … 476 475 #endif 477 476 478 int rc= pRange->pfnInStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrDst, pcTransfers, cb);477 VBOXSTRICTRC rcStrict = pRange->pfnInStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrDst, pcTransfers, cb); 479 478 #ifdef VBOX_WITH_STATISTICS 480 479 if (pStats) 481 480 STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfIn), a); 482 if (rc == VINF_SUCCESS && pStats)481 if (rcStrict == VINF_SUCCESS && pStats) 483 482 STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(In)); 484 483 # ifndef IN_RING3 485 else if (rc == VINF_IOM_HC_IOPORT_READ && pStats)484 else if (rcStrict == VINF_IOM_HC_IOPORT_READ && pStats) 486 485 STAM_COUNTER_INC(&pStats->CTX_MID_Z(In, ToR3)); 487 486 # endif 488 487 #endif 489 488 Log3(("IOMIOPortReadStr: Port=%RTiop pGCPtrDst=%p pcTransfer=%p:{%#x->%#x} cb=%d rc=%Rrc\n", 490 Port, pGCPtrDst, pcTransfers, cTransfers, *pcTransfers, cb, rc));491 iomUnlock(pVM); 492 return rc ;489 Port, pGCPtrDst, pcTransfers, cTransfers, *pcTransfers, cb, VBOXSTRICTRC_VAL(rcStrict))); 490 iomUnlock(pVM); 491 return rcStrict; 493 492 } 494 493 … … 551 550 * @param cbValue The size of the register to read in bytes. 1, 2 or 4 bytes. 552 551 */ 553 VMMDECL( int) IOMIOPortWrite(PVM pVM, RTIOPORT Port, uint32_t u32Value, size_t cbValue)552 VMMDECL(VBOXSTRICTRC) IOMIOPortWrite(PVM pVM, RTIOPORT Port, uint32_t u32Value, size_t cbValue) 554 553 { 555 554 /* Take the IOM lock before performing any device I/O. */ 556 int rc = iomLock(pVM);557 #ifndef IN_RING3 558 if (rc == VERR_SEM_BUSY)555 int rc2 = iomLock(pVM); 556 #ifndef IN_RING3 557 if (rc2 == VERR_SEM_BUSY) 559 558 return VINF_IOM_HC_IOPORT_WRITE; 560 559 #endif 561 AssertRC(rc); 562 563 /** @todo bird: When I get time, I'll remove the GC tree and link the GC entries to the ring-3 node. */ 560 AssertRC(rc2); 561 562 /** @todo bird: When I get time, I'll remove the RC/R0 trees and link the RC/R0 563 * entries to the ring-3 node. */ 564 564 #ifdef VBOX_WITH_STATISTICS 565 565 /* … … 608 608 STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfOut), a); 609 609 #endif 610 int rc= pRange->pfnOutCallback(pRange->pDevIns, pRange->pvUser, Port, u32Value, (unsigned)cbValue);610 VBOXSTRICTRC rcStrict = pRange->pfnOutCallback(pRange->pDevIns, pRange->pvUser, Port, u32Value, (unsigned)cbValue); 611 611 612 612 #ifdef VBOX_WITH_STATISTICS 613 613 if (pStats) 614 614 STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfOut), a); 615 if (rc == VINF_SUCCESS && pStats)615 if (rcStrict == VINF_SUCCESS && pStats) 616 616 STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out)); 617 617 # ifndef IN_RING3 618 else if (rc == VINF_IOM_HC_IOPORT_WRITE && pStats)618 else if (rcStrict == VINF_IOM_HC_IOPORT_WRITE && pStats) 619 619 STAM_COUNTER_INC(&pStats->CTX_MID_Z(Out, ToR3)); 620 620 # endif 621 621 #endif 622 Log3(("IOMIOPortWrite: Port=%RTiop u32=%08RX32 cb=%d rc=%Rrc\n", Port, u32Value, cbValue, rc));623 iomUnlock(pVM); 624 return rc ;622 Log3(("IOMIOPortWrite: Port=%RTiop u32=%08RX32 cb=%d rc=%Rrc\n", Port, u32Value, cbValue, VBOXSTRICTRC_VAL(rcStrict))); 623 iomUnlock(pVM); 624 return rcStrict; 625 625 } 626 626 … … 683 683 * @param cb Size of the transfer unit (1, 2 or 4 bytes). 684 684 * */ 685 VMMDECL( int) IOMIOPortWriteString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrSrc, PRTGCUINTREG pcTransfers, unsigned cb)685 VMMDECL(VBOXSTRICTRC) IOMIOPortWriteString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrSrc, PRTGCUINTREG pcTransfers, unsigned cb) 686 686 { 687 687 /* Take the IOM lock before performing any device I/O. */ 688 int rc = iomLock(pVM);689 #ifndef IN_RING3 690 if (rc == VERR_SEM_BUSY)688 int rc2 = iomLock(pVM); 689 #ifndef IN_RING3 690 if (rc2 == VERR_SEM_BUSY) 691 691 return VINF_IOM_HC_IOPORT_WRITE; 692 692 #endif 693 AssertRC(rc );693 AssertRC(rc2); 694 694 695 695 #ifdef LOG_ENABLED … … 742 742 STAM_PROFILE_ADV_START(&pStats->CTX_SUFF_Z(ProfOut), a); 743 743 #endif 744 int rc= pRange->pfnOutStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrSrc, pcTransfers, cb);744 VBOXSTRICTRC rcStrict = pRange->pfnOutStrCallback(pRange->pDevIns, pRange->pvUser, Port, pGCPtrSrc, pcTransfers, cb); 745 745 #ifdef VBOX_WITH_STATISTICS 746 746 if (pStats) 747 747 STAM_PROFILE_ADV_STOP(&pStats->CTX_SUFF_Z(ProfOut), a); 748 if (rc == VINF_SUCCESS && pStats)748 if (rcStrict == VINF_SUCCESS && pStats) 749 749 STAM_COUNTER_INC(&pStats->CTX_SUFF_Z(Out)); 750 750 # ifndef IN_RING3 751 else if (rc == VINF_IOM_HC_IOPORT_WRITE && pStats)751 else if (rcStrict == VINF_IOM_HC_IOPORT_WRITE && pStats) 752 752 STAM_COUNTER_INC(&pStats->CTX_MID_Z(Out, ToR3)); 753 753 # endif 754 754 #endif 755 Log3(("IOMIOPortWriteStr: Port=%RTiop pGCPtrSrc=%p pcTransfer=%p:{%#x->%#x} cb=%d rc =%Rrc\n",756 Port, pGCPtrSrc, pcTransfers, cTransfers, *pcTransfers, cb, rc));757 iomUnlock(pVM); 758 return rc ;755 Log3(("IOMIOPortWriteStr: Port=%RTiop pGCPtrSrc=%p pcTransfer=%p:{%#x->%#x} cb=%d rcStrict=%Rrc\n", 756 Port, pGCPtrSrc, pcTransfers, cTransfers, *pcTransfers, cb, VBOXSTRICTRC_VAL(rcStrict))); 757 iomUnlock(pVM); 758 return rcStrict; 759 759 } 760 760 … … 818 818 * @param cb The access size. 819 819 */ 820 VMMDECL( int) IOMInterpretCheckPortIOAccess(PVM pVM, PCPUMCTXCORE pCtxCore, RTIOPORT Port, unsigned cb)820 VMMDECL(VBOXSTRICTRC) IOMInterpretCheckPortIOAccess(PVM pVM, PCPUMCTXCORE pCtxCore, RTIOPORT Port, unsigned cb) 821 821 { 822 822 PVMCPU pVCpu = VMMGetCpu(pVM); … … 839 839 RTGCUINTPTR cbTss; 840 840 bool fCanHaveIOBitmap; 841 int rc = SELMGetTSSInfo(pVM, pVCpu, &GCPtrTss, &cbTss, &fCanHaveIOBitmap);842 if (RT_FAILURE(rc ))843 { 844 Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d %Rrc -> #GP(0)\n", Port, cb, rc ));841 int rc2 = SELMGetTSSInfo(pVM, pVCpu, &GCPtrTss, &cbTss, &fCanHaveIOBitmap); 842 if (RT_FAILURE(rc2)) 843 { 844 Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d %Rrc -> #GP(0)\n", Port, cb, rc2)); 845 845 return TRPMRaiseXcptErr(pVCpu, pCtxCore, X86_XCPT_GP, 0); 846 846 } … … 858 858 */ 859 859 uint16_t offIOPB; 860 rc= PGMPhysInterpretedRead(pVCpu, pCtxCore, &offIOPB, GCPtrTss + RT_OFFSETOF(VBOXTSS, offIoBitmap), sizeof(offIOPB));861 if (rc != VINF_SUCCESS)860 VBOXSTRICTRC rcStrict = PGMPhysInterpretedRead(pVCpu, pCtxCore, &offIOPB, GCPtrTss + RT_OFFSETOF(VBOXTSS, offIoBitmap), sizeof(offIOPB)); 861 if (rcStrict != VINF_SUCCESS) 862 862 { 863 863 Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d GCPtrTss=%RGv %Rrc\n", 864 Port, cb, GCPtrTss, rc));865 return rc ;864 Port, cb, GCPtrTss, VBOXSTRICTRC_VAL(rcStrict))); 865 return rcStrict; 866 866 } 867 867 … … 877 877 } 878 878 uint16_t u16; 879 rc = PGMPhysInterpretedRead(pVCpu, pCtxCore, &u16, GCPtrTss + offTss, sizeof(u16));880 if (rc != VINF_SUCCESS)879 rcStrict = PGMPhysInterpretedRead(pVCpu, pCtxCore, &u16, GCPtrTss + offTss, sizeof(u16)); 880 if (rcStrict != VINF_SUCCESS) 881 881 { 882 882 Log(("iomInterpretCheckPortIOAccess: Port=%RTiop cb=%d GCPtrTss=%RGv offTss=%#x -> %Rrc\n", 883 Port, cb, GCPtrTss, offTss, rc));884 return rc ;883 Port, cb, GCPtrTss, offTss, VBOXSTRICTRC_VAL(rcStrict))); 884 return rcStrict; 885 885 } 886 886 … … 918 918 * @param pCpu Disassembler CPU state. 919 919 */ 920 VMMDECL( int) IOMInterpretIN(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)920 VMMDECL(VBOXSTRICTRC) IOMInterpretIN(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu) 921 921 { 922 922 #ifdef IN_RC … … 935 935 cbSize = DISGetParamSize(pCpu, &pCpu->param1); 936 936 Assert(cbSize > 0); 937 int rc= IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);938 if (rc == VINF_SUCCESS)937 VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize); 938 if (rcStrict == VINF_SUCCESS) 939 939 { 940 940 /* … … 942 942 */ 943 943 uint32_t u32Data = UINT32_C(0xffffffff); 944 rc = IOMIOPortRead(pVM, uPort, &u32Data, cbSize);945 if (IOM_SUCCESS(rc ))944 rcStrict = IOMIOPortRead(pVM, uPort, &u32Data, cbSize); 945 if (IOM_SUCCESS(rcStrict)) 946 946 { 947 947 /* … … 952 952 } 953 953 else 954 AssertMsg(rc == VINF_IOM_HC_IOPORT_READ || RT_FAILURE(rc), ("%Rrc\n", rc));954 AssertMsg(rcStrict == VINF_IOM_HC_IOPORT_READ || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 955 955 } 956 956 else 957 AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rc), ("%Rrc\n", rc)); 958 return rc; 957 AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 958 959 return rcStrict; 959 960 } 960 961 … … 977 978 * @param pCpu Disassembler CPU state. 978 979 */ 979 VMMDECL( int) IOMInterpretOUT(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)980 VMMDECL(VBOXSTRICTRC) IOMInterpretOUT(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu) 980 981 { 981 982 #ifdef IN_RC … … 992 993 AssertMsg(fRc, ("Failed to get reg/imm port number!\n")); NOREF(fRc); 993 994 994 int rc= IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize);995 if (rc == VINF_SUCCESS)995 VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, uPort, cbSize); 996 if (rcStrict == VINF_SUCCESS) 996 997 { 997 998 uint64_t u64Data = 0; … … 1002 1003 * Attempt to write to the port. 1003 1004 */ 1004 rc = IOMIOPortWrite(pVM, uPort, u64Data, cbSize);1005 AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || RT_FAILURE(rc), ("%Rrc\n", rc));1005 rcStrict = IOMIOPortWrite(pVM, uPort, u64Data, cbSize); 1006 AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IOM_HC_IOPORT_WRITE || (rcStrict >= VINF_EM_FIRST && rcStrict <= VINF_EM_LAST) || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 1006 1007 } 1007 1008 else 1008 AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rc), ("%Rrc\n", rc));1009 return rc ;1010 } 1009 AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 1010 return rcStrict; 1011 } -
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r21134 r22493 1259 1259 LogFlow(("IOMMMIOHandler: GCPhys=%RGp uErr=%#x pvFault=%RGv rip=%RGv\n", 1260 1260 GCPhysFault, (uint32_t)uErrorCode, pvFault, (RTGCPTR)pCtxCore->rip)); 1261 return iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, pvUser); 1261 VBOXSTRICTRC rcStrict = iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, pvUser); 1262 return VBOXSTRICTRC_VAL(rcStrict); 1262 1263 } 1263 1264 … … 1271 1272 * @param GCPhysFault The GC physical address. 1272 1273 */ 1273 VMMDECL(int) IOMMMIOPhysHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPHYS GCPhysFault) 1274 { 1275 int rc; 1276 rc = iomLock(pVM); 1274 VMMDECL(VBOXSTRICTRC) IOMMMIOPhysHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPHYS GCPhysFault) 1275 { 1276 int rc2 = iomLock(pVM); 1277 1277 #ifndef IN_RING3 1278 if (rc == VERR_SEM_BUSY)1278 if (rc2 == VERR_SEM_BUSY) 1279 1279 return (uErrorCode & X86_TRAP_PF_RW) ? VINF_IOM_HC_MMIO_WRITE : VINF_IOM_HC_MMIO_READ; 1280 1280 #endif 1281 rc= iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, iomMMIOGetRange(&pVM->iom.s, GCPhysFault));1281 VBOXSTRICTRC rcStrict = iomMMIOHandler(pVM, uErrorCode, pCtxCore, GCPhysFault, iomMMIOGetRange(&pVM->iom.s, GCPhysFault)); 1282 1282 iomUnlock(pVM); 1283 return rc;1283 return VBOXSTRICTRC_VAL(rcStrict); 1284 1284 } 1285 1285 … … 1333 1333 * @param cbValue The size of the register to read in bytes. 1, 2 or 4 bytes. 1334 1334 */ 1335 VMMDECL( int) IOMMMIORead(PVM pVM, RTGCPHYS GCPhys, uint32_t *pu32Value, size_t cbValue)1335 VMMDECL(VBOXSTRICTRC) IOMMMIORead(PVM pVM, RTGCPHYS GCPhys, uint32_t *pu32Value, size_t cbValue) 1336 1336 { 1337 1337 /* Take the IOM lock before performing any MMIO. */ … … 1454 1454 * @param cbValue The size of the register to read in bytes. 1, 2 or 4 bytes. 1455 1455 */ 1456 VMMDECL( int) IOMMMIOWrite(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue)1456 VMMDECL(VBOXSTRICTRC) IOMMMIOWrite(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue) 1457 1457 { 1458 1458 /* Take the IOM lock before performing any MMIO. */ … … 1549 1549 * @param cbTransfer Size of transfer unit 1550 1550 */ 1551 VMMDECL( int) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)1551 VMMDECL(VBOXSTRICTRC) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer) 1552 1552 { 1553 1553 #ifdef VBOX_WITH_STATISTICS … … 1587 1587 /* Convert destination address es:edi. */ 1588 1588 RTGCPTR GCPtrDst; 1589 int rc = SELMToFlatEx(pVM, DIS_SELREG_ES, pRegFrame, (RTGCPTR)pRegFrame->rdi,1590 SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,1591 &GCPtrDst);1592 if (RT_FAILURE(rc ))1593 { 1594 Log(("INS destination address conversion failed -> fallback, rc =%d\n", rc));1589 int rc2 = SELMToFlatEx(pVM, DIS_SELREG_ES, pRegFrame, (RTGCPTR)pRegFrame->rdi, 1590 SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL, 1591 &GCPtrDst); 1592 if (RT_FAILURE(rc2)) 1593 { 1594 Log(("INS destination address conversion failed -> fallback, rc2=%d\n", rc2)); 1595 1595 return VINF_EM_RAW_EMULATE_INSTR; 1596 1596 } … … 1599 1599 uint32_t cpl = CPUMGetGuestCPL(pVCpu, pRegFrame); 1600 1600 1601 rc = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)GCPtrDst, cTransfers * cbTransfer,1602 X86_PTE_RW | ((cpl == 3) ? X86_PTE_US : 0));1603 if (rc != VINF_SUCCESS)1604 { 1605 Log(("INS will generate a trap -> fallback, rc =%d\n", rc));1601 rc2 = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)GCPtrDst, cTransfers * cbTransfer, 1602 X86_PTE_RW | ((cpl == 3) ? X86_PTE_US : 0)); 1603 if (rc2 != VINF_SUCCESS) 1604 { 1605 Log(("INS will generate a trap -> fallback, rc2=%d\n", rc2)); 1606 1606 return VINF_EM_RAW_EMULATE_INSTR; 1607 1607 } 1608 1608 1609 1609 Log(("IOM: rep ins%d port %#x count %d\n", cbTransfer * 8, uPort, cTransfers)); 1610 VBOXSTRICTRC rcStrict = VINF_SUCCESS; 1610 1611 if (cTransfers > 1) 1611 1612 { … … 1613 1614 * much as it wants. The rest is done with single-word transfers. */ 1614 1615 const RTGCUINTREG cTransfersOrg = cTransfers; 1615 rc = IOMIOPortReadString(pVM, uPort, &GCPtrDst, &cTransfers, cbTransfer);1616 AssertRC( rc); Assert(cTransfers <= cTransfersOrg);1616 rcStrict = IOMIOPortReadString(pVM, uPort, &GCPtrDst, &cTransfers, cbTransfer); 1617 AssertRC(VBOXSTRICTRC_VAL(rcStrict)); Assert(cTransfers <= cTransfersOrg); 1617 1618 pRegFrame->rdi += (cTransfersOrg - cTransfers) * cbTransfer; 1618 1619 } … … 1621 1622 MMGCRamRegisterTrapHandler(pVM); 1622 1623 #endif 1623 1624 while (cTransfers && rc == VINF_SUCCESS) 1624 while (cTransfers && rcStrict == VINF_SUCCESS) 1625 1625 { 1626 1626 uint32_t u32Value; 1627 rc = IOMIOPortRead(pVM, uPort, &u32Value, cbTransfer);1628 if (!IOM_SUCCESS(rc ))1627 rcStrict = IOMIOPortRead(pVM, uPort, &u32Value, cbTransfer); 1628 if (!IOM_SUCCESS(rcStrict)) 1629 1629 break; 1630 1630 int rc2 = iomRamWrite(pVCpu, pRegFrame, GCPtrDst, &u32Value, cbTransfer); … … 1642 1642 pRegFrame->ecx = cTransfers; 1643 1643 1644 AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_READ || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || RT_FAILURE(rc), ("%Rrc\n", rc));1645 return rc ;1644 AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IOM_HC_IOPORT_READ || (rcStrict >= VINF_EM_FIRST && rcStrict <= VINF_EM_LAST) || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 1645 return rcStrict; 1646 1646 } 1647 1647 … … 1666 1666 * @param pCpu Disassembler CPU state. 1667 1667 */ 1668 VMMDECL( int) IOMInterpretINS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)1668 VMMDECL(VBOXSTRICTRC) IOMInterpretINS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu) 1669 1669 { 1670 1670 /* … … 1679 1679 cb = (pCpu->opmode == CPUMODE_16BIT) ? 2 : 4; /* dword in both 32 & 64 bits mode */ 1680 1680 1681 int rc= IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);1682 if (RT_UNLIKELY(rc != VINF_SUCCESS))1683 { 1684 AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rc), ("%Rrc\n", rc));1685 return rc ;1681 VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb); 1682 if (RT_UNLIKELY(rcStrict != VINF_SUCCESS)) 1683 { 1684 AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 1685 return rcStrict; 1686 1686 } 1687 1687 … … 1712 1712 * @param cbTransfer Size of transfer unit 1713 1713 */ 1714 VMMDECL( int) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer)1714 VMMDECL(VBOXSTRICTRC) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer) 1715 1715 { 1716 1716 #ifdef VBOX_WITH_STATISTICS … … 1749 1749 /* Convert source address ds:esi. */ 1750 1750 RTGCPTR GCPtrSrc; 1751 int rc = SELMToFlatEx(pVM, DIS_SELREG_DS, pRegFrame, (RTGCPTR)pRegFrame->rsi,1752 SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL,1753 &GCPtrSrc);1754 if (RT_FAILURE(rc ))1755 { 1756 Log(("OUTS source address conversion failed -> fallback, rc =%Rrc\n", rc));1751 int rc2 = SELMToFlatEx(pVM, DIS_SELREG_DS, pRegFrame, (RTGCPTR)pRegFrame->rsi, 1752 SELMTOFLAT_FLAGS_HYPER | SELMTOFLAT_FLAGS_NO_PL, 1753 &GCPtrSrc); 1754 if (RT_FAILURE(rc2)) 1755 { 1756 Log(("OUTS source address conversion failed -> fallback, rc2=%Rrc\n", rc2)); 1757 1757 return VINF_EM_RAW_EMULATE_INSTR; 1758 1758 } … … 1760 1760 /* Access verification first; we currently can't recover properly from traps inside this instruction */ 1761 1761 uint32_t cpl = CPUMGetGuestCPL(pVCpu, pRegFrame); 1762 rc = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)GCPtrSrc, cTransfers * cbTransfer,1763 (cpl == 3) ? X86_PTE_US : 0);1764 if (rc != VINF_SUCCESS)1765 { 1766 Log(("OUTS will generate a trap -> fallback, rc =%Rrc\n", rc));1762 rc2 = PGMVerifyAccess(pVCpu, (RTGCUINTPTR)GCPtrSrc, cTransfers * cbTransfer, 1763 (cpl == 3) ? X86_PTE_US : 0); 1764 if (rc2 != VINF_SUCCESS) 1765 { 1766 Log(("OUTS will generate a trap -> fallback, rc2=%Rrc\n", rc2)); 1767 1767 return VINF_EM_RAW_EMULATE_INSTR; 1768 1768 } 1769 1769 1770 1770 Log(("IOM: rep outs%d port %#x count %d\n", cbTransfer * 8, uPort, cTransfers)); 1771 VBOXSTRICTRC rcStrict = VINF_SUCCESS; 1771 1772 if (cTransfers > 1) 1772 1773 { … … 1776 1777 */ 1777 1778 const RTGCUINTREG cTransfersOrg = cTransfers; 1778 rc = IOMIOPortWriteString(pVM, uPort, &GCPtrSrc, &cTransfers, cbTransfer);1779 AssertRC( rc); Assert(cTransfers <= cTransfersOrg);1779 rcStrict = IOMIOPortWriteString(pVM, uPort, &GCPtrSrc, &cTransfers, cbTransfer); 1780 AssertRC(VBOXSTRICTRC_VAL(rcStrict)); Assert(cTransfers <= cTransfersOrg); 1780 1781 pRegFrame->rsi += (cTransfersOrg - cTransfers) * cbTransfer; 1781 1782 } … … 1785 1786 #endif 1786 1787 1787 while (cTransfers && rc == VINF_SUCCESS)1788 while (cTransfers && rcStrict == VINF_SUCCESS) 1788 1789 { 1789 1790 uint32_t u32Value = 0; 1790 rc = iomRamRead(pVCpu, &u32Value, GCPtrSrc, cbTransfer);1791 if (rc != VINF_SUCCESS)1791 rcStrict = iomRamRead(pVCpu, &u32Value, GCPtrSrc, cbTransfer); 1792 if (rcStrict != VINF_SUCCESS) 1792 1793 break; 1793 rc = IOMIOPortWrite(pVM, uPort, u32Value, cbTransfer);1794 if (!IOM_SUCCESS(rc ))1794 rcStrict = IOMIOPortWrite(pVM, uPort, u32Value, cbTransfer); 1795 if (!IOM_SUCCESS(rcStrict)) 1795 1796 break; 1796 1797 GCPtrSrc = (RTGCPTR)((RTUINTPTR)GCPtrSrc + cbTransfer); … … 1807 1808 pRegFrame->ecx = cTransfers; 1808 1809 1809 AssertMsg(rc == VINF_SUCCESS || rc == VINF_IOM_HC_IOPORT_WRITE || (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) || RT_FAILURE(rc), ("%Rrc\n", rc));1810 return rc ;1810 AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IOM_HC_IOPORT_WRITE || (rcStrict >= VINF_EM_FIRST && rcStrict <= VINF_EM_LAST) || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 1811 return rcStrict; 1811 1812 } 1812 1813 … … 1831 1832 * @param pCpu Disassembler CPU state. 1832 1833 */ 1833 VMMDECL( int) IOMInterpretOUTS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)1834 VMMDECL(VBOXSTRICTRC) IOMInterpretOUTS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu) 1834 1835 { 1835 1836 /* … … 1846 1847 cb = (pCpu->opmode == CPUMODE_16BIT) ? 2 : 4; /* dword in both 32 & 64 bits mode */ 1847 1848 1848 int rc= IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);1849 if (RT_UNLIKELY(rc != VINF_SUCCESS))1850 { 1851 AssertMsg(rc == VINF_EM_RAW_GUEST_TRAP || rc == VINF_TRPM_XCPT_DISPATCHED || rc == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rc), ("%Rrc\n", rc));1852 return rc ;1849 VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb); 1850 if (RT_UNLIKELY(rcStrict != VINF_SUCCESS)) 1851 { 1852 AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict))); 1853 return rcStrict; 1853 1854 } 1854 1855
Note:
See TracChangeset
for help on using the changeset viewer.