Changeset 45781 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Apr 26, 2013 3:22:07 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r45774 r45781 1910 1910 } 1911 1911 1912 for (VMCPUID i = 0; i < pVM->cCpus; i++)1913 {1914 PVMCPU pVCpu = &pVM->aCpus[i];1915 1916 /* Current guest paging mode. */1917 pVCpu->hm.s.vmx.enmLastSeenGuestMode = PGMMODE_REAL;1918 }1919 1920 1912 return VINF_SUCCESS; 1921 1913 } … … 3395 3387 { 3396 3388 Assert(pVM->hm.s.vmx.pRealModeTSS); 3397 PGMMODE enmGuestMode = PGMGetGuestMode(pVCpu);3398 if (pVCpu->hm.s.vmx.enmLastSeenGuestMode != enmGuestMode)3389 if ( pVCpu->hm.s.vmx.fWasInRealMode 3390 && PGMGetGuestMode(pVCpu) >= PGMMODE_PROTECTED) 3399 3391 { 3400 AssertCompile(PGMMODE_REAL < PGMMODE_PROTECTED); 3401 if ( pVCpu->hm.s.vmx.enmLastSeenGuestMode == PGMMODE_REAL 3402 && enmGuestMode >= PGMMODE_PROTECTED) 3403 { 3404 /* Signal that recompiler must flush its code-cache as the guest -may- rewrite code it will later execute 3405 in real-mode (e.g. OpenBSD 4.0) */ 3406 REMFlushTBs(pVM); 3407 Log(("Load: Switch to protected mode detected!\n")); 3408 } 3409 pVCpu->hm.s.vmx.enmLastSeenGuestMode = enmGuestMode; 3392 /* Signal that recompiler must flush its code-cache as the guest -may- rewrite code it will later execute 3393 in real-mode (e.g. OpenBSD 4.0) */ 3394 REMFlushTBs(pVM); 3395 Log(("Load: Switch to protected mode detected!\n")); 3396 pVCpu->hm.s.vmx.fWasInRealMode = false; 3410 3397 } 3411 3398 } -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r45739 r45781 1487 1487 1488 1488 pVCpu->hm.s.enmShadowMode = PGMGetShadowMode(pVCpu); 1489 #ifdef VBOX_WITH_OLD_VTX_CODE 1489 1490 Assert(pVCpu->hm.s.vmx.enmCurrGuestMode == PGMGetGuestMode(pVCpu)); 1490 1491 pVCpu->hm.s.vmx.enmCurrGuestMode = PGMGetGuestMode(pVCpu); 1492 #endif 1491 1493 } 1492 1494 } … … 1567 1569 } 1568 1570 } 1569 #endif1570 1571 1571 1572 if (pVCpu->hm.s.vmx.enmCurrGuestMode != enmGuestMode) … … 1583 1584 } 1584 1585 } 1586 #else 1587 /* If the guest left protected mode VMX execution, we'll have to be extra 1588 * careful if/when the guest switches back to protected mode. 1589 */ 1590 if (enmGuestMode == PGMMODE_REAL) 1591 { 1592 Log(("HMR3PagingModeChanged indicates real mode execution\n")); 1593 pVCpu->hm.s.vmx.fWasInRealMode = true; 1594 } 1595 #endif 1585 1596 1586 1597 /** @todo r=ramshankar: Why do we need to do this? Most likely … … 1669 1680 pVCpu->hm.s.Event.fPending = false; 1670 1681 1682 #ifdef VBOX_WITH_OLD_VTX_CODE 1671 1683 /* Reset state information for real-mode emulation in VT-x. */ 1672 1684 pVCpu->hm.s.vmx.enmLastSeenGuestMode = PGMMODE_REAL; 1673 1685 pVCpu->hm.s.vmx.enmPrevGuestMode = PGMMODE_REAL; 1674 1686 pVCpu->hm.s.vmx.enmCurrGuestMode = PGMMODE_REAL; 1687 #else 1688 pVCpu->hm.s.vmx.fWasInRealMode = true; 1689 #endif 1675 1690 1676 1691 /* Reset the contents of the read cache. */ … … 2383 2398 mode. VT-x can't handle the CPU state right after a switch 2384 2399 from real to protected mode. (all sorts of RPL & DPL assumptions) */ 2400 #if VBOX_WITH_OLD_VTX_CODE 2385 2401 if ( pVCpu->hm.s.vmx.enmLastSeenGuestMode == PGMMODE_REAL 2386 2402 && enmGuestMode >= PGMMODE_PROTECTED) 2403 #else 2404 if (pVCpu->hm.s.vmx.fWasInRealMode) 2405 #endif 2387 2406 { 2388 2407 if ( (pCtx->cs.Sel & X86_SEL_RPL) … … 2784 2803 AssertRCReturn(rc, rc); 2785 2804 2805 #if VBOX_WITH_OLD_VTX_CODE 2786 2806 rc = SSMR3PutU32(pSSM, pVM->aCpus[i].hm.s.vmx.enmLastSeenGuestMode); 2787 2807 AssertRCReturn(rc, rc); … … 2790 2810 rc = SSMR3PutU32(pSSM, pVM->aCpus[i].hm.s.vmx.enmPrevGuestMode); 2791 2811 AssertRCReturn(rc, rc); 2812 #else 2813 //@todo: We only need to save pVM->aCpus[i].hm.s.vmx.fWasInRealMode and 2814 // perhaps not even that (the initial value of 'true' is safe). 2815 uint32_t u32Dummy = PGMMODE_REAL; 2816 rc = SSMR3PutU32(pSSM, u32Dummy); 2817 AssertRCReturn(rc, rc); 2818 rc = SSMR3PutU32(pSSM, u32Dummy); 2819 AssertRCReturn(rc, rc); 2820 rc = SSMR3PutU32(pSSM, u32Dummy); 2821 AssertRCReturn(rc, rc); 2822 #endif 2792 2823 } 2793 2824 #ifdef VBOX_HM_WITH_GUEST_PATCHING … … 2882 2913 uint32_t val; 2883 2914 2915 #ifdef VBOX_WITH_OLD_VTX_CODE 2884 2916 rc = SSMR3GetU32(pSSM, &val); 2885 2917 AssertRCReturn(rc, rc); … … 2893 2925 AssertRCReturn(rc, rc); 2894 2926 pVM->aCpus[i].hm.s.vmx.enmPrevGuestMode = (PGMMODE)val; 2927 #else 2928 //@todo: See note above re saving enmLastSeenGuestMode 2929 rc = SSMR3GetU32(pSSM, &val); 2930 AssertRCReturn(rc, rc); 2931 rc = SSMR3GetU32(pSSM, &val); 2932 AssertRCReturn(rc, rc); 2933 rc = SSMR3GetU32(pSSM, &val); 2934 AssertRCReturn(rc, rc); 2935 #endif 2895 2936 } 2896 2937 } -
trunk/src/VBox/VMM/include/HMInternal.h
r45737 r45781 688 688 } lasterror; 689 689 690 #ifdef VBOX_WITH_OLD_VTX_CODE 690 691 /** The last seen guest paging mode (by VT-x). */ 691 692 PGMMODE enmLastSeenGuestMode; … … 694 695 /** Previous guest paging mode (as seen by HMR3PagingModeChanged). */ 695 696 PGMMODE enmPrevGuestMode; 697 #else 698 /** Set if guest was executing in real mode (extra checks). */ 699 bool fWasInRealMode; 700 #endif 696 701 } vmx; 697 702
Note:
See TracChangeset
for help on using the changeset viewer.