Changeset 12760 in vbox
- Timestamp:
- Sep 26, 2008 10:10:38 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 37088
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r12688 r12760 46 46 #include <iprt/asm.h> 47 47 #include <iprt/string.h> 48 49 50 /******************************************************************************* 51 * Defined Constants And Macros * 52 *******************************************************************************/ 53 /** @def EM_ASSERT_FAULT_RETURN 54 * Safety check. 55 * 56 * Could in theory it misfire on a cross page boundary access... 57 * 58 * Currently disabled because the CSAM (+ PATM) patch monitoring occationally 59 * turns up an alias page instead of the original faulting one and annoying the 60 * heck out of anyone running a debug build. See @bugref{2609} and @bugref{1931}. 61 */ 62 #if 0 63 # define EM_ASSERT_FAULT_RETURN(expr, rc) AssertReturn(expr, rc) 64 #else 65 # define EM_ASSERT_FAULT_RETURN(expr, rc) do { } while (0) 66 #endif 48 67 49 68 … … 444 463 pParam1 = (RTGCPTR)param1.val.val64; 445 464 pParam1 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, pParam1); 446 #ifdef IN_GC 447 /* Safety check (in theory it could cross a page boundary and fault there though) */ 448 AssertReturn(pParam1 == pvFault, VERR_EM_INTERPRETER); 449 #endif 465 EM_ASSERT_FAULT_RETURN(pParam1 == pvFault, VERR_EM_INTERPRETER); 450 466 rc = emRamRead(pVM, &valpar1, pParam1, param1.size); 451 467 if (VBOX_FAILURE(rc)) … … 466 482 pParam2 = (RTGCPTR)param2.val.val64; 467 483 pParam2 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param2, pParam2); 468 #ifdef IN_GC 469 /* Safety check (in theory it could cross a page boundary and fault there though) */ 470 AssertReturn(pParam2 == pvFault, VERR_EM_INTERPRETER); 471 #endif 484 EM_ASSERT_FAULT_RETURN(pParam2 == pvFault, VERR_EM_INTERPRETER); 472 485 rc = emRamRead(pVM, &valpar2, pParam2, param2.size); 473 486 if (VBOX_FAILURE(rc)) … … 667 680 668 681 pParam1 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, pParam1); 669 670 #ifdef IN_GC 671 /* Safety check (in theory it could cross a page boundary and fault there though) */ 672 AssertMsgReturn(pParam1 == pvFault || (RTGCPTR)pRegFrame->esp == pvFault, ("%VGv != %VGv ss:esp=%04X:%08x\n", pParam1, pvFault, pRegFrame->ss, pRegFrame->esp), VERR_EM_INTERPRETER); 673 #endif 682 EM_ASSERT_FAULT_RETURN(pParam1 == pvFault || (RTGCPTR)pRegFrame->esp == pvFault, VERR_EM_INTERPRETER); 674 683 rc = emRamWrite(pVM, pParam1, &valpar1, param1.size); 675 684 if (VBOX_FAILURE(rc)) … … 742 751 pParam1 = (RTGCPTR)param1.val.val64; 743 752 pParam1 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, pParam1); 744 745 #ifdef IN_GC 746 /* Safety check (in theory it could cross a page boundary and fault there though) */ 747 AssertMsgReturn(pParam1 == pvFault, ("eip=%VGv, pParam1=%VGv pvFault=%VGv\n", pRegFrame->rip, pParam1, pvFault), VERR_EM_INTERPRETER); 748 #endif 753 EM_ASSERT_FAULT_RETURN(pParam1 == pvFault, VERR_EM_INTERPRETER); 749 754 rc = emRamRead(pVM, &valpar1, pParam1, param1.size); 750 755 if (VBOX_FAILURE(rc)) … … 843 848 #endif 844 849 845 # 850 #ifdef IN_GC 846 851 /* Safety check (in theory it could cross a page boundary and fault there though) */ 847 852 Assert( TRPMHasTrap(pVM) 848 853 && (TRPMGetErrorCode(pVM) & X86_TRAP_PF_RW)); 849 AssertMsgReturn(GCPtrPar1 == pvFault, ("eip=%VGv, GCPtrPar1=%VGv pvFault=%VGv\n", pRegFrame->rip, GCPtrPar1, pvFault), VERR_EM_INTERPRETER);850 # 854 EM_ASSERT_FAULT_RETURN(GCPtrPar1 == pvFault, VERR_EM_INTERPRETER); 855 #endif 851 856 852 857 /* Register and immediate data == PARMTYPE_IMMEDIATE */ … … 921 926 pParam1 = (RTGCPTR)param1.val.val64; 922 927 pParam1 = emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, pParam1); 923 924 #ifdef IN_GC 925 /* Safety check (in theory it could cross a page boundary and fault there though) */ 926 AssertReturn(pParam1 == pvFault, VERR_EM_INTERPRETER); 927 #endif 928 EM_ASSERT_FAULT_RETURN(pParam1 == pvFault, VERR_EM_INTERPRETER); 928 929 rc = emRamRead(pVM, &valpar1, pParam1, param1.size); 929 930 if (VBOX_FAILURE(rc)) … … 1034 1035 Log2(("emInterpret%s: pvFault=%VGv pParam1=%VGv val2=%x\n", emGetMnemonic(pCpu), pvFault, pParam1, valpar2)); 1035 1036 pParam1 = (RTGCPTR)((RTGCUINTPTR)pParam1 + valpar2/8); 1036 #ifdef IN_GC 1037 /* Safety check. */ 1038 AssertMsgReturn((RTGCPTR)((RTGCUINTPTR)pParam1 & ~3) == pvFault, ("pParam1=%VGv pvFault=%VGv\n", pParam1, pvFault), VERR_EM_INTERPRETER); 1039 #endif 1037 EM_ASSERT_FAULT_RETURN((RTGCPTR)((RTGCUINTPTR)pParam1 & ~3) == pvFault, VERR_EM_INTERPRETER); 1040 1038 rc = emRamRead(pVM, &valpar1, pParam1, 1); 1041 1039 if (VBOX_FAILURE(rc)) … … 1118 1116 #ifdef IN_GC 1119 1117 Assert(TRPMHasTrap(pVM)); 1120 AssertMsgReturn((RTGCPTR)((RTGCUINTPTR)GCPtrPar1 & ~(RTGCUINTPTR)3) == pvFault, 1121 ("GCPtrPar1=%VGv pvFault=%VGv\n", GCPtrPar1, pvFault), 1122 VERR_EM_INTERPRETER); 1118 EM_ASSERT_FAULT_RETURN((RTGCPTR)((RTGCUINTPTR)GCPtrPar1 & ~(RTGCUINTPTR)3) == pvFault, VERR_EM_INTERPRETER); 1123 1119 #endif 1124 1120 … … 1212 1208 1213 1209 Assert(param2.size <= 8 && param2.size > 0); 1214 1215 #if 0 /* CSAM/PATM translates aliases which causes this to incorrectly trigger. See #2609 and #1498. */ 1216 #ifdef IN_GC 1217 /* Safety check (in theory it could cross a page boundary and fault there though) */ 1218 AssertMsgReturn(pDest == pvFault, ("eip=%VGv pDest=%VGv pvFault=%VGv\n", pRegFrame->rip, pDest, pvFault), VERR_EM_INTERPRETER); 1219 #endif 1220 #endif 1210 EM_ASSERT_FAULT_RETURN(pDest == pvFault, VERR_EM_INTERPRETER); 1221 1211 rc = emRamWrite(pVM, pDest, &val64, param2.size); 1222 1212 if (VBOX_FAILURE(rc)) … … 1248 1238 1249 1239 Assert(param1.size <= 8 && param1.size > 0); 1250 #ifdef IN_GC 1251 /* Safety check (in theory it could cross a page boundary and fault there though) */ 1252 AssertReturn(pSrc == pvFault, VERR_EM_INTERPRETER); 1253 #endif 1240 EM_ASSERT_FAULT_RETURN(pSrc == pvFault, VERR_EM_INTERPRETER); 1254 1241 rc = emRamRead(pVM, &val64, pSrc, param1.size); 1255 1242 if (VBOX_FAILURE(rc)) … … 1526 1513 pParam1 = (RTRCPTR)param1.val.val64; 1527 1514 pParam1 = (RTRCPTR)emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, (RTGCPTR)(RTRCUINTPTR)pParam1); 1528 1529 /* Safety check (in theory it could cross a page boundary and fault there though) */ 1530 AssertMsgReturn(pParam1 == (RTRCPTR)pvFault, ("eip=%VGv pParam1=%VRv pvFault=%VGv\n", pRegFrame->rip, pParam1, pvFault), VERR_EM_INTERPRETER); 1515 EM_ASSERT_FAULT_RETURN(pParam1 == (RTRCPTR)pvFault, VERR_EM_INTERPRETER); 1531 1516 break; 1532 1517 … … 1599 1584 pParam1 = (RTRCPTR)param1.val.val64; 1600 1585 pParam1 = (RTRCPTR)emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, (RTGCPTR)(RTRCUINTPTR)pParam1); 1601 1602 /* Safety check (in theory it could cross a page boundary and fault there though) */ 1603 AssertMsgReturn(pParam1 == (RTRCPTR)pvFault, ("eip=%VGv pParam1=%VRv pvFault=%VGv\n", pRegFrame->rip, pParam1, pvFault), VERR_EM_INTERPRETER); 1586 EM_ASSERT_FAULT_RETURN(pParam1 == (RTRCPTR)pvFault, VERR_EM_INTERPRETER); 1604 1587 break; 1605 1588 … … 1672 1655 pParam1 = (RTRCPTR)param1.val.val64; 1673 1656 pParam1 = (RTRCPTR)emConvertToFlatAddr(pVM, pRegFrame, pCpu, &pCpu->param1, (RTGCPTR)(RTRCUINTPTR)pParam1); 1674 1675 /* Safety check (in theory it could cross a page boundary and fault there though) */ 1676 AssertMsgReturn(pParam1 == (RTRCPTR)pvFault, ("eip=%VGv pParam1=%VRv pvFault=%VGv\n", pRegFrame->rip, pParam1, pvFault), VERR_EM_INTERPRETER); 1657 EM_ASSERT_FAULT_RETURN(pParam1 == (RTRCPTR)pvFault, VERR_EM_INTERPRETER); 1677 1658 break; 1678 1659
Note:
See TracChangeset
for help on using the changeset viewer.