Changeset 13833 in vbox for trunk/src/VBox/VMM/PATM
- Timestamp:
- Nov 5, 2008 2:15:04 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38824
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/PATM.cpp
r13830 r13833 120 120 /** @todo bad safety precaution */ 121 121 rc = MMR3HyperAllocOnceNoRel(pVM, PATCH_MEMORY_SIZE + PAGE_SIZE + PATM_STACK_TOTAL_SIZE + PAGE_SIZE + PATM_STAT_MEMSIZE, PAGE_SIZE, MM_TAG_PATM, (void **)&pVM->patm.s.pPatchMemHC); 122 if ( VBOX_FAILURE(rc))122 if (RT_FAILURE(rc)) 123 123 { 124 124 Log(("MMR3HyperAlloc failed with %Vrc\n", rc)); … … 154 154 /* Check CFGM option. */ 155 155 rc = CFGMR3QueryBool(CFGMR3GetRoot(pVM), "PATMEnabled", &pVM->fPATMEnabled); 156 if ( VBOX_FAILURE(rc))156 if (RT_FAILURE(rc)) 157 157 # ifdef PATM_DISABLE_ALL 158 158 pVM->fPATMEnabled = false; … … 164 164 rc = patmReinit(pVM); 165 165 AssertRC(rc); 166 if ( VBOX_FAILURE(rc))166 if (RT_FAILURE(rc)) 167 167 return rc; 168 168 … … 173 173 NULL, patmr3Save, NULL, 174 174 NULL, patmr3Load, NULL); 175 if ( VBOX_FAILURE(rc))175 if (RT_FAILURE(rc)) 176 176 { 177 177 AssertRC(rc); … … 187 187 { 188 188 int rc = DBGCRegisterCommands(&g_aCmds[0], RT_ELEMENTS(g_aCmds)); 189 if ( VBOX_SUCCESS(rc))189 if (RT_SUCCESS(rc)) 190 190 fRegisteredCmds = true; 191 191 } … … 283 283 /* The GC state, stack and statistics must be read/write for the guest (supervisor only of course). */ 284 284 int rc = PGMMapSetPage(pVM, pVM->patm.s.pGCStateGC, PAGE_SIZE, X86_PTE_P | X86_PTE_A | X86_PTE_D | X86_PTE_RW); 285 if ( VBOX_FAILURE(rc))285 if (RT_FAILURE(rc)) 286 286 Log(("PATMR3InitFinalize: PGMMapSetPage failed with %Vrc!!\n", rc)); 287 287 288 288 rc = PGMMapSetPage(pVM, pVM->patm.s.pGCStackGC, PATM_STACK_TOTAL_SIZE, X86_PTE_P | X86_PTE_A | X86_PTE_D | X86_PTE_RW); 289 if ( VBOX_FAILURE(rc))289 if (RT_FAILURE(rc)) 290 290 Log(("PATMR3InitFinalize: PGMMapSetPage failed with %Vrc!!\n", rc)); 291 291 292 292 rc = PGMMapSetPage(pVM, pVM->patm.s.pStatsGC, PATM_STAT_MEMSIZE, X86_PTE_P | X86_PTE_A | X86_PTE_D | X86_PTE_RW); 293 if ( VBOX_FAILURE(rc))293 if (RT_FAILURE(rc)) 294 294 Log(("PATMR3InitFinalize: PGMMapSetPage failed with %Vrc!!\n", rc)); 295 295 … … 381 381 /* We generate a fake patch in order to use the existing code for relocation. */ 382 382 rc = MMHyperAlloc(pVM, sizeof(PATMPATCHREC), 0, MM_TAG_PATM_PATCH, (void **)&pVM->patm.s.pGlobalPatchRec); 383 if ( VBOX_FAILURE(rc))383 if (RT_FAILURE(rc)) 384 384 { 385 385 Log(("Out of memory!!!!\n")); … … 499 499 500 500 int rc = patmReinit(pVM); 501 if ( VBOX_SUCCESS(rc))501 if (RT_SUCCESS(rc)) 502 502 rc = PATMR3InitFinalize(pVM); /* paranoia */ 503 503 … … 535 535 { 536 536 int rc = PATMR3QueryOpcode(pDisInfo->pVM, (RTRCPTR)pSrc, pDest); 537 if ( VBOX_SUCCESS(rc))537 if (RT_SUCCESS(rc)) 538 538 { 539 539 pSrc++; … … 653 653 654 654 rc = PGMPhysSimpleReadGCPtr(pVM, curInstr, pPatch->patch.pPrivInstrGC, pPatch->patch.cbPrivInstr); 655 Assert( VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT);655 Assert(RT_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT); 656 656 657 657 pRec->pDest = (RTRCPTR)((RTRCUINTPTR)pRec->pDest + delta); … … 663 663 Log(("PATM: Patch page not present -> check later!\n")); 664 664 rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_ALL, pPage, pPage + (PAGE_SIZE - 1) /* inclusive! */, 0, patmVirtPageHandler, "PATMGCMonitorPage", 0, "PATMMonitorPatchJump"); 665 Assert( VBOX_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT);665 Assert(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT); 666 666 } 667 667 else … … 676 676 } 677 677 else 678 if ( VBOX_SUCCESS(rc))678 if (RT_SUCCESS(rc)) 679 679 { 680 680 *(RTRCPTR *)&curInstr[pPatch->patch.cbPrivInstr - sizeof(RTRCPTR)] = pRec->pDest; … … 730 730 */ 731 731 rc = PGMPhysSimpleReadGCPtr(pVM, temp, pPatch->patch.pPrivInstrGC, pPatch->patch.cbPatchJump); 732 Assert( VBOX_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT);732 Assert(RT_SUCCESS(rc) || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT); 733 733 734 734 if (rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT) … … 737 737 738 738 rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_ALL, pPage, pPage + (PAGE_SIZE - 1) /* inclusive! */, 0, patmVirtPageHandler, "PATMGCMonitorPage", 0, "PATMMonitorPatchJump"); 739 Assert( VBOX_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT);739 Assert(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT); 740 740 } 741 741 else … … 750 750 } 751 751 else 752 if ( VBOX_SUCCESS(rc))752 if (RT_SUCCESS(rc)) 753 753 { 754 754 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pJumpOffGC, &displ, sizeof(displ)); … … 1056 1056 rc = VERR_PATCHING_REFUSED; /* exists as a normal patch; can't use it */ 1057 1057 1058 if ( VBOX_FAILURE(rc))1058 if (RT_FAILURE(rc)) 1059 1059 { 1060 1060 uint8_t *pPatchHC; … … 1580 1580 rc = patmAnalyseBlockCallback(pVM, pCpu, pInstrGC, pCurInstrGC, pUserData); 1581 1581 1582 if ( VBOX_FAILURE(rc))1582 if (RT_FAILURE(rc)) 1583 1583 return rc; 1584 1584 … … 1625 1625 Assert(!PATMIsPatchGCAddr(pVM, pTargetGC)); 1626 1626 rc = patmPatchGenCall(pVM, pPatch, pCpu, pCurInstrGC, pTargetGC, false); 1627 if ( VBOX_FAILURE(rc))1627 if (RT_FAILURE(rc)) 1628 1628 goto end; 1629 1629 } … … 1631 1631 rc = patmPatchGenRelJump(pVM, pPatch, pTargetGC, pCpu->pCurInstr->opcode, !!(pCpu->prefix & PREFIX_OPSIZE)); 1632 1632 1633 if ( VBOX_SUCCESS(rc))1633 if (RT_SUCCESS(rc)) 1634 1634 rc = VWRN_CONTINUE_RECOMPILE; 1635 1635 … … 1655 1655 1656 1656 rc = patmPatchGenCli(pVM, pPatch); 1657 if ( VBOX_SUCCESS(rc))1657 if (RT_SUCCESS(rc)) 1658 1658 rc = VWRN_CONTINUE_RECOMPILE; 1659 1659 break; … … 1679 1679 /* mov GPR, ss */ 1680 1680 rc = patmPatchGenMovFromSS(pVM, pPatch, pCpu, pCurInstrGC); 1681 if ( VBOX_SUCCESS(rc))1681 if (RT_SUCCESS(rc)) 1682 1682 rc = VWRN_CONTINUE_RECOMPILE; 1683 1683 break; … … 1711 1711 rc = patmPatchGenSti(pVM, pPatch, pCurInstrGC, pNextInstrGC); 1712 1712 1713 if ( VBOX_SUCCESS(rc))1713 if (RT_SUCCESS(rc)) 1714 1714 { 1715 1715 DISCPUSTATE cpu = *pCpu; … … 1745 1745 /* Not an exit point for function duplication patches */ 1746 1746 if ( (pPatch->flags & PATMFL_DUPLICATE_FUNCTION) 1747 && VBOX_SUCCESS(rc))1747 && RT_SUCCESS(rc)) 1748 1748 { 1749 1749 pPatch->flags &= ~PATMFL_GENERATE_JUMPTOGUEST; /* Don't generate a jump back */ … … 1771 1771 1772 1772 rc = patmPatchGenPopf(pVM, pPatch, pCurInstrGC + pCpu->opsize, !!(pCpu->prefix & PREFIX_OPSIZE), fGenerateJmpBack); 1773 if ( VBOX_SUCCESS(rc))1773 if (RT_SUCCESS(rc)) 1774 1774 { 1775 1775 if (fGenerateJmpBack == false) … … 1789 1789 case OP_PUSHF: 1790 1790 rc = patmPatchGenPushf(pVM, pPatch, !!(pCpu->prefix & PREFIX_OPSIZE)); 1791 if ( VBOX_SUCCESS(rc))1791 if (RT_SUCCESS(rc)) 1792 1792 rc = VWRN_CONTINUE_RECOMPILE; 1793 1793 break; … … 1797 1797 { 1798 1798 rc = patmPatchGenPushCS(pVM, pPatch); 1799 if ( VBOX_SUCCESS(rc))1799 if (RT_SUCCESS(rc)) 1800 1800 rc = VWRN_CONTINUE_RECOMPILE; 1801 1801 break; … … 1806 1806 Log(("IRET at %VRv\n", pCurInstrGC)); 1807 1807 rc = patmPatchGenIret(pVM, pPatch, pCurInstrGC, !!(pCpu->prefix & PREFIX_OPSIZE)); 1808 if ( VBOX_SUCCESS(rc))1808 if (RT_SUCCESS(rc)) 1809 1809 { 1810 1810 pPatch->flags |= PATMFL_FOUND_PATCHEND; … … 1816 1816 /* This appears to be some kind of kernel panic in Linux 2.4; no point to continue */ 1817 1817 rc = patmPatchGenIllegalInstr(pVM, pPatch); 1818 if ( VBOX_SUCCESS(rc))1818 if (RT_SUCCESS(rc)) 1819 1819 rc = VINF_SUCCESS; /* exit point by definition */ 1820 1820 Log(("Illegal opcode (0xf 0xb)\n")); … … 1823 1823 case OP_CPUID: 1824 1824 rc = patmPatchGenCpuid(pVM, pPatch, pCurInstrGC); 1825 if ( VBOX_SUCCESS(rc))1825 if (RT_SUCCESS(rc)) 1826 1826 rc = VWRN_CONTINUE_RECOMPILE; 1827 1827 break; … … 1830 1830 case OP_SLDT: 1831 1831 rc = patmPatchGenSldtStr(pVM, pPatch, pCpu, pCurInstrGC); 1832 if ( VBOX_SUCCESS(rc))1832 if (RT_SUCCESS(rc)) 1833 1833 rc = VWRN_CONTINUE_RECOMPILE; 1834 1834 break; … … 1837 1837 case OP_SIDT: 1838 1838 rc = patmPatchGenSxDT(pVM, pPatch, pCpu, pCurInstrGC); 1839 if ( VBOX_SUCCESS(rc))1839 if (RT_SUCCESS(rc)) 1840 1840 rc = VWRN_CONTINUE_RECOMPILE; 1841 1841 break; … … 1844 1844 /* retn is an exit point for function patches */ 1845 1845 rc = patmPatchGenRet(pVM, pPatch, pCpu, pCurInstrGC); 1846 if ( VBOX_SUCCESS(rc))1846 if (RT_SUCCESS(rc)) 1847 1847 rc = VINF_SUCCESS; /* exit point by definition */ 1848 1848 break; … … 1851 1851 /* Duplicate it, so it can be emulated in GC (or fault). */ 1852 1852 rc = patmPatchGenDuplicate(pVM, pPatch, pCpu, pCurInstrGC); 1853 if ( VBOX_SUCCESS(rc))1853 if (RT_SUCCESS(rc)) 1854 1854 rc = VINF_SUCCESS; /* exit point by definition */ 1855 1855 break; … … 1864 1864 { 1865 1865 rc = patmPatchGenCall(pVM, pPatch, pCpu, pCurInstrGC, (RTRCPTR)0xDEADBEEF, true); 1866 if ( VBOX_SUCCESS(rc))1866 if (RT_SUCCESS(rc)) 1867 1867 { 1868 1868 rc = VWRN_CONTINUE_RECOMPILE; … … 1881 1881 { 1882 1882 rc = patmPatchGenJump(pVM, pPatch, pCpu, pCurInstrGC); 1883 if ( VBOX_SUCCESS(rc))1883 if (RT_SUCCESS(rc)) 1884 1884 rc = VINF_SUCCESS; /* end of branch */ 1885 1885 break; … … 1897 1897 { 1898 1898 rc = patmPatchGenMovDebug(pVM, pPatch, pCpu); 1899 if ( VBOX_SUCCESS(rc))1899 if (RT_SUCCESS(rc)) 1900 1900 rc = VWRN_CONTINUE_RECOMPILE; 1901 1901 break; … … 1908 1908 { 1909 1909 rc = patmPatchGenMovControl(pVM, pPatch, pCpu); 1910 if ( VBOX_SUCCESS(rc))1910 if (RT_SUCCESS(rc)) 1911 1911 rc = VWRN_CONTINUE_RECOMPILE; 1912 1912 break; … … 1919 1919 gen_illegal_instr: 1920 1920 rc = patmPatchGenIllegalInstr(pVM, pPatch); 1921 if ( VBOX_SUCCESS(rc))1921 if (RT_SUCCESS(rc)) 1922 1922 rc = VINF_SUCCESS; /* exit point by definition */ 1923 1923 } … … 1927 1927 Log(("patmPatchGenDuplicate\n")); 1928 1928 rc = patmPatchGenDuplicate(pVM, pPatch, pCpu, pCurInstrGC); 1929 if ( VBOX_SUCCESS(rc))1929 if (RT_SUCCESS(rc)) 1930 1930 rc = VWRN_CONTINUE_RECOMPILE; 1931 1931 } … … 1955 1955 rc2 = patmPatchGenClearInhibitIRQ(pVM, pPatch, pNextInstrGC); 1956 1956 } 1957 if ( VBOX_FAILURE(rc2))1957 if (RT_FAILURE(rc2)) 1958 1958 rc = rc2; 1959 1959 } 1960 1960 1961 if ( VBOX_SUCCESS(rc))1961 if (RT_SUCCESS(rc)) 1962 1962 { 1963 1963 // If single instruction patch, we've copied enough instructions *and* the current instruction is not a relative jump … … 2355 2355 { 2356 2356 rc = pfnPATMR3Recompile(pVM, &cpunext, pInstrGC, pNextInstrGC, pUserData); 2357 if ( VBOX_SUCCESS(rc))2357 if (RT_SUCCESS(rc)) 2358 2358 { 2359 2359 rc = VINF_SUCCESS; … … 2394 2394 /* First we need to finish this linear code stream until the next exit point. */ 2395 2395 rc = patmRecompileCodeStream(pVM, pInstrGC, pCurInstrGC+opsize, pfnPATMR3Recompile, pUserData); 2396 if ( VBOX_FAILURE(rc))2396 if (RT_FAILURE(rc)) 2397 2397 { 2398 2398 Log(("patmRecompileCodeStream fatal error %d\n", rc)); … … 2428 2428 } 2429 2429 2430 if ( VBOX_FAILURE(rc))2430 if (RT_FAILURE(rc)) 2431 2431 { 2432 2432 Log(("patmRecompileCodeStream fatal error %d\n", rc)); … … 2721 2721 /* Install fake cli patch (to clear the virtual IF and check int xx parameters) */ 2722 2722 rc = patmPatchGenIntEntry(pVM, pPatch, pInstrGC); 2723 if ( VBOX_FAILURE(rc))2723 if (RT_FAILURE(rc)) 2724 2724 goto failure; 2725 2725 } … … 2732 2732 { 2733 2733 rc = patmPatchGenStats(pVM, pPatch, pInstrGC); 2734 if ( VBOX_FAILURE(rc))2734 if (RT_FAILURE(rc)) 2735 2735 goto failure; 2736 2736 } … … 2803 2803 /* Replace first opcode byte with 'int 3'. */ 2804 2804 rc = patmActivateInt3Patch(pVM, pPatch); 2805 if ( VBOX_FAILURE(rc))2805 if (RT_FAILURE(rc)) 2806 2806 goto failure; 2807 2807 … … 2819 2819 rc = patmGenJumpToPatch(pVM, pPatch, true); 2820 2820 AssertRC(rc); 2821 if ( VBOX_FAILURE(rc))2821 if (RT_FAILURE(rc)) 2822 2822 goto failure; 2823 2823 … … 2931 2931 #ifdef VBOX_WITH_STATISTICS 2932 2932 rc = patmPatchGenStats(pVM, pPatch, pInstrGC); 2933 if ( VBOX_FAILURE(rc))2933 if (RT_FAILURE(rc)) 2934 2934 goto failure; 2935 2935 #endif … … 2937 2937 /* Install fake cli patch (to clear the virtual IF) */ 2938 2938 rc = patmPatchGenIntEntry(pVM, pPatch, pInstrGC); 2939 if ( VBOX_FAILURE(rc))2939 if (RT_FAILURE(rc)) 2940 2940 goto failure; 2941 2941 … … 2945 2945 /* Duplicate push. */ 2946 2946 rc = patmPatchGenDuplicate(pVM, pPatch, &cpuPush, pInstrGC); 2947 if ( VBOX_FAILURE(rc))2947 if (RT_FAILURE(rc)) 2948 2948 goto failure; 2949 2949 2950 2950 /* Generate jump to common entrypoint. */ 2951 2951 rc = patmPatchGenPatchJump(pVM, pPatch, pCurInstrGC, PATCHCODE_PTR_GC(&pJmpPatch->patch)); 2952 if ( VBOX_FAILURE(rc))2952 if (RT_FAILURE(rc)) 2953 2953 goto failure; 2954 2954 … … 3023 3023 #ifdef VBOX_WITH_STATISTICS 3024 3024 rc = patmPatchGenStats(pVM, pPatch, pInstrGC); 3025 if ( VBOX_FAILURE(rc))3025 if (RT_FAILURE(rc)) 3026 3026 goto failure; 3027 3027 #endif 3028 3028 3029 3029 rc = patmPatchGenTrapEntry(pVM, pPatch, pInstrGC); 3030 if ( VBOX_FAILURE(rc))3030 if (RT_FAILURE(rc)) 3031 3031 goto failure; 3032 3032 … … 3145 3145 /** @note Set the PATM interrupt flag here; it was cleared before the patched call. (!!!) */ 3146 3146 rc = patmPatchGenSetPIF(pVM, pPatch, pInstrGC); 3147 if ( VBOX_FAILURE(rc))3147 if (RT_FAILURE(rc)) 3148 3148 goto failure; 3149 3149 3150 3150 #ifdef VBOX_WITH_STATISTICS 3151 3151 rc = patmPatchGenStats(pVM, pPatch, pInstrGC); 3152 if ( VBOX_FAILURE(rc))3152 if (RT_FAILURE(rc)) 3153 3153 goto failure; 3154 3154 #endif … … 3295 3295 /** @note Set the PATM interrupt flag here; it was cleared before the patched call. (!!!) */ 3296 3296 rc = patmPatchGenSetPIF(pVM, pPatch, pInstrGC); 3297 if ( VBOX_FAILURE(rc))3297 if (RT_FAILURE(rc)) 3298 3298 goto failure; 3299 3299 3300 3300 #ifdef VBOX_WITH_STATISTICS 3301 3301 rc = patmPatchGenStats(pVM, pPatch, pInstrGC); 3302 if ( VBOX_FAILURE(rc))3302 if (RT_FAILURE(rc)) 3303 3303 goto failure; 3304 3304 #endif 3305 3305 3306 3306 rc = patmPatchGenPatchJump(pVM, pPatch, pInstrGC, pPatchTargetGC); 3307 if ( VBOX_FAILURE(rc))3307 if (RT_FAILURE(rc)) 3308 3308 goto failure; 3309 3309 … … 3531 3531 rc = patmGenCallToPatch(pVM, pPatch, PATCHCODE_PTR_GC(&pPatchFunction->patch), true); 3532 3532 AssertRC(rc); 3533 if ( VBOX_FAILURE(rc))3533 if (RT_FAILURE(rc)) 3534 3534 goto failure; 3535 3535 … … 3609 3609 rc = PGMPhysSimpleDirtyWriteGCPtr(pVM, pInstrGC + pCpu->opsize - sizeof(RTRCPTR), &pVM->patm.s.mmio.pCachedData, sizeof(RTRCPTR)); 3610 3610 AssertRC(rc); 3611 if ( VBOX_FAILURE(rc))3611 if (RT_FAILURE(rc)) 3612 3612 { 3613 3613 goto failure; … … 3782 3782 /* Replace first opcode byte with 'int 3'. */ 3783 3783 rc = patmActivateInt3Patch(pVM, pPatch); 3784 if ( VBOX_FAILURE(rc))3784 if (RT_FAILURE(rc)) 3785 3785 goto failure; 3786 3786 … … 3893 3893 rc = patmGenJumpToPatch(pVM, pPatch, true); 3894 3894 AssertRC(rc); 3895 if ( VBOX_FAILURE(rc))3895 if (RT_FAILURE(rc)) 3896 3896 goto failure; 3897 3897 … … 4060 4060 /** @todo we shouldn't disable and enable patches too often (it's relatively cheap, but pointless if it always happens) */ 4061 4061 rc = PATMR3EnablePatch(pVM, pInstrGC); 4062 if ( VBOX_SUCCESS(rc))4062 if (RT_SUCCESS(rc)) 4063 4063 return VWRN_PATCH_ENABLED; 4064 4064 … … 4085 4085 } 4086 4086 rc = PATMR3RemovePatch(pVM, pInstrGC); 4087 if ( VBOX_FAILURE(rc))4087 if (RT_FAILURE(rc)) 4088 4088 return VERR_PATCHING_REFUSED; 4089 4089 } … … 4097 4097 4098 4098 rc = MMHyperAlloc(pVM, sizeof(PATMPATCHREC), 0, MM_TAG_PATM_PATCH, (void **)&pPatchRec); 4099 if ( VBOX_FAILURE(rc))4099 if (RT_FAILURE(rc)) 4100 4100 { 4101 4101 Log(("Out of memory!!!!\n")); … … 4444 4444 pPatchPage->cMaxPatches += PATMPATCHPAGE_PREALLOC_INCREMENT; 4445 4445 rc = MMHyperAlloc(pVM, sizeof(PPATCHINFO)*pPatchPage->cMaxPatches, 0, MM_TAG_PATM_PATCH, (void **)&pPatchPage->aPatch); 4446 if ( VBOX_FAILURE(rc))4446 if (RT_FAILURE(rc)) 4447 4447 { 4448 4448 Log(("Out of memory!!!!\n")); … … 4458 4458 { 4459 4459 rc = MMHyperAlloc(pVM, sizeof(PATMPATCHPAGE), 0, MM_TAG_PATM_PATCH, (void **)&pPatchPage); 4460 if ( VBOX_FAILURE(rc))4460 if (RT_FAILURE(rc)) 4461 4461 { 4462 4462 Log(("Out of memory!!!!\n")); … … 4468 4468 4469 4469 rc = MMHyperAlloc(pVM, sizeof(PPATCHINFO)*PATMPATCHPAGE_PREALLOC_INCREMENT, 0, MM_TAG_PATM_PATCH, (void **)&pPatchPage->aPatch); 4470 if ( VBOX_FAILURE(rc))4470 if (RT_FAILURE(rc)) 4471 4471 { 4472 4472 Log(("Out of memory!!!!\n")); … … 5138 5138 5139 5139 rc = PATMR3InstallPatch(pVM, pInstrGC, PATMFL_CODE32 | PATMFL_JUMP_CONFLICT); 5140 if ( VBOX_SUCCESS(rc))5140 if (RT_SUCCESS(rc)) 5141 5141 { 5142 5142 Log(("PATM -> CONFLICT: Installed JMP patch for patch conflict at %VRv\n", pInstrGC)); … … 5154 5154 if (rc == VWRN_PATCH_REMOVED) 5155 5155 return VINF_SUCCESS; 5156 if ( VBOX_SUCCESS(rc))5156 if (RT_SUCCESS(rc)) 5157 5157 { 5158 5158 pConflictPatch->flags &= ~(PATMFL_MUST_INSTALL_PATCHJMP|PATMFL_INSTR_HINT); … … 5163 5163 5164 5164 AssertRC(rc); 5165 if ( VBOX_SUCCESS(rc))5165 if (RT_SUCCESS(rc)) 5166 5166 { 5167 5167 STAM_COUNTER_INC(&pVM->patm.s.StatInt3Callable); … … 5247 5247 rc = patmGenJumpToPatch(pVM, pPatch, false); 5248 5248 AssertRC(rc); 5249 if ( VBOX_FAILURE(rc))5249 if (RT_FAILURE(rc)) 5250 5250 return rc; 5251 5251 … … 5284 5284 5285 5285 rc = patmActivateInt3Patch(pVM, pPatch); 5286 if ( VBOX_FAILURE(rc))5286 if (RT_FAILURE(rc)) 5287 5287 return rc; 5288 5288 } … … 5445 5445 /* Attempt to install a new patch. */ 5446 5446 rc = PATMR3InstallPatch(pVM, pInstrGC, pPatch->flags & (PATMFL_CODE32|PATMFL_IDTHANDLER|PATMFL_INTHANDLER|PATMFL_TRAPHANDLER|PATMFL_DUPLICATE_FUNCTION|PATMFL_TRAPHANDLER_WITH_ERRORCODE|PATMFL_IDTHANDLER_WITHOUT_ENTRYPOINT)); 5447 if ( VBOX_SUCCESS(rc))5447 if (RT_SUCCESS(rc)) 5448 5448 { 5449 5449 RTRCPTR pPatchTargetGC; … … 5464 5464 /* insert jump to new patch in old patch block */ 5465 5465 rc = patmPatchGenPatchJump(pVM, pPatch, pInstrGC, pPatchTargetGC, false /* no lookup record */); 5466 if ( VBOX_FAILURE(rc))5466 if (RT_FAILURE(rc)) 5467 5467 goto failure; 5468 5468 … … 5485 5485 5486 5486 failure: 5487 if ( VBOX_FAILURE(rc))5487 if (RT_FAILURE(rc)) 5488 5488 { 5489 5489 LogRel(("PATM: patmR3RefreshPatch: failed to refresh patch at %VRv. Reactiving old one. \n", pInstrGC)); … … 5843 5843 /* Only harmless instructions are acceptable. */ 5844 5844 rc = CPUMR3DisasmInstrCPU(pVM, pCtx, pCurPatchInstrGC, &CpuOld, 0); 5845 if ( VBOX_FAILURE(rc)5845 if ( RT_FAILURE(rc) 5846 5846 || !(CpuOld.pCurInstr->optype & OPTYPE_HARMLESS)) 5847 5847 break; … … 5871 5871 } 5872 5872 5873 if ( VBOX_SUCCESS(rc)5873 if ( RT_SUCCESS(rc) 5874 5874 && (CpuOld.pCurInstr->optype & OPTYPE_HARMLESS) 5875 5875 ) … … 5881 5881 cbLeft = cbDirty; 5882 5882 5883 while (cbLeft && VBOX_SUCCESS(rc))5883 while (cbLeft && RT_SUCCESS(rc)) 5884 5884 { 5885 5885 bool fValidInstr; … … 5947 5947 rc = VERR_PATCHING_REFUSED; 5948 5948 5949 if ( VBOX_SUCCESS(rc))5949 if (RT_SUCCESS(rc)) 5950 5950 { 5951 5951 STAM_COUNTER_INC(&pVM->patm.s.StatInstrDirtyGood); … … 5961 5961 { 5962 5962 rc = patmR3RefreshPatch(pVM, pPatch); 5963 if ( VBOX_FAILURE(rc))5963 if (RT_FAILURE(rc)) 5964 5964 { 5965 5965 LogRel(("PATM: Failed to refresh dirty patch at %VRv. Disabling it.\n", pPatch->patch.pPrivInstrGC)); … … 6149 6149 6150 6150 rc = patmR3HandleDirtyInstr(pVM, pCtx, pPatch, pPatchToGuestRec, pEip); 6151 if ( VBOX_SUCCESS(rc))6151 if (RT_SUCCESS(rc)) 6152 6152 { 6153 6153 /* Retry the current instruction. */
Note:
See TracChangeset
for help on using the changeset viewer.