Changeset 42777 in vbox
- Timestamp:
- Aug 11, 2012 8:23:48 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
-
Makefile.kmk (modified) (1 diff)
-
VMMAll/EMAll.cpp (modified) (19 diffs)
-
VMMAll/IEMAll.cpp (modified) (23 diffs)
-
VMMAll/IEMAllCImpl.cpp.h (modified) (6 diffs)
-
include/IEMInternal.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/Makefile.kmk
r42669 r42777 58 58 # Special IEM debug mode which compares the result with REM. 59 59 ifdef IEM_VERIFICATION_MODE 60 VMM_COMMON_DEFS += IEM_VERIFICATION_MODE 60 VMM_COMMON_DEFS += IEM_VERIFICATION_MODE IEM_VERIFICATION_MODE_FULL 61 61 endif 62 62 -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r42707 r42777 47 47 #include <iprt/string.h> 48 48 49 #ifndef IN_RC 50 #undef VBOX_WITH_IEM 51 #endif 49 52 #ifdef VBOX_WITH_IEM 50 # define VBOX_COMPARE_IEM_AND_EM /* debugging... */ 51 # define VBOX_SAME_AS_EM 53 //# define VBOX_COMPARE_IEM_AND_EM /* debugging... */ 54 //# define VBOX_SAME_AS_EM 55 //# define VBOX_COMPARE_IEM_FIRST 52 56 #endif 53 57 … … 84 88 *******************************************************************************/ 85 89 #ifdef VBOX_COMPARE_IEM_AND_EM 90 static const uint32_t g_fInterestingFFs = VMCPU_FF_TO_R3 91 | VMCPU_FF_CSAM_PENDING_ACTION | VMCPU_FF_CSAM_SCAN_PAGE | VMCPU_FF_INHIBIT_INTERRUPTS 92 | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_TSS | VMCPU_FF_TRPM_SYNC_IDT 93 | VMCPU_FF_TLB_FLUSH | VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL; 94 static uint32_t g_fIncomingFFs; 86 95 static CPUMCTX g_IncomingCtx; 87 static CPUMCTX g_EmOutgoingCtx; 88 static bool g_fIgnoreRaxRdx = false; 96 static bool g_fIgnoreRaxRdx = false; 97 98 static uint32_t g_fEmFFs; 99 static CPUMCTX g_EmCtx; 100 static uint8_t g_abEmWrote[256]; 101 static size_t g_cbEmWrote; 102 103 static uint32_t g_fIemFFs; 104 static CPUMCTX g_IemCtx; 105 extern uint8_t g_abIemWrote[256]; 106 extern size_t g_cbIemWrote; 89 107 #endif 90 108 … … 441 459 442 460 #ifdef VBOX_COMPARE_IEM_AND_EM 443 static void emCompareWithIem(PVMCPU pVCpu, PCCPUMCTX pIemCtx, VBOXSTRICTRC rcEm, VBOXSTRICTRC rcIem, 461 static void emCompareWithIem(PVMCPU pVCpu, PCCPUMCTX pEmCtx, PCCPUMCTX pIemCtx, 462 VBOXSTRICTRC rcEm, VBOXSTRICTRC rcIem, 444 463 uint32_t cbEm, uint32_t cbIem) 445 464 { 446 465 /* Quick compare. */ 447 PCCPUMCTX pEmCtx = &g_EmOutgoingCtx;448 466 if ( rcEm == rcIem 449 467 && cbEm == cbIem 450 && memcmp(pIemCtx, pEmCtx, sizeof(*pIemCtx)) == 0) 468 && g_cbEmWrote == g_cbIemWrote 469 && memcmp(g_abIemWrote, g_abEmWrote, g_cbIemWrote) == 0 470 && memcmp(pIemCtx, pEmCtx, sizeof(*pIemCtx)) == 0 471 && (g_fEmFFs & g_fInterestingFFs) == (g_fIemFFs & g_fInterestingFFs) 472 ) 451 473 return; 452 474 453 475 /* Report exact differences. */ 454 RTLogPrintf("! ! EM and IEM differs at %04x:%08RGv !!\n", g_IncomingCtx.cs.Sel, g_IncomingCtx.rip);476 RTLogPrintf("! EM and IEM differs at %04x:%08RGv !\n", g_IncomingCtx.cs.Sel, g_IncomingCtx.rip); 455 477 if (rcEm != rcIem) 456 478 RTLogPrintf(" * rcIem=%Rrc rcEm=%Rrc\n", VBOXSTRICTRC_VAL(rcIem), VBOXSTRICTRC_VAL(rcEm)); … … 458 480 RTLogPrintf(" * cbIem=%#x cbEm=%#x\n", cbIem, cbEm); 459 481 460 if (rcEm == rcIem) 461 { 482 if (RT_SUCCESS(rcEm) && RT_SUCCESS(rcIem)) 483 { 484 if (g_cbIemWrote != g_cbEmWrote) 485 RTLogPrintf("!! g_cbIemWrote=%#x g_cbEmWrote=%#x\n", g_cbIemWrote, g_cbEmWrote); 486 else if (memcmp(g_abIemWrote, g_abEmWrote, g_cbIemWrote)) 487 { 488 RTLogPrintf("!! IemWrote %.*Rhxs\n", RT_MIN(RT_MAX(1, g_cbIemWrote), 64), g_abIemWrote); 489 RTLogPrintf("!! EemWrote %.*Rhxs\n", RT_MIN(RT_MAX(1, g_cbIemWrote), 64), g_abIemWrote); 490 } 491 492 if ((g_fEmFFs & g_fInterestingFFs) != (g_fIemFFs & g_fInterestingFFs)) 493 RTLogPrintf("!! g_fIemFFs=%#x g_fEmFFs=%#x (diff=%#x)\n", g_fIemFFs & g_fInterestingFFs, 494 g_fEmFFs & g_fInterestingFFs, (g_fIemFFs ^ g_fEmFFs) & g_fInterestingFFs); 495 462 496 # define CHECK_FIELD(a_Field) \ 463 497 do \ … … 467 501 switch (sizeof(pEmCtx->a_Field)) \ 468 502 { \ 469 case 1: RTLogPrintf(" %8s differs - iem=%02x - em=%02x\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); break; \470 case 2: RTLogPrintf(" %8s differs - iem=%04x - em=%04x\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); break; \471 case 4: RTLogPrintf(" %8s differs - iem=%08x - em=%08x\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); break; \472 case 8: RTLogPrintf(" %8s differs - iem=%016llx - em=%016llx\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); break; \473 default: RTLogPrintf(" %8s differs\n", #a_Field); break; \503 case 1: RTLogPrintf("!! %8s differs - iem=%02x - em=%02x\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); break; \ 504 case 2: RTLogPrintf("!! %8s differs - iem=%04x - em=%04x\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); break; \ 505 case 4: RTLogPrintf("!! %8s differs - iem=%08x - em=%08x\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); break; \ 506 case 8: RTLogPrintf("!! %8s differs - iem=%016llx - em=%016llx\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); break; \ 507 default: RTLogPrintf("!! %8s differs\n", #a_Field); break; \ 474 508 } \ 475 509 cDiffs++; \ … … 482 516 if (pEmCtx->a_Field != pIemCtx->a_Field) \ 483 517 { \ 484 RTLogPrintf(" %8s differs - iem=%02x - em=%02x\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); \518 RTLogPrintf("!! %8s differs - iem=%02x - em=%02x\n", #a_Field, pIemCtx->a_Field, pEmCtx->a_Field); \ 485 519 cDiffs++; \ 486 520 } \ … … 544 578 if (pEmCtx->rflags.u != pIemCtx->rflags.u) 545 579 { 546 RTLogPrintf(" rflags differs - iem=%08llx em=%08llx\n", pIemCtx->rflags.u, pEmCtx->rflags.u);580 RTLogPrintf("!! rflags differs - iem=%08llx em=%08llx\n", pIemCtx->rflags.u, pEmCtx->rflags.u); 547 581 CHECK_BIT_FIELD(rflags.Bits.u1CF); 548 582 CHECK_BIT_FIELD(rflags.Bits.u1Reserved0); … … 652 686 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 653 687 g_IncomingCtx = *pCtx; 688 g_fIncomingFFs = pVCpu->fLocalForcedActions; 689 g_cbEmWrote = g_cbIemWrote = 0; 690 691 # ifdef VBOX_COMPARE_IEM_FIRST 692 # error 693 /* IEM */ 694 VBOXSTRICTRC rcIem = IEMExecOneBypassEx(pVCpu, pRegFrame, NULL); 695 if (RT_UNLIKELY( rcIem == VERR_IEM_ASPECT_NOT_IMPLEMENTED 696 || rcIem == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 697 rcIem = VERR_EM_INTERPRETER; 698 g_IemCtx = *pCtx; 699 g_fIemFFs = pVCpu->fLocalForcedActions; 700 pVCpu->fLocalForcedActions = (pVCpu->fLocalForcedActions & ~g_fInterestingFFs) | (g_fIncomingFFs & g_fInterestingFFs); 701 *pCtx = g_IncomingCtx; 702 # endif 654 703 655 704 /* EM */ … … 682 731 } 683 732 # endif 684 685 g_EmOutgoingCtx = *pCtx; 733 g_EmCtx = *pCtx; 734 g_fEmFFs = pVCpu->fLocalForcedActions; 735 VBOXSTRICTRC rc = rcEm; 736 737 # ifdef VBOX_COMPARE_IEM_LAST 738 # error 739 /* IEM */ 740 pVCpu->fLocalForcedActions = (pVCpu->fLocalForcedActions & ~g_fInterestingFFs) | (g_fIncomingFFs & g_fInterestingFFs); 686 741 *pCtx = g_IncomingCtx; 687 688 /* IEM */ 689 # endif /* VBOX_COMPARE_IEM_AND_EM */ 742 VBOXSTRICTRC rcIem = IEMExecOneBypassEx(pVCpu, pRegFrame, NULL); 743 if (RT_UNLIKELY( rcIem == VERR_IEM_ASPECT_NOT_IMPLEMENTED 744 || rcIem == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 745 rcIem = VERR_EM_INTERPRETER; 746 g_IemCtx = *pCtx; 747 g_fIemFFs = pVCpu->fLocalForcedActions; 748 rc = rcIem; 749 # endif 750 751 # if defined(VBOX_COMPARE_IEM_LAST) || defined(VBOX_COMPARE_IEM_FIRST) 752 # error 753 emCompareWithIem(pVCpu, &g_EmCtx, &g_IemCtx, rcEm, rcIem, 0, 0); 754 # endif 755 756 # else 690 757 VBOXSTRICTRC rc = IEMExecOneBypassEx(pVCpu, pRegFrame, NULL); 691 758 if (RT_UNLIKELY( rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED 692 759 || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 693 760 rc = VERR_EM_INTERPRETER; 694 695 # ifdef VBOX_COMPARE_IEM_AND_EM696 emCompareWithIem(pVCpu, pCtx, rcEm, rc, 0, 0);697 761 # endif 698 762 if (rc != VINF_SUCCESS) … … 754 818 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 755 819 g_IncomingCtx = *pCtx; 820 g_fIncomingFFs = pVCpu->fLocalForcedActions; 821 g_cbEmWrote = g_cbIemWrote = 0; 822 823 # ifdef VBOX_COMPARE_IEM_FIRST 824 /* IEM */ 825 uint32_t cbIemWritten = 0; 826 VBOXSTRICTRC rcIem = IEMExecOneBypassEx(pVCpu, pRegFrame, &cbIemWritten); 827 if (RT_UNLIKELY( rcIem == VERR_IEM_ASPECT_NOT_IMPLEMENTED 828 || rcIem == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 829 rcIem = VERR_EM_INTERPRETER; 830 g_IemCtx = *pCtx; 831 g_fIemFFs = pVCpu->fLocalForcedActions; 832 pVCpu->fLocalForcedActions = (pVCpu->fLocalForcedActions & ~g_fInterestingFFs) | (g_fIncomingFFs & g_fInterestingFFs); 833 *pCtx = g_IncomingCtx; 834 # endif 756 835 757 836 /* EM */ … … 785 864 } 786 865 # endif 787 788 g_EmOutgoingCtx = *pCtx; 866 g_EmCtx = *pCtx; 867 g_fEmFFs = pVCpu->fLocalForcedActions; 868 *pcbWritten = cbEmWritten; 869 VBOXSTRICTRC rc = rcEm; 870 871 # ifdef VBOX_COMPARE_IEM_LAST 872 /* IEM */ 873 pVCpu->fLocalForcedActions = (pVCpu->fLocalForcedActions & ~g_fInterestingFFs) | (g_fIncomingFFs & g_fInterestingFFs); 789 874 *pCtx = g_IncomingCtx; 790 791 /* IEM */ 792 # endif /* VBOX_COMPARE_IEM_AND_EM */ 875 uint32_t cbIemWritten = 0; 876 VBOXSTRICTRC rcIem = IEMExecOneBypassEx(pVCpu, pRegFrame, &cbIemWritten); 877 if (RT_UNLIKELY( rcIem == VERR_IEM_ASPECT_NOT_IMPLEMENTED 878 || rcIem == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 879 rcIem = VERR_EM_INTERPRETER; 880 g_IemCtx = *pCtx; 881 g_fIemFFs = pVCpu->fLocalForcedActions; 882 *pcbWritten = cbIemWritten; 883 rc = rcIem; 884 # endif 885 886 # if defined(VBOX_COMPARE_IEM_LAST) || defined(VBOX_COMPARE_IEM_FIRST) 887 emCompareWithIem(pVCpu, &g_EmCtx, &g_IemCtx, rcEm, rcIem, cbEmWritten, cbIemWritten); 888 # endif 889 890 # else 793 891 VBOXSTRICTRC rc = IEMExecOneBypassEx(pVCpu, pRegFrame, pcbWritten); 794 892 if (RT_UNLIKELY( rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED 795 893 || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 796 894 rc = VERR_EM_INTERPRETER; 797 798 # ifdef VBOX_COMPARE_IEM_AND_EM799 emCompareWithIem(pVCpu, pCtx, rcEm, rc, cbEmWritten, *pcbWritten);800 895 # endif 801 896 if (rc != VINF_SUCCESS) … … 866 961 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(pVCpu); 867 962 g_IncomingCtx = *pCtx; 963 g_fIncomingFFs = pVCpu->fLocalForcedActions; 964 g_cbEmWrote = g_cbIemWrote = 0; 965 966 # ifdef VBOX_COMPARE_IEM_FIRST 967 VBOXSTRICTRC rcIem = IEMExecOneBypassWithPrefetchedByPC(pVCpu, pRegFrame, pRegFrame->rip, pDis->abInstr, pDis->cbCachedInstr); 968 if (RT_UNLIKELY( rcIem == VERR_IEM_ASPECT_NOT_IMPLEMENTED 969 || rcIem == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 970 rcIem = VERR_EM_INTERPRETER; 971 g_IemCtx = *pCtx; 972 g_fIemFFs = pVCpu->fLocalForcedActions; 973 pVCpu->fLocalForcedActions = (pVCpu->fLocalForcedActions & ~g_fInterestingFFs) | (g_fIncomingFFs & g_fInterestingFFs); 974 *pCtx = g_IncomingCtx; 975 # endif 868 976 869 977 /* EM */ … … 879 987 } 880 988 # endif 881 882 g_EmOutgoingCtx = *pCtx; 989 g_EmCtx = *pCtx; 990 g_fEmFFs = pVCpu->fLocalForcedActions; 991 VBOXSTRICTRC rc = rcEm; 992 993 # ifdef VBOX_COMPARE_IEM_LAST 994 /* IEM */ 995 pVCpu->fLocalForcedActions = (pVCpu->fLocalForcedActions & ~g_fInterestingFFs) | (g_fIncomingFFs & g_fInterestingFFs); 883 996 *pCtx = g_IncomingCtx; 884 885 /* IEM */ 886 # endif 997 VBOXSTRICTRC rcIem = IEMExecOneBypassWithPrefetchedByPC(pVCpu, pRegFrame, pRegFrame->rip, pDis->abInstr, pDis->cbCachedInstr); 998 if (RT_UNLIKELY( rcIem == VERR_IEM_ASPECT_NOT_IMPLEMENTED 999 || rcIem == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 1000 rcIem = VERR_EM_INTERPRETER; 1001 g_IemCtx = *pCtx; 1002 g_fIemFFs = pVCpu->fLocalForcedActions; 1003 rc = rcIem; 1004 # endif 1005 1006 # if defined(VBOX_COMPARE_IEM_LAST) || defined(VBOX_COMPARE_IEM_FIRST) 1007 emCompareWithIem(pVCpu, &g_EmCtx, &g_IemCtx, rcEm, rcIem, 0, 0); 1008 # endif 1009 1010 # else 887 1011 VBOXSTRICTRC rc = IEMExecOneBypassWithPrefetchedByPC(pVCpu, pRegFrame, pRegFrame->rip, pDis->abInstr, pDis->cbCachedInstr); 888 1012 if (RT_UNLIKELY( rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED 889 1013 || rc == VERR_IEM_INSTR_NOT_IMPLEMENTED)) 890 1014 rc = VERR_EM_INTERPRETER; 891 892 # ifdef VBOX_COMPARE_IEM_AND_EM893 emCompareWithIem(pVCpu, pCtx, rcEm, rc, 0, 0);894 1015 # endif 1016 895 1017 if (rc != VINF_SUCCESS) 896 1018 Log(("EMInterpretInstructionDisasState: returns %Rrc\n", VBOXSTRICTRC_VAL(rc))); … … 1249 1371 #endif 1250 1372 rc = VINF_SUCCESS; 1251 #if ndef VBOX_COMPARE_IEM_AND_EM1373 #if !defined(VBOX_COMPARE_IEM_AND_EM) || !defined(VBOX_COMPARE_IEM_LAST) 1252 1374 CPUMSetGuestCR0(pVCpu, val); 1253 1375 #else … … 1579 1701 pages or write monitored pages. */ 1580 1702 NOREF(pVM); 1581 #if ndef VBOX_COMPARE_IEM_AND_EM1582 returnPGMPhysInterpretedWriteNoHandlers(pVCpu, pCtxCore, GCPtrDst, pvSrc, cb, /*fMayTrap*/ false);1703 #if !defined(VBOX_COMPARE_IEM_AND_EM) || !defined(VBOX_COMPARE_IEM_LAST) 1704 int rc = PGMPhysInterpretedWriteNoHandlers(pVCpu, pCtxCore, GCPtrDst, pvSrc, cb, /*fMayTrap*/ false); 1583 1705 #else 1584 return VINF_SUCCESS; 1585 #endif 1706 int rc = VINF_SUCCESS; 1707 #endif 1708 #ifdef VBOX_COMPARE_IEM_AND_EM 1709 Log(("EM Wrote: %RGv %.*Rhxs rc=%Rrc\n", GCPtrDst, RT_MAX(RT_MIN(cb, 64), 1), pvSrc, rc)); 1710 g_cbEmWrote = cb; 1711 memcpy(g_abEmWrote, pvSrc, RT_MIN(cb, sizeof(g_abEmWrote))); 1712 #endif 1713 return rc; 1586 1714 } 1587 1715 … … 2723 2851 } 2724 2852 eflags = EMEmulateCmpXchg(&u64, &pRegFrame->rax, valpar, pDis->Param2.cb); 2853 int rc2 = emRamWrite(pVM, pVCpu, pRegFrame, GCPtrPar1, &u64, pDis->Param2.cb); AssertRCSuccess(rc2); 2725 2854 #endif /* VBOX_COMPARE_IEM_AND_EM */ 2726 2855 … … 2781 2910 uint64_t u64 = *(uint64_t *)pvParam1; 2782 2911 eflags = EMEmulateCmpXchg8b(&u64, &pRegFrame->eax, &pRegFrame->edx, pRegFrame->ebx, pRegFrame->ecx); 2912 int rc2 = emRamWrite(pVM, pVCpu, pRegFrame, GCPtrPar1, &u64, sizeof(u64)); AssertRCSuccess(rc2); 2783 2913 #endif /* VBOX_COMPARE_IEM_AND_EM */ 2784 2914 … … 2863 2993 } 2864 2994 eflags = EMEmulateXAdd(&u64, pvParamReg2, cbParamReg2); 2995 int rc2 = emRamWrite(pVM, pVCpu, pRegFrame, GCPtrPar1, &u64, pDis->Param2.cb); AssertRCSuccess(rc2); 2865 2996 #endif /* VBOX_COMPARE_IEM_AND_EM */ 2866 2997 … … 3624 3755 STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,Failed##Instr)); \ 3625 3756 return rc 3626 # endif /* VBOX_COMPARE_IEM_AND_EM */3757 # endif /* VBOX_COMPARE_IEM_AND_EM */ 3627 3758 3628 3759 #define INTERPRET_CASE_EX_PARAM3(opcode, Instr, InstrFn, pfnEmulate) \ -
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r42725 r42777 70 70 * 71 71 */ 72 73 /** @def IEM_VERIFICATION_MODE_MINIMAL 74 * Use for pitting IEM against EM or something else in ring-0 or raw-mode 75 * context. */ 76 //#define IEM_VERIFICATION_MODE_MINIMAL 72 77 73 78 /******************************************************************************* … … 86 91 # include <VBox/vmm/patm.h> 87 92 #endif 88 #ifdef IEM_VERIFICATION_MODE 93 #include "IEMInternal.h" 94 #ifdef IEM_VERIFICATION_MODE_FULL 89 95 # include <VBox/vmm/rem.h> 90 96 # include <VBox/vmm/mm.h> 91 97 #endif 92 #include "IEMInternal.h"93 98 #include <VBox/vmm/vm.h> 94 99 #include <VBox/log.h> … … 173 178 * Defined Constants And Macros * 174 179 *******************************************************************************/ 175 /** @def IEM_LOG_MEMORY_ACCESS176 * Can be used to log memory accesses when debugging problematic guest behavior. */177 #if 0178 # define IEM_LOG_MEMORY_ACCESS179 #endif180 181 180 /** @name IEM status codes. 182 181 * … … 634 633 iemAImpl_shrd_u64, 635 634 }; 635 636 637 #ifdef IEM_VERIFICATION_MODE_MINIMAL 638 /** What IEM just wrote. */ 639 uint8_t g_abIemWrote[256]; 640 /** How much IEM just wrote. */ 641 size_t g_cbIemWrote; 642 #endif 636 643 637 644 … … 664 671 static uint16_t iemSRegFetchU16(PIEMCPU pIemCpu, uint8_t iSegReg); 665 672 666 #if def IEM_VERIFICATION_MODE673 #if defined(IEM_VERIFICATION_MODE_FULL) && !defined(IEM_VERIFICATION_MODE_MINIMAL) 667 674 static PIEMVERIFYEVTREC iemVerifyAllocRecord(PIEMCPU pIemCpu); 668 675 #endif … … 722 729 PVMCPU pVCpu = IEMCPU_TO_VMCPU(pIemCpu); 723 730 724 #if defined(VBOX_STRICT) && (defined(IEM_VERIFICATION_MODE ) || !defined(VBOX_WITH_RAW_MODE_NOT_R0))731 #if defined(VBOX_STRICT) && (defined(IEM_VERIFICATION_MODE_FULL) || defined(VBOX_WITH_RAW_MODE_NOT_R0)) 725 732 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pCtx->cs)); 726 733 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pCtx->ss)); … … 737 744 #endif 738 745 pIemCpu->uCpl = CPUMGetGuestCPL(pVCpu); 739 #ifdef IEM_VERIFICATION_MODE 746 #ifdef IEM_VERIFICATION_MODE_FULL 740 747 if (pIemCpu->uInjectCpl != UINT8_MAX) 741 748 pIemCpu->uCpl = pIemCpu->uInjectCpl; … … 775 782 static VBOXSTRICTRC iemInitDecoderAndPrefetchOpcodes(PIEMCPU pIemCpu, bool fBypassHandlers) 776 783 { 777 #ifdef IEM_VERIFICATION_MODE 784 #ifdef IEM_VERIFICATION_MODE_FULL 778 785 uint8_t const cbOldOpcodes = pIemCpu->cbOpcode; 779 786 #endif … … 846 853 * TLB... */ 847 854 848 #ifdef IEM_VERIFICATION_MODE 855 #ifdef IEM_VERIFICATION_MODE_FULL 849 856 /* 850 857 * Optimistic optimization: Use unconsumed opcode bytes from the previous … … 4727 4734 static int iemMemPageMap(PIEMCPU pIemCpu, RTGCPHYS GCPhysMem, uint32_t fAccess, void **ppvMem, PPGMPAGEMAPLOCK pLock) 4728 4735 { 4729 #ifdef IEM_VERIFICATION_MODE 4736 #ifdef IEM_VERIFICATION_MODE_FULL 4730 4737 /* Force the alternative path so we can ignore writes. */ 4731 4738 if ((fAccess & IEM_ACCESS_TYPE_WRITE) && !pIemCpu->fNoRem) 4732 4739 return VERR_PGM_PHYS_TLB_CATCH_ALL; 4733 4740 #endif 4734 #ifdef IEM_ LOG_MEMORY_ACCESS4741 #ifdef IEM_VERIFICATION_MODE_MINIMAL 4735 4742 return VERR_PGM_PHYS_TLB_CATCH_ALL; 4736 4743 #endif … … 4839 4846 */ 4840 4847 int rc; 4848 #ifndef IEM_VERIFICATION_MODE_MINIMAL 4841 4849 if ( !pIemCpu->aMemBbMappings[iMemMap].fUnassigned 4842 4850 && !IEM_VERIFICATION_ENABLED(pIemCpu)) … … 4879 4887 } 4880 4888 else 4889 #endif 4881 4890 rc = VINF_SUCCESS; 4882 4891 4883 #if defined(IEM_VERIFICATION_MODE ) && defined(IN_RING3)4892 #if defined(IEM_VERIFICATION_MODE_FULL) && defined(IN_RING3) 4884 4893 /* 4885 4894 * Record the write(s). … … 4915 4924 } 4916 4925 #endif 4917 #ifdef IEM_ LOG_MEMORY_ACCESS4926 #ifdef IEM_VERIFICATION_MODE_MINIMAL 4918 4927 if (rc == VINF_SUCCESS) 4919 4928 { … … 4924 4933 RT_MIN(pIemCpu->aMemBbMappings[iMemMap].cbSecond, 64), 4925 4934 &pIemCpu->aBounceBuffers[iMemMap].ab[pIemCpu->aMemBbMappings[iMemMap].cbFirst])); 4935 4936 size_t cbWrote = pIemCpu->aMemBbMappings[iMemMap].cbFirst + pIemCpu->aMemBbMappings[iMemMap].cbSecond; 4937 g_cbIemWrote = cbWrote; 4938 memcpy(g_abIemWrote, &pIemCpu->aBounceBuffers[iMemMap].ab[0], RT_MIN(cbWrote, sizeof(g_abIemWrote))); 4926 4939 } 4927 4940 #endif … … 5005 5018 } 5006 5019 5007 #if defined(IEM_VERIFICATION_MODE ) && defined(IN_RING3)5020 #if defined(IEM_VERIFICATION_MODE_FULL) && defined(IN_RING3) 5008 5021 if ( !pIemCpu->fNoRem 5009 5022 && (fAccess & (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_EXEC)) ) … … 5103 5116 } 5104 5117 5105 #if defined(IEM_VERIFICATION_MODE ) && defined(IN_RING3)5118 #if defined(IEM_VERIFICATION_MODE_FULL) && defined(IN_RING3) 5106 5119 if ( !pIemCpu->fNoRem 5107 5120 && (fAccess & (IEM_ACCESS_TYPE_READ | IEM_ACCESS_TYPE_EXEC)) ) … … 7434 7447 7435 7448 7436 #if defined(IEM_VERIFICATION_MODE ) && defined(IN_RING3)7449 #if defined(IEM_VERIFICATION_MODE_FULL) && defined(IN_RING3) 7437 7450 7438 7451 /** … … 8243 8256 } 8244 8257 8245 #else /* !IEM_VERIFICATION_MODE || !IN_RING3 */8258 #else /* !IEM_VERIFICATION_MODE_FULL || !IN_RING3 */ 8246 8259 8247 8260 /* stubs */ … … 8258 8271 } 8259 8272 8260 #endif /* !IEM_VERIFICATION_MODE || !IN_RING3 */8273 #endif /* !IEM_VERIFICATION_MODE_FULL || !IN_RING3 */ 8261 8274 8262 8275 … … 8328 8341 else if (rcStrict == VERR_IEM_INSTR_NOT_IMPLEMENTED) 8329 8342 pIemCpu->cRetInstrNotImplemented++; 8330 #ifdef IEM_VERIFICATION_MODE 8343 #ifdef IEM_VERIFICATION_MODE_FULL 8331 8344 else if (rcStrict == VERR_IEM_RESTART_INSTRUCTION) 8332 8345 rcStrict = VINF_SUCCESS; … … 8343 8356 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pIemCpu->CTX_SUFF(pCtx)->cs)); 8344 8357 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pIemCpu->CTX_SUFF(pCtx)->ss)); 8345 #if defined(IEM_VERIFICATION_MODE )8358 #if defined(IEM_VERIFICATION_MODE_FULL) 8346 8359 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pIemCpu->CTX_SUFF(pCtx)->es)); 8347 8360 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pIemCpu->CTX_SUFF(pCtx)->ds)); … … 8363 8376 PIEMCPU pIemCpu = &pVCpu->iem.s; 8364 8377 8365 #if defined(IEM_VERIFICATION_MODE ) && defined(IN_RING3)8378 #if defined(IEM_VERIFICATION_MODE_FULL) && defined(IN_RING3) 8366 8379 iemExecVerificationModeSetup(pIemCpu); 8367 8380 #endif … … 8407 8420 rcStrict = iemExecOneInner(pVCpu, pIemCpu, true); 8408 8421 8409 #if defined(IEM_VERIFICATION_MODE ) && defined(IN_RING3)8422 #if defined(IEM_VERIFICATION_MODE_FULL) && defined(IN_RING3) 8410 8423 /* 8411 8424 * Assert some sanity. -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
r42724 r42777 1025 1025 if (rcStrict != VINF_SUCCESS) 1026 1026 return rcStrict; 1027 #ifdef IEM_VERIFICATION_MODE/** @todo check what VT-x and AMD-V does. */1027 /** @todo check what VT-x and AMD-V does. */ 1028 1028 Desc.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED; 1029 #endif1030 1029 } 1031 1030 … … 1221 1220 if (rcStrict != VINF_SUCCESS) 1222 1221 return rcStrict; 1223 #ifdef IEM_VERIFICATION_MODE/** @todo check what VT-x and AMD-V does. */1222 /** @todo check what VT-x and AMD-V does. */ 1224 1223 Desc.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED; 1225 #endif1226 1224 } 1227 1225 … … 1529 1527 if (rcStrict != VINF_SUCCESS) 1530 1528 return rcStrict; 1531 #ifdef IEM_VERIFICATION_MODE/** @todo check what VT-x and AMD-V does. */1529 /** @todo check what VT-x and AMD-V does. */ 1532 1530 DescCs.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED; 1533 #endif1534 1531 } 1535 1532 /** @todo Testcase: Need to check WHEN exactly the SS accessed bit is set. */ … … 1539 1536 if (rcStrict != VINF_SUCCESS) 1540 1537 return rcStrict; 1541 #ifdef IEM_VERIFICATION_MODE/** @todo check what VT-x and AMD-V does. */1538 /** @todo check what VT-x and AMD-V does. */ 1542 1539 DescSs.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED; 1543 #endif1544 1540 } 1545 1541 … … 1622 1618 if (rcStrict != VINF_SUCCESS) 1623 1619 return rcStrict; 1624 #ifdef IEM_VERIFICATION_MODE/** @todo check what VT-x and AMD-V does. */1620 /** @todo check what VT-x and AMD-V does. */ 1625 1621 DescCs.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED; 1626 #endif1627 1622 } 1628 1623 … … 3743 3738 pCtx->rax = (uint32_t)uTicks; 3744 3739 pCtx->rdx = uTicks >> 32; 3745 #ifdef IEM_VERIFICATION_MODE 3740 #ifdef IEM_VERIFICATION_MODE_FULL 3746 3741 pIemCpu->fIgnoreRaxRdx = true; 3747 3742 #endif -
trunk/src/VBox/VMM/include/IEMInternal.h
r42704 r42777 32 32 * @{ 33 33 */ 34 35 /** @def IEM_VERIFICATION_MODE_FULL 36 * Shorthand for: 37 * defined(IEM_VERIFICATION_MODE) && !defined(IEM_VERIFICATION_MODE_MINIMAL) 38 */ 39 #if defined(IEM_VERIFICATION_MODE) && !defined(IEM_VERIFICATION_MODE_MINIMAL) && !defined(IEM_VERIFICATION_MODE_FULL) 40 # define IEM_VERIFICATION_MODE_FULL 41 #endif 34 42 35 43 … … 121 129 122 130 123 #ifdef IEM_VERIFICATION_MODE 131 #ifdef IEM_VERIFICATION_MODE_FULL 124 132 125 133 /** … … 184 192 typedef IEMVERIFYEVTREC *PIEMVERIFYEVTREC; 185 193 186 #endif /* IEM_VERIFICATION_MODE */194 #endif /* IEM_VERIFICATION_MODE_FULL */ 187 195 188 196 … … 247 255 /** Number of times rcPassUp has been used. */ 248 256 uint32_t cRetPassUpStatus; 249 #ifdef IEM_VERIFICATION_MODE 257 #ifdef IEM_VERIFICATION_MODE_FULL 250 258 /** The Number of I/O port reads that has been performed. */ 251 259 uint32_t cIOReads; … … 369 377 } aBounceBuffers[3]; 370 378 371 #ifdef IEM_VERIFICATION_MODE 379 #ifdef IEM_VERIFICATION_MODE_FULL 372 380 /** The event verification records for what IEM did (LIFO). */ 373 381 R3PTRTYPE(PIEMVERIFYEVTREC) pIemEvtRecHead; … … 464 472 * should therefore cause the compiler to eliminate the verification branch 465 473 * of an if statement. */ 466 #ifdef IEM_VERIFICATION_MODE 474 #ifdef IEM_VERIFICATION_MODE_FULL 467 475 # define IEM_VERIFICATION_ENABLED(a_pIemCpu) (!(a_pIemCpu)->fNoRem) 476 #elif defined(IEM_VERIFICATION_MODE_MINIMAL) 477 # define IEM_VERIFICATION_ENABLED(a_pIemCpu) (true) 468 478 #else 469 479 # define IEM_VERIFICATION_ENABLED(a_pIemCpu) (false) 470 480 #endif 471 481 482 /** @def IEM_VERIFICATION_MODE 483 * Indicates that one of the verfication modes are enabled. 484 */ 485 #if (defined(IEM_VERIFICATION_MODE_FULL) || defined(IEM_VERIFICATION_MODE_MINIMAL)) && !defined(IEM_VERIFICATION_MODE) 486 # define IEM_VERIFICATION_MODE 487 #endif 488 472 489 /** 473 490 * Indicates to the verifier that the given flag set is undefined. … … 477 494 * This is a NOOP if the verifier isn't compiled in. 478 495 */ 479 #ifdef IEM_VERIFICATION_MODE 496 #ifdef IEM_VERIFICATION_MODE_FULL 480 497 # define IEMOP_VERIFICATION_UNDEFINED_EFLAGS(a_fEfl) do { pIemCpu->fUndefinedEFlags |= (a_fEfl); } while (0) 481 498 #else
Note:
See TracChangeset
for help on using the changeset viewer.

